private static boolean hasField(GraphEntity task, String fieldName) { GraphAttribute d; try { d = task.getAttributeByName(fieldName); } catch (NotFound ex) { return false; } return true;//d != null && !d.getSimpleValue().equals(""); }
private String getSymptomClass(GraphEntity symptom) { String result = "Symptom"; try { GraphAttribute typeGA = symptom.getAttributeByName("PDSymptomTypeField"); String symptType = typeGA.getSimpleValue(); if (!symptType.equals("")) { if (symptType.equals("Tremor")) { result = "TremorSymptom"; } } } catch (NotFound ex) { logger.log(Level.SEVERE, null, ex); } return result; }
private static String isCanBeInterrupted(GraphEntity task) { try { GraphAttribute ga = task .getAttributeByName("CanBeInterruptedField"); String value = ga.getSimpleValue(); if (value.equals("No")) { return "false"; } } catch (NotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } return "true"; }
public static String getFieldValue(GraphEntity task, String fieldName, String def, boolean mandatory) { GraphAttribute at = null; try { at = task.getAttributeByName(fieldName); } catch (NotFound ex) { } if (at == null || at.getSimpleValue().equals("")) { if (mandatory) { logger.log(Level.SEVERE, "Attribute {0} of {1} is empty!", new Object[]{fieldName, task.getID()}); System.exit(0); } else { logger.log(Level.WARNING, "Attribute {0} of {1} is empty!", new Object[]{fieldName, task.getID()}); return def; } } return Utils.getValue(at); }
public static String getADLName(String humanId, Browser browser) throws NotFound { GraphEntity ge = getADL(humanId, browser); if (ge != null) { GraphAttribute ga = ge.getAttributeByName("ADLSpecField"); if(ga != null && !ga.getSimpleValue().equals("")) { return Utils.replaceBadChars(ga.getSimpleValue()); } } return null; }
GraphAttribute ga = null; try { ga = ge.getAttributeByName("InteractionSpecDiagField"); if (ga != null && !ga.getSimpleValue().equals("")) { System.out.println("\t-" + ga.getSimpleValue()); System.out.println("\t-" + interactionGraph.getName()); for (GraphEntity mle : Utils.getEntities(interactionGraph, "MessageListenedEvent")) { GraphAttribute message = mle.getAttributeByName("Message"); if (!"".equals(message.getSimpleValue())) { List<String> words = new ArrayList<>();
public static void linkPDManager(String humanId, Repeat repFather, Browser browser) { GraphEntity dmGraph = Utils.getProfileTypeOf(humanId, PARKINSON_PROFILE, browser); if (dmGraph != null) { try { GraphAttribute pdSpec = dmGraph.getAttributeByName("ParkinsonSpecDiag"); Repeat rep = new Repeat("filterManager"); repFather.add(rep); rep.add(new Var("fmName", Utils.replaceBadChars(pdSpec.getSimpleValue()))); } catch (NotFound ex) { Logger.getLogger(PDGenerator.class.getName()).log(Level.SEVERE, null, ex); } } } }
private String getActorSymptomInSimdiagram(Graph graph, GraphEntity actor, GraphEntity symptom) { try { for (GraphEntity entity : graph.getEntities()) { if (entity.getType().equals("HumanInitialization") && Utils.getRelatedElementsVectorInSameDiagram(entity, "RelatedHuman", "RelatedHumantarget").contains(actor)) { Vector<GraphEntity> symptomsInitialized = Utils.getRelatedElementsVectorInSameDiagram(entity, "InitializesSymptom", "InitializesSymptomtarget"); for (GraphEntity symptominialization : symptomsInitialized) { boolean initializedSympom = Utils.getRelatedElementsVectorInSameDiagram(symptominialization, "InitializedSymptom", "InitializedSymptomtarget").contains(symptom); if (initializedSympom) { String levelValue = symptominialization.getAttributeByName("SymptomLevel").getSimpleValue(); switch (levelValue) { case "LOW": return "phat.agents.filters.Symptom.Level.LOW"; case "MEDIUM": return "phat.agents.filters.Symptom.Level.MEDIUM"; case "HIGH": return "phat.agents.filters.Symptom.Level.HIGH"; } } } } } } catch (NullEntity | NotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
public void generateActivities(Graph activitiesSpec, Sequences seq) throws NotFound, NullEntity { GraphEntity ge = Utils.getFirstEntity(activitiesSpec); if (ge.getType().equals("BActivity")) { GraphEntity nActivity = Utils.getTargetEntity(ge, "NextActivity"); if (nActivity == null) { return; } GraphAttribute ga = ge.getAttributeByName("SeqTaskDiagramField"); Graph taskSpecDiagram = Utils.getGraphByName(ga.getSimpleValue(), getBrowser()); /*if (taskSpecDiagram != null) { TaskGenerator taskGenerator = new TaskGenerator(getBrowser(), seq); taskGenerator.generate("", taskSpecDiagram); }*/ } }
private Vector<Graph> getPDDiagramsForActor(GraphEntity actor) { Vector<Graph> patientGraphs = new Vector<Graph>(); Vector<GraphRelationship> rels = actor.getAllRelationships("ProfileOf"); for (GraphRelationship rel : rels) { GraphEntity target; try { target = Utils.getSourceEntity(actor, rel); if (target.getType().equals("ParkinsonsProfile")) { GraphAttribute diagNameAtt = target.getAttributeByName("ParkinsonSpecDiag"); if (diagNameAtt != null && diagNameAtt.getSimpleValue() != null && browser.getGraph(diagNameAtt.getSimpleValue()) != null) { patientGraphs.add(browser.getGraph(diagNameAtt.getSimpleValue())); } } } catch (NotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } } return patientGraphs; }
GraphAttribute ga = ip.getAttributeByName("InteractionSpecDiagField"); if (ga == null || ga.getSimpleValue().equals("")) { return; String eventId = Utils.replaceBadChars(event.getID()); if (event.getType().equals("VibrateEvent")) { GraphAttribute deviceSource = event.getAttributeByName("DeviceSource"); if (deviceSource == null || deviceSource.getSimpleValue().equals("")) { System.exit(-1); GraphAttribute state = event.getAttributeByName("DeviceState"); if (deviceSource == null || deviceSource.getSimpleValue().equals("")) { System.exit(-1); GraphAttribute deviceSource = event.getAttributeByName("DeviceSource"); if (deviceSource == null || deviceSource.getSimpleValue().equals("")) { System.exit(-1); GraphAttribute state = event.getAttributeByName("CallStateField"); if (deviceSource == null || deviceSource.getSimpleValue().equals("")) { System.exit(-1); GraphAttribute message = event.getAttributeByName("Message"); if (message == null || message.getSimpleValue().equals("")) { System.exit(-1);
public void generateWorldInitialization(String simId, Graph simDiags, Repeat rep) throws NullEntity, NotFound { GraphEntity ge = getEntity(simDiags, "WorldInitialization"); GraphAttribute seedworld = ge.getAttributeByName("SimulationSeedField"); GraphAttribute houseType = ge.getAttributeByName("HouseTypeField"); String houseTypeString = "House3room2bath"; if (houseType != null && !houseType.getSimpleValue().equals("")) { System.out.println("Hola"); GraphAttribute year = iniDate.getAttributeByName("YearField"); GraphAttribute month = iniDate.getAttributeByName("MonthField"); GraphAttribute day = iniDate.getAttributeByName("DayField"); GraphAttribute hour = iniDate.getAttributeByName("HourField"); GraphAttribute min = iniDate.getAttributeByName("MinuteField"); GraphAttribute sec = iniDate.getAttributeByName("SecondField"); GraphAttribute width = ge.getAttributeByName("CamWidth"); GraphAttribute height = ge.getAttributeByName("CamHeight");
String front = "true"; GraphAttribute distanceGA = hi.getAttributeByName("DistanceToTarget"); if (distanceGA != null && !distanceGA.getSimpleValue().equals("")) { distance = distanceGA.getSimpleValue(); GraphAttribute elevationGA = hi.getAttributeByName("Elevation"); if (elevationGA != null && !elevationGA.getSimpleValue().equals("")) { elevation = elevationGA.getSimpleValue(); GraphAttribute frontGA = hi.getAttributeByName("IsInFrontOfHuman"); if (frontGA != null && !frontGA.getSimpleValue().equals("")) { if (frontGA.getSimpleValue().equals("No")) {
try { GraphAttribute sd = sp .getAttributeByName("SocialSpecDiagField"); if (sd.getSimpleValue() != null) { System.out.println("Diagram name = " if (pi != null) { GraphAttribute ageAt = pi .getAttributeByName("AgeField"); if (ageAt != null && !ageAt.getSimpleValue().equals("")) {
return; GraphAttribute ga = adl.getAttributeByName("ADLSpecField"); if (ga == null || ga.getSimpleValue().equals("")) { return; if (geClock != null) { GraphAttribute gaHours = geClock .getAttributeByName(HOURS_FIELD); int hours = Integer.parseInt(gaHours.getSimpleValue()); GraphAttribute gaMins = geClock .getAttributeByName("MinutesField"); int mins = Integer.parseInt(gaMins.getSimpleValue()); GraphAttribute gaSecs = geClock .getAttributeByName(SECS_FIELD); int secs = Integer.parseInt(gaSecs.getSimpleValue()); System.out.println(geClock.getID() + ": " + hours + ":"
public void generateActivityClasses(Sequences seq) throws NullEntity, NotFound { for (GraphEntity ge : browser.getAllEntities()) { if (ge.getType().equals(ACTIVITY_TYPE)) { GraphAttribute ga = ge .getAttributeByName(SEQ_TASK_DIAGRAM_FIELD); if (ga != null) { String actDiagId = Utils.replaceBadChars(ga.getSimpleValue()); if (actDiagId != null && !actDiagId.equals("")) { Repeat rep = new Repeat("activities"); seq.addRepeat(rep); rep.add(new Var("aID", Utils.replaceBadChars(ge.getID()))); rep.add(new Var("aType", Utils.replaceBadChars(ge.getType()))); rep.add(new Var("aDesc", Utils.getAttributeByName(ge, "Description"))); rep.add(new Var("stID", Utils.replaceBadChars(actDiagId))); continue; } } logger.log(Level.SEVERE, "The {0} activity doesn't have sequential task diagram!", new Object[]{ge.getID()}); System.exit(0); } } }
private void generateDeviceAgentsInitialization(Graph simDiag, Repeat simInitRep) throws NullEntity, NotFound { for (GraphEntity progPool : Utils.getEntities(simDiag, INIT_PROGRAM_POOL)) { for (GraphEntity deviceEntity : Utils.getTargetsEntity(progPool, "device")) { Repeat importADLRep = new Repeat("importDevices"); simInitRep.add(importADLRep); String deviceId = deviceEntity.getID(); Repeat agentRep = new Repeat("deviceAgentRep"); simInitRep.add(agentRep); simInitRep.add(new Var("daID", deviceId)); GraphCollection gc = progPool.getAttributeByName("ProgramPoolField").getCollectionValue(); for (int i = 0; i < gc.size(); i++) { String progId = gc.getElementAt(i).getAttributeByName("modelID").getSimpleValue(); Repeat progRep = new Repeat("progsRep"); progRep.add(new Var("progId", progId)); agentRep.add(progRep); } } } }
if (geClock != null) { GraphAttribute gaHours = geClock .getAttributeByName(HOURS_FIELD); int hours = Integer.parseInt(gaHours.getSimpleValue()); GraphAttribute gaMins = geClock .getAttributeByName("MinutesField"); int mins = Integer.parseInt(gaMins.getSimpleValue()); GraphAttribute gaSecs = geClock .getAttributeByName(SECS_FIELD); int secs = Integer.parseInt(gaSecs.getSimpleValue()); System.out.println(geClock.getID() + ": " + hours + ":"
seq.addRepeat(rep); GraphAttribute ga = ge .getAttributeByName(ACTIVITY_SPEC_FIELD); if (ga != null) { String actDiagId = ga.getSimpleValue();
if (stages.size() == 1) { GraphEntity stageGE = stages.get(0); GraphAttribute stageGA = stageGE.getAttributeByName("NamePDStageField"); rep.add(new Var("stageName", stageGA.getSimpleValue())); for (GraphEntity symptom : Utils.getTargetsEntity(stageGE, SYMPTOMS)) { filterSet.add(new Var("symplevel", level)); if (level != null) { GraphAttribute filters = filter.getAttributeByName(TASK_ALLOWED); GraphCollection filterCollection = filters.getCollectionValue(); for (int i = 0; i < filterCollection.size(); i++) { GraphEntity ge = filterCollection.getElementAt(i); GraphAttribute filterRef = ge.getAttributeByName("modelID"); String filterDiagName = filterRef.getSimpleValue(); Graph filtersGraph = Utils.getGraphByName(filterDiagName, browser);