newdescription = otherIdentifiedObject.getDescription(); this.setDescription(newdescription); newaliasName = otherIdentifiedObject.getAliasName(); this.setAliasName(newaliasName); newname = otherIdentifiedObject.getName(); this.setName(newname);
@Override public String getId(IdentifiedObject object) { return object.getId(); }
/** * Factory of the class * * @param id * id of the class IdentifiedObject to create * @return the class created */ public static IdentifiedObject create(final String id) { IdentifiedObject newIdentifiedObject = new IdentifiedObject(); newIdentifiedObject.setId(id); return newIdentifiedObject; }
/** * Utility to read a reference to a resource * This function is called by the CIMModel * * @param class_name * the read name of class * @param resource_name * the read name of the associated resource * @param id * the id of the associated resource * @param model * the model this class belongs to * @throws InterpretationException */ @Override public void readResource(final String class_name, final String resource_name, final String id, CIMModel model) throws InterpretationException, LinkageException { if (class_name.equals("Equipment")) { if (resource_name.equals("MemberOf_EquipmentContainer")) { idMemberOf_EquipmentContainer = id.substring(1); if (!super.isAddedToUnresolved()) { model.addUnresolved(); super.addToUnresolved(); } } } else { super.readResource(class_name, resource_name, id, model); } }
xmlsw.writeCharacters(getDescription()); xmlsw.writeEndElement(); errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); xmlsw.writeCharacters(getAliasName()); xmlsw.writeEndElement(); errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); xmlsw.writeCharacters(getName()); xmlsw.writeEndElement(); errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e);
private static void addName(Map<String, String> idMapping, Set<String> names, cim1.model.IdentifiedObject object) { StringBuilder name = new StringBuilder(); if (object instanceof cim1.model.PowerTransformer) { // name field seems to always contains "1" while description seems to have a name constistent with // lines one. Just reshape it to look like lines Matcher matcher = POWER_TRANSFORMER_DESCRIPTION_PATTERN.matcher(object.getDescription()); if (matcher.matches()) { name.append(matcher.group(1)).append("_").append(matcher.group(2)).append("_").append(matcher.group(3)).append("_").append(matcher.group(4)); } } else { name.append(object.getName().trim()); // generators and loads have the same naming and collides, just add to suffixe to distinguish generators // and loads if (object instanceof SynchronousMachine) { name.append("_GEN"); } else if (object instanceof EnergyConsumer) { name.append("_LOAD"); } } if (name.toString().isEmpty()) { throw new CIM1Exception(object.getId() + " is unnamed"); } if (names.contains(name.toString())) { throw new CIM1Exception(object.getId() + " name is not unique: " + name); } names.add(name.toString()); idMapping.put(object.getId(), name.toString()); }
/** * Copy constructor * The associations with other objects are not copied * * @param IdentifiedObject * the reference to the class to copy * @return the class constructed */ private IdentifiedObject(final IdentifiedObject otherIdentifiedObject) { // TODO : check exception safe this.copyBase(otherIdentifiedObject); }
/** * Utility to clear the associations of this class belonging to a * specific subset * * @param subset * the subset from which to clear the associations of this class */ @Override protected void clearAssociations(final Subset subset) { switch (subset) { case StateVariables: { super.clearAssociations(subset); break; } case Topology: { super.clearAssociations(subset); break; } case Equipment: { super.clearAssociations(subset); break; } default: // nothing to clear } }
@Override public String getName(IdentifiedObject object) { return object.getName(); }
/** * Utility to "clear" the content of a class when a subset is invalidated * * @param subset subset to clean */ @Override public void clearContent(Subset subset) { // First of all, we clear the associations: this.clearAssociations(subset); // The function has been called by a concrete class : // the checking has already been done so we can clear everything ! super.clearContent(subset); }
/** * Utility to check whether this class is consistent according to a subset * * @param subset * the subset defining the context in which to check whether this class is consistent * @return a ConsistencyCheck instance whose boolean attribute (consistent) * indicates if this class is consistent and whose String attribute * (message) * indicates why this class is not consistent if it is not */ @Override public ConsistencyCheck modelConsistency(final Subset subset) { BitSet intersection = new BitSet(this.minBitsets.get(subset).length()); intersection.or(this.minBitsets.get(subset)); // we create a copy of minBitsets.get(subset) intersection.and(this.currentBitset); boolean consistent = (this.minBitsets.get(subset).equals(intersection)); StringBuilder message = new StringBuilder(""); if (!consistent) { message.append(getMessageForConsistency(this.minBitsets.get(subset))); } return new ConsistencyCheck(consistent, message.toString()); }
/** * Utility returning a copy of the "base" of this instance * This utility does not copy the associations with other instances * * @return a clone of this instance */ public IdentifiedObject clone() { IdentifiedObject newInstance = new IdentifiedObject(this); IdentifiedObject newInstanceSP = newInstance; return newInstanceSP; }
/** * Utility to read a reference to a resource * This function is called by the CIMModel * * @param class_name * the read name of class * @param resource_name * the read name of the associated resource * @param id * the id of the associated resource * @param model * the model this class belongs to * @throws InterpretationException */ @Override public void readResource(final String class_name, final String resource_name, final String id, CIMModel model) throws InterpretationException, LinkageException { if (class_name.equals("VoltageControlZone")) { if (resource_name.equals("BusbarSection")) { idBusbarSection = id.substring(1); if (!super.isAddedToUnresolved()) { model.addUnresolved(); super.addToUnresolved(); } } } else { super.readResource(class_name, resource_name, id, model); } }
/** * Utility to copy the "base" of an other instance of the same class * This utility does not copy the associations with other instances from * the instance to copy * * @param otherCurve * the instance to copy */ public void copyBase(final Curve otherCurve) { // Memory allocation has done successfully ! // Dropping "old" objects... // This part may change : we do nothing to allow the user to access // object by their id from the global model. // TODO : Call the parent copy constructor instead ? super.copyBase(otherCurve); }
/** * Utility to clear the associations of this class belonging to a * specific subset * * @param subset * the subset from which to clear the associations of this class */ @Override protected void clearAssociations(final Subset subset) { switch (subset) { case StateVariables: { super.clearAssociations(subset); break; } case Topology: { super.clearAssociations(subset); break; } case Equipment: { super.clearAssociations(subset); break; } default: // nothing to clear } }
@Override public String getName(IdentifiedObject object) { return object.getName(); }
/** * Utility to "clear" the content of a class when a subset is invalidated * * @param subset subset to clean */ @Override public void clearContent(Subset subset) { // First of all, we clear the associations: this.clearAssociations(subset); // The function has been called by a concrete class : // the checking has already been done so we can clear everything ! super.clearContent(subset); }
/** * Utility to check whether this class is consistent in a "merged" context * * @return a ConsistencyCheck instance whose boolean attribute (consistent) * indicates if this class is consistent and whose String attribute * (message) * indicates why this class is not consistent if it is not */ @Override public ConsistencyCheck modelConsistency() { BitSet intersection = new BitSet(this.minBitset.length()); intersection.or(this.minBitset); // we create a copy of minBitSet intersection.and(this.currentBitset); boolean consistent = (this.minBitset.equals(intersection)); StringBuilder message = new StringBuilder(""); if (!consistent) { message.append(getMessageForConsistency(this.minBitset)); } return new ConsistencyCheck(consistent, message.toString()); }
idRegulatingControl = id.substring(1); if (!super.isAddedToUnresolved()) { model.addUnresolved(); super.addToUnresolved(); idSvTapStep = id.substring(1); if (!super.isAddedToUnresolved()) { model.addUnresolved(); super.addToUnresolved(); super.readResource(class_name, resource_name, id, model);
/** * Utility to copy the "base" of an other instance of the same class * This utility does not copy the associations with other instances from * the instance to copy * * @param otherGeographicalRegion * the instance to copy */ public void copyBase(final GeographicalRegion otherGeographicalRegion) { // Memory allocation has done successfully ! // Dropping "old" objects... // This part may change : we do nothing to allow the user to access // object by their id from the global model. // TODO : Call the parent copy constructor instead ? super.copyBase(otherGeographicalRegion); }