List of usage examples for org.jdom2 Element getTextNormalize
public String getTextNormalize()
From source file:TVShowTimelineMaker.timeConstraints.AgeConstraint.java
public AgeConstraint(Element root) { super(root);/*w ww. j a v a2 s .c o m*/ EventImp.EventIDXMLWriter appEventIDXMLWriter = EventImp.EventIDXMLWriter.instance; Element characterElement = root.getChild("CharacterByID"); this.mCharacter = NamedCharacterIDXMLWriter.instance.readElements(characterElement); Element EventElement = root.getChild("EventByID"); this.mAtEvent = (OnceDayEvent) appEventIDXMLWriter.readElements(EventElement); Element lowerBoundElement = root.getChild("lowerBound"); this.lowerBound = java.lang.Integer.parseInt(lowerBoundElement.getTextNormalize()); Element upperBoundElement = root.getChild("upperBound"); this.upperBound = java.lang.Integer.parseInt(upperBoundElement.getTextNormalize()); this.rConstrainedEvents = new OnceDayEvent[2]; this.rConstrainedEvents[0] = this.mCharacter.getBirthday(); this.rConstrainedEvents[1] = this.mAtEvent; }
From source file:TVShowTimelineMaker.timeConstraints.AgeGroupConstraint.java
public AgeGroupConstraint(Element root) { super(root);//from w w w.j a va 2 s .c o m Element characterElement = root.getChild("CharacterByID"); this.mCharacter = NamedCharacter.NamedCharacterIDXMLWriter.instance.readElements(characterElement); Element EventElement = root.getChild("EventByID"); this.mAtEvent = (OnceDayEvent) EventImp.EventIDXMLWriter.instance.readElements(EventElement); Element AgeGroupElement = root.getChild("AgeGroup"); this.mAgeGroup = AgeGroup.valueOf(AgeGroupElement.getTextNormalize()); this.rConstrainedEvents = new OnceDayEvent[2]; this.rConstrainedEvents[0] = this.mCharacter.getBirthday(); this.rConstrainedEvents[1] = this.mAtEvent; }
From source file:TVShowTimelineMaker.timeConstraints.CharacterRelation.java
public CharacterRelation(Element root) { super(root,/*w w w . ja va2 s.c om*/ NamedCharacter.NamedCharacterIDXMLWriter.instance.readElements(root.getChild("firstCharacterByID")) .getBirthday(), NamedCharacter.NamedCharacterIDXMLWriter.instance.readElements(root.getChild("secondCharacterByID")) .getBirthday(), CharacterRelationKind.valueOf(root.getChild("kind").getTextNormalize()).getCharacterRelationKind(), CharacterRelationKind.valueOf(root.getChild("kind").getTextNormalize()).getPeriod()); Element firstCharacterElement = root.getChild("firstCharacterByID"); this.mFirstNamedCharacter = NamedCharacter.NamedCharacterIDXMLWriter.instance .readElements(firstCharacterElement); Element secondCharacterElement = root.getChild("secondCharacterByID"); this.mSecondNamedCharacter = NamedCharacter.NamedCharacterIDXMLWriter.instance .readElements(secondCharacterElement); Element kindElement = root.getChild("kind"); this.mCharacterRelationKind = CharacterRelationKind.valueOf(kindElement.getTextNormalize()); }
From source file:TVShowTimelineMaker.timeConstraints.ContainsConstraint.java
public ContainsConstraint(Element root) { super(root);//from w ww . j av a 2 s . c o m Element firstEpisodeElement = root.getChild("ContainsEventByID"); this.mContainsEvent = (PeriodEvent<?, ?>) EventImp.EventIDXMLWriter.instance .readElements(firstEpisodeElement); Element secondEpisodeElement = root.getChild("ContainedEventByID"); this.mContainedEvent = (EventImp) EventImp.EventIDXMLWriter.instance.readElements(secondEpisodeElement); Element kindElement = root.getChild("type"); this.mContainsType = ContainsConstraint.ContainsType.valueOf(kindElement.getTextNormalize()); this.rConstrainedEvents = new Event[2]; this.rConstrainedEvents[0] = this.mContainsEvent; this.rConstrainedEvents[1] = this.mContainedEvent; }
From source file:TVShowTimelineMaker.timeConstraints.Relation.java
private static RelationKind readKindElement(Element kindElement) { RelationKind kind;//from w w w .ja v a 2 s. c o m String kindText = kindElement.getTextNormalize(); if (kindText.contains(RelationKind.SAME_DAY_OF_YEAR.name())) { kind = RelationKind.SAME_DAY_OF_YEAR; } else { kind = RelationKind.valueOf(kindElement.getTextNormalize()); } return kind; }
From source file:TVShowTimelineMaker.timeConstraints.SeasonTimeConstraint.java
private static DayAcceptor createDayAcceptor(Element root) { Element SeasonElement = root.getChild("Season"); Season mSeason = Season.valueOf(SeasonElement.getTextNormalize()); boolean inside = true; Element insideElement = root.getChild("inside"); if (insideElement != null) { inside = java.lang.Boolean.parseBoolean(insideElement.getTextNormalize()); }//from www. j a v a2 s . c om return createDayAcceptor(mSeason, inside); }
From source file:TVShowTimelineMaker.timeline.Episode.java
private Episode(Element root) { super(root, "Episode"); EventImp.EventIDXMLWriter appEventIDXMLWriter = EventImp.EventIDXMLWriter.instance; Element nameElement = root.getChild("name"); this.name = nameElement.getTextNormalize(); if (this.getLeastSignificantIDPart() >= count) { count = this.getLeastSignificantIDPart() + 1; }/*from w w w. j ava 2 s .c o m*/ Element EventsElement = root.getChild("Events"); this.EventsCovered = new java.util.HashSet<>(EventsElement.getChildren("EventID").parallelStream() .map(appEventIDXMLWriter::readElements).collect(Collectors.toList())); }
From source file:TVShowTimelineMaker.timeline.OncePeriodEvent.java
private OncePeriodEvent(Element root) { super(root);//from w w w.j ava 2 s . c om XMLWriter<DateTime> DateTimeWriter = XMLWriterImp.getXMLWriter(DateTime.class); XMLWriter<AndDayAcceptor> AndDayAcceptorWriter = XMLWriterImp.getXMLWriter(AndDayAcceptor.class); Element earliestPossibleDateForStartElement = root.getChild("earliestPossibleDateForStart"); DateTime newEarliestPossibleDateForStart = DateTimeWriter .readElements(earliestPossibleDateForStartElement.getChildren().get(0)); Element latestPossibleDateForStartElement = root.getChild("latestPossibleDateForStart"); DateTime newLatestPossibleDateForStart = DateTimeWriter .readElements(latestPossibleDateForStartElement.getChildren().get(0)); Element earliestPossibleDateForEndElement = root.getChild("earliestPossibleDateForEnd"); DateTime newEarliestPossibleDateForEnd = DateTimeWriter .readElements(earliestPossibleDateForEndElement.getChildren().get(0)); Element latestPossibleDateForEndElement = root.getChild("latestPossibleDateForEnd"); DateTime newLatestPossibleDateForEnd = DateTimeWriter .readElements(latestPossibleDateForEndElement.getChildren().get(0)); Element minDurationElement = root.getChild("minDuration"); int newMinDuration = java.lang.Integer.parseInt(minDurationElement.getTextNormalize()); Element maxDurationElement = root.getChild("maxDuration"); int newMaxDuration = java.lang.Integer.parseInt(maxDurationElement.getTextNormalize()); earliestPossibleDateForStart = newEarliestPossibleDateForStart; latestPossibleDateForStart = newLatestPossibleDateForStart; earliestPossibleDateForEnd = newEarliestPossibleDateForEnd; latestPossibleDateForEnd = newLatestPossibleDateForEnd; minDuration = newMinDuration; maxDuration = newMaxDuration; }
From source file:TVShowTimelineMaker.timeline.YearlyPeriodEvent.java
private YearlyPeriodEvent(Element root) { super(root);// w w w.ja va 2 s . co m XMLWriter<DayOfYear> DayOfYearWriter = XMLWriterImp.getXMLWriter(DayOfYear.class); //read in newEvent.startPossibleDays Element startDaysElement = root.getChild("startDays"); if (startDaysElement != null) { startPossibleDays.clear(); startPossibleDays.addAll(startDaysElement.getChildren().parallelStream() .map(DayOfYearWriter::readElements).collect(Collectors.toList())); } //read in newEvent.endPossibleDays Element endDaysElement = root.getChild("endDays"); if (endDaysElement != null) { endPossibleDays.clear(); endPossibleDays.addAll(endDaysElement.getChildren().parallelStream().map(DayOfYearWriter::readElements) .collect(Collectors.toList())); } Element maxDurationElement = root.getChild("maxDuration"); if (maxDurationElement != null) { setMaxDuration(java.lang.Integer.parseInt(maxDurationElement.getTextNormalize())); } Element minDurationElement = root.getChild("minDuration"); if (minDurationElement != null) { setMinDuration(java.lang.Integer.parseInt(minDurationElement.getTextNormalize())); } }
From source file:TVShowTimelineMaker.util.IDedObjectImp.java
protected static String loadRootNameSpace(Element root) { Element rootNameSpaceElement = root.getChild("rootNameSpace"); final String rootNamespace; if (rootNameSpaceElement != null) { rootNamespace = rootNameSpaceElement.getTextNormalize(); } else {/* w w w . j a va 2s. c o m*/ rootNamespace = TopLevelXMLWriter.defualtNameSpace; } return rootNamespace; }