public static void setBoolean(SNode node, String propertyName, boolean value) { if (node != null) { SNode conceptProperty = (SNode) findProperty(node, propertyName); if (SNodeOperations.isInstanceOf( conceptProperty, "jetbrains.mps.lang.structure.structure.BooleanConceptProperty") && !(value)) { node.removeChild(conceptProperty); } else if (conceptProperty == null && value) { for (SNode cpd : (List<SNode>) SModelSearchUtil.getConceptPropertyDeclarations(node)) { if (SPropertyOperations.getString(cpd, "name").equals(propertyName)) { if (SNodeOperations.isInstanceOf( cpd, "jetbrains.mps.lang.structure.structure.BooleanConceptPropertyDeclaration")) { SNode bcp = SModelOperations.createNewNode( SNodeOperations.getModel(node), null, "jetbrains.mps.lang.structure.structure.BooleanConceptProperty"); SLinkOperations.setTarget( bcp, "conceptPropertyDeclaration", SNodeOperations.cast( cpd, "jetbrains.mps.lang.structure.structure.BooleanConceptPropertyDeclaration"), false); ListSequence.fromList(SLinkOperations.getTargets(node, "conceptProperty", true)) .addElement(bcp); break; } } } } } }
public static boolean getBoolean(SNode node, String propertyName) { if (node == null) { return false; } SNode conceptProperty = (SNode) findProperty(node, propertyName); return SNodeOperations.isInstanceOf( conceptProperty, "jetbrains.mps.lang.structure.structure.BooleanConceptProperty"); }
public static boolean isChildAttribute(SNode node) { return isAttribute(node) && SNodeOperations.isInstanceOf( ((SNode) node), MetaAdapterFactory.getConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x9d98713f247885aL, "jetbrains.mps.lang.core.structure.ChildAttribute")); }
public static boolean isLinkAttribute(SNode node) { return isAttribute(node) && SNodeOperations.isInstanceOf( ((SNode) node), MetaAdapterFactory.getConcept( 0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x2eb1ad060897da51L, "jetbrains.mps.lang.core.structure.LinkAttribute")); }
public static void setInteger(SNode node, String propertyName, int value) { if (node != null) { SNode conceptProperty = (SNode) findProperty(node, propertyName); if (SNodeOperations.isInstanceOf( conceptProperty, "jetbrains.mps.lang.structure.structure.IntegerConceptProperty")) { SPropertyOperations.set( SNodeOperations.cast( conceptProperty, "jetbrains.mps.lang.structure.structure.IntegerConceptProperty"), "value", "" + (value)); } } }
public static int getInteger(SNode node, String propertyName) { if (node == null) { return 0; } SNode conceptProperty = (SNode) findProperty(node, propertyName); if (SNodeOperations.isInstanceOf( conceptProperty, "jetbrains.mps.lang.structure.structure.IntegerConceptProperty")) { return SPropertyOperations.getInteger( SNodeOperations.cast( conceptProperty, "jetbrains.mps.lang.structure.structure.IntegerConceptProperty"), "value"); } return 0; }