Package jmt.gui.common.routingStrategies

Examples of jmt.gui.common.routingStrategies.LoadDependentRouting


                //... start exploring from thisForwardStation
                temp = this.exploreForAllForwardStationAreSink(classKey, thisForwardStation, alreadyVisited);
              }
            } else if (strategy instanceof LoadDependentRouting) {
                            String stationName = station_def.getStationName(thisForwardStation);
                            LoadDependentRouting loadDependentRouting = (LoadDependentRouting)strategy;
              Map<Integer, LoadDependentRouting.EmpiricalEntry[]> empiricalEntries = loadDependentRouting.getEmpiricalEntries();
                            Iterator<LoadDependentRouting.EmpiricalEntry[]> rows = empiricalEntries.values().iterator();
                            Collection<LoadDependentRouting.EmpiricalEntry> allEntries = new ArrayList<LoadDependentRouting.EmpiricalEntry>(5);
                            while(rows.hasNext()){
                                LoadDependentRouting.EmpiricalEntry[] entries = rows.next();
                                allEntries.addAll(Arrays.asList(entries));
View Full Code Here


                Object stationKey = it.next();
                Vector<Object> classKeys = this.getClassKeys();
                for(Object classKey : classKeys){
                    RoutingStrategy rs = (RoutingStrategy)this.getRoutingStrategy(stationKey, classKey);
                    if(rs instanceof LoadDependentRouting){
                        LoadDependentRouting ld = (LoadDependentRouting) rs;
                        ld.refreshRoutingOnStationDeletion(this.getStationName(key));
                    }
                }
            }
      //
      if (sd.blockingRegion != null) {
View Full Code Here

        probRoutingPar = new XMLParameter("EmpiricalEntryArray",
            EmpiricalEntry.class.getName(), null, empiricalEntries,
            true);
                innerRoutingPar = new XMLParameter[] { probRoutingPar };
      }else if(routingStrat instanceof LoadDependentRouting){
                LoadDependentRouting routing = (LoadDependentRouting)routingStrat;

                XMLParameter ldRoutingPar = null;
                XMLParameter[] ranges = new XMLParameter[routing.getEmpiricalEntries().size()];

                Iterator<Integer> froms = routing.getEmpiricalEntries().keySet().iterator();
                int countersRange =0;
                while(froms.hasNext()){
                    Integer fromKey = froms.next();
                    String from = fromKey.toString();
                    XMLParameter fromEntry = new XMLParameter("from", Integer.class.getName(), null, from , true);
                    XMLParameter probLDRoutingPar = null;
                    XMLParameter[] empiricalEntries = new XMLParameter[routing.getEmpiricalEntries().get(fromKey).length];
                    for (int i = 0; i < empiricalEntries.length; i++) {
                        String station = routing.getEmpiricalEntries().get(fromKey)[i].getStationName();
                        XMLParameter stationDest = new XMLParameter("stationName", String.class.getName(), null, station, true);
            Double probability = routing.getEmpiricalEntries().get(fromKey)[i].getProbability();
                        XMLParameter routProb = new XMLParameter("probability", Double.class.getName(), null, probability.toString(), true);
                        empiricalEntries[i] = new XMLParameter("EmpiricalEntry", EmpiricalEntry.class.getName(),null, new XMLParameter[] { stationDest,routProb }, true);
              empiricalEntries[i].parameterArray = "false";
                    }
                    probLDRoutingPar = new XMLParameter("EmpiricalEntryArray", EmpiricalEntry.class.getName(), null, empiricalEntries, true);
View Full Code Here

                    if (child != null) {
                        from.add(child);
                        child = child.getNextSibling();//TXT
                    }
                }
                LoadDependentRouting ld = new LoadDependentRouting();
                Integer keyld;
                for (int j = 0; j < from.size(); j++) {
                    NodeList values = ((Element) from.get(j)).getElementsByTagName(XML_E_SUBPARAMETER);
                    String fromValue = findText(((Element) values.item(0)).getElementsByTagName(XML_E_PARAMETER_VALUE).item(0));
                    int fromVal = new Integer(fromValue);
                    values = ((Element) values.item(1)).getElementsByTagName(XML_E_SUBPARAMETER);

                    for(int n=0; n<values.getLength(); n++){
                        try{//Empirical Entry..Station Name..probability Keeps repeating..
                            String atrName = ((Element) values.item(n)).getAttribute("name");//Empirical Entry..Station Name..probability..for a from.
                            if("EmpiricalEntry".equalsIgnoreCase(atrName)){
                                Node empiricalEntry = values.item(n);
                                Node station = empiricalEntry.getFirstChild().getNextSibling();
                                String stationName = findText(((Element)station).getElementsByTagName(XML_E_PARAMETER_VALUE).item(0));
                                Node probability = empiricalEntry.getFirstChild().getNextSibling().getNextSibling().getNextSibling();
                                String probabilityValue = findText(((Element)probability).getElementsByTagName(XML_E_PARAMETER_VALUE).item(0));
                                Double prob = Double.parseDouble(probabilityValue);
                                //ld.getRange(fromVal).setProbabilities(stationName, probVal);
                                ld.addEmricalEntryForFrom(new Integer(fromVal),stationName, prob);
                            }
                        }catch(Exception e){

                        }
                    }
View Full Code Here

TOP

Related Classes of jmt.gui.common.routingStrategies.LoadDependentRouting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.