use of org.whole.lang.commons.builders.ICommonsBuilder in project whole by wholeplatform.
the class ModelsArtifactsTemplateManager method newModelArtifact.
public ITemplateFactory<Workspace> newModelArtifact(final EntityDescriptor<?> fileContentRootED) {
return new AbstractTemplateFactory<Workspace>() {
public void apply(org.whole.lang.builders.IBuilderOperation op) {
IArtifactsBuilder b0 = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
b0.Workspace_();
cb.Resolver();
b0.Projects_(1);
b0.Project_();
cb.Variable("projectName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
cb.Resolver();
b0.Metadata();
b0.Artifacts_(1);
b0.FolderArtifact_();
cb.Variable("sourceFolderName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
b0.Metadata();
b0.Artifacts_(1);
b0.PackageArtifact_();
cb.Variable("packageName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
b0.Metadata();
b0.Artifacts_(1);
b0.FileArtifact_();
b0.NameWithExtension_();
cb.Variable("modelFileName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
b0.Extension("java");
b0._NameWithExtension();
b0.Metadata_();
b0.wFeature(ArtifactsFeatureDescriptorEnum.persistenceKitId);
b0.PersistenceKitId("org.whole.lang.java.codebase.JavaBuilderPersistenceKit");
b0._Metadata();
cb.StageUpFragment_();
cb.Variable("modelFileContent", fileContentRootED, QuantifierEnum.MANDATORY);
cb._StageUpFragment();
b0._FileArtifact();
b0._Artifacts();
b0._PackageArtifact();
b0._Artifacts();
b0._FolderArtifact();
b0._Artifacts();
b0._Project();
b0._Projects();
b0._Workspace();
}
};
}
use of org.whole.lang.commons.builders.ICommonsBuilder in project whole by wholeplatform.
the class ResourceTemplateTest method getMetadataPattern.
private IEntity getMetadataPattern() {
ModelBuilderOperation op = new ModelBuilderOperation();
IArtifactsBuilder ab = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
ab.Metadata_();
cb.Resolver();
cb.Resolver();
cb.Resolver();
ab.Attributes_(1);
ab.Attribute(AttributeEnum.readonly);
ab._Attributes();
cb.Resolver();
ab._Metadata();
return op.wGetResult();
}
use of org.whole.lang.commons.builders.ICommonsBuilder in project whole by wholeplatform.
the class ResourceTemplateTest method getFilesystemPattern.
private IEntity getFilesystemPattern() {
ModelBuilderOperation op = new ModelBuilderOperation();
IArtifactsBuilder ab = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
ab.FolderArtifact_();
ab.Name("testfolder");
cb.Resolver();
ab.Artifacts_(3);
ab.FolderArtifact_();
ab.Name("empty.folder");
cb.Resolver();
ab.Artifacts();
ab._FolderArtifact();
ab.FolderArtifact_();
ab.Name("subfolder");
cb.Resolver();
ab.Artifacts_(1);
ab.FileArtifact_();
ab.NameWithExtension_();
ab.Name("test");
ab.Extension("txt");
ab._NameWithExtension();
cb.Resolver();
cb.Resolver();
ab._FileArtifact();
ab._Artifacts();
ab._FolderArtifact();
ab.FileArtifact_();
ab.NameWithExtension_();
ab.Name("test.extensions");
ab.Extension("txt");
ab._NameWithExtension();
cb.Resolver();
cb.Resolver();
ab._FileArtifact();
ab.FileArtifact_();
ab.Name("withoutext");
cb.Resolver();
cb.Resolver();
ab._FileArtifact();
return op.wGetResult();
}
use of org.whole.lang.commons.builders.ICommonsBuilder in project whole by wholeplatform.
the class Factorial method apply.
public void apply(IBuilderOperation op) {
IImpBuilder b0 = (IImpBuilder) op.wGetBuilder(ImpLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
b0.FunctionDeclaration_();
b0.PrimitiveType("void");
b0.Name("testFactorial");
cb.Resolver();
b0.BlockStatement_(4);
b0.FunctionDeclaration_();
b0.PrimitiveType("int");
b0.Name("ifact");
b0.Parameters_(1);
b0.Parameter_();
b0.PrimitiveType("int");
b0.Name("n");
b0._Parameter();
b0._Parameters();
b0.BlockStatement_(3);
b0.VariableDeclaration_();
b0.PrimitiveType("int");
b0.Name("result");
b0.IntLiteral(1);
b0._VariableDeclaration();
b0.WhileStatement_();
b0.GreaterThan_();
b0.NameExpression("n");
b0.IntLiteral(0);
b0._GreaterThan();
b0.BlockStatement_(2);
b0.ExpressionStatement_();
b0.AssignmentExpression_();
b0.Name("result");
b0.Multiplication_();
b0.NameExpression("result");
b0.NameExpression("n");
b0._Multiplication();
b0._AssignmentExpression();
b0._ExpressionStatement();
b0.ExpressionStatement_();
b0.AssignmentExpression_();
b0.Name("n");
b0.Subtraction_();
b0.NameExpression("n");
b0.IntLiteral(1);
b0._Subtraction();
b0._AssignmentExpression();
b0._ExpressionStatement();
b0._BlockStatement();
b0._WhileStatement();
b0.ReturnStatement_();
b0.NameExpression("result");
b0._ReturnStatement();
b0._BlockStatement();
b0._FunctionDeclaration();
b0.FunctionDeclaration_();
b0.PrimitiveType("int");
b0.Name("rfact");
b0.Parameters_(1);
b0.Parameter_();
b0.PrimitiveType("int");
b0.Name("n");
b0._Parameter();
b0._Parameters();
b0.IfElseStatement_();
b0.LessOrEquals_();
b0.NameExpression("n");
b0.IntLiteral(1);
b0._LessOrEquals();
b0.ReturnStatement_();
b0.IntLiteral(1);
b0._ReturnStatement();
b0.ReturnStatement_();
b0.Multiplication_();
b0.NameExpression("n");
b0.FunctionInvocationExpression_();
b0.NameExpression("rfact");
b0.Arguments_(1);
b0.Subtraction_();
b0.NameExpression("n");
b0.IntLiteral(1);
b0._Subtraction();
b0._Arguments();
b0._FunctionInvocationExpression();
b0._Multiplication();
b0._ReturnStatement();
b0._IfElseStatement();
b0._FunctionDeclaration();
b0.PrintlnStatement_();
b0.FunctionInvocationExpression_();
b0.NameExpression("ifact");
b0.Arguments_(1);
b0.IntLiteral(4);
b0._Arguments();
b0._FunctionInvocationExpression();
b0._PrintlnStatement();
b0.PrintlnStatement_();
b0.FunctionInvocationExpression_();
b0.NameExpression("rfact");
b0.Arguments_(1);
b0.IntLiteral(3);
b0._Arguments();
b0._FunctionInvocationExpression();
b0._PrintlnStatement();
b0._BlockStatement();
b0._FunctionDeclaration();
}
use of org.whole.lang.commons.builders.ICommonsBuilder in project whole by wholeplatform.
the class AttributesMatcherFactory method getDefaultNsDeclPattern.
private static IEntity getDefaultNsDeclPattern() {
if (defaultNsDeclPattern == null) {
ModelBuilderOperation mop = new ModelBuilderOperation();
IXmlBuilder xb = (IXmlBuilder) mop.wGetBuilder(XmlLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) mop.wGetBuilder(CommonsLanguageKit.URI);
xb.Attribute_();
xb.Name("xmlns");
cb.Variable_();
cb.VarType(XmlEntityDescriptorEnum.Value);
cb.VarName("uri");
cb.Quantifier(QuantifierEnum.MANDATORY);
cb._Variable();
xb._Attribute();
defaultNsDeclPattern = mop.wGetResult();
}
return defaultNsDeclPattern;
}
Aggregations