public static LinkedList<String> GetComponentTypes() { LinkedList<String> result = new LinkedList<String>(); for (IOComponentTypes comp : IOComponentTypes.KnownComponentSet) { result.add(comp.toString()); } return result; };
public Element GetDocumentElement(Document doc) { if (MyType.equals(IOComponentTypes.Unknown)) { return null; } try { Element result = doc.createElement(MyType.toString()); result.setAttribute( BoardWriterClass.LocationXString, Integer.toString(MyRectangle.getXpos())); Attr ypos = doc.createAttribute(BoardWriterClass.LocationYString); ypos.setValue(Integer.toString(MyRectangle.getYpos())); result.setAttributeNode(ypos); Attr width = doc.createAttribute(BoardWriterClass.WidthString); width.setValue(Integer.toString(MyRectangle.getWidth())); result.setAttributeNode(width); Attr height = doc.createAttribute(BoardWriterClass.HeightString); height.setValue(Integer.toString(MyRectangle.getHeight())); result.setAttributeNode(height); if (NrOfPins == 1) { Attr loc = doc.createAttribute(BoardWriterClass.PinLocationString); loc.setValue(MyPinLocations.get(0)); result.setAttributeNode(loc); } else { Attr NrPins = doc.createAttribute(BoardWriterClass.MultiPinInformationString); NrPins.setValue(NrOfPins.toString()); result.setAttributeNode(NrPins); for (int i = 0; i < NrOfPins; i++) { String PinName = BoardWriterClass.MultiPinPrefixString + Integer.toString(i); Attr PinX = doc.createAttribute(PinName); PinX.setValue(MyPinLocations.get(i)); result.setAttributeNode(PinX); } } if (MyDriveStrength != DriveStrength.Unknown) { Attr drive = doc.createAttribute(DriveStrength.DriveAttributeString); drive.setValue(DriveStrength.Behavior_strings[MyDriveStrength]); result.setAttributeNode(drive); } if (MyPullBehavior != PullBehaviors.Unknown) { Attr pull = doc.createAttribute(PullBehaviors.PullAttributeString); pull.setValue(PullBehaviors.Behavior_strings[MyPullBehavior]); result.setAttributeNode(pull); } if (MyIOStandard != IoStandards.Unknown) { Attr stand = doc.createAttribute(IoStandards.IOAttributeString); stand.setValue(IoStandards.Behavior_strings[MyIOStandard]); result.setAttributeNode(stand); } if (MyActivityLevel != PinActivity.Unknown) { Attr act = doc.createAttribute(PinActivity.ActivityAttributeString); act.setValue(PinActivity.Behavior_strings[MyActivityLevel]); result.setAttributeNode(act); } return result; } catch (Exception e) { /* TODO: handle exceptions */ logger.error( "Exceptions not handled yet in GetDocumentElement(), but got an exception: {}", e.getMessage()); } return null; }