Package org.datacontract.schemas._2004._07.trade

Examples of org.datacontract.schemas._2004._07.trade.BSConfigResponse


            String manpId = se.createAndRunSeregenttiSubFoodweb(nodeList, "sg10Test27",0, 1, true);
            System.out.println("manpId:"+manpId);
           
            List<ManipulatingNode> nodes = new ArrayList<ManipulatingNode>();
            ManipulatingNode node = new ManipulatingNode();
            node.setTimestepIdx(1);
            node.setManipulationActionType(ManipulationActionType.SPECIES_PROLIFERATION.getManipulationActionType()); // proliferation
            node.setModelType(ModelType.CASCADE_MODEL.getModelType()); // cascading model
            node.setNodeIdx(4);
            node.setBeginingBiomass(2500);
            node.setHasLinks(false);
            nodes.add(node);


            node = new ManipulatingNode();
            node.setTimestepIdx(1);
            node.setManipulationActionType(ManipulationActionType.SPECIES_PROLIFERATION.getManipulationActionType()); // proliferation
            node.setModelType(ModelType.CASCADE_MODEL.getModelType()); // cascading model
            node.setNodeIdx(5);
            node.setBeginingBiomass(2500);
            node.setHasLinks(false);
            nodes.add(node);
           
/*           
            node = new ManipulatingNode();
            node.setTimestepIdx(1);
            node.setManipulationActionType(ManipulationActionType.SPECIES_PROLIFERATION.getManipulationActionType()); // proliferation
            node.setModelType(ModelType.CASCADE_MODEL.getModelType()); // cascading model
            node.setNodeIdx(73);
            node.setBeginingBiomass(100);
            node.setHasLinks(false);
            nodes.add(node);           
*/
           
            node = new ManipulatingNode();
            node.setTimestepIdx(1);
            node.setManipulationActionType(ManipulationActionType.SPECIES_INVASION.getManipulationActionType()); // invasion
            node.setModelType(ModelType.CASCADE_MODEL.getModelType()); // cascading model
            node.setNodeIdx(80);
            node.setBeginingBiomass(5);
            node.setHasLinks(false);
            node.setGameMode(true);           
            node.setOriginFoodwebId("74B9B375-1729-4516-A231-AE8A6114AACF");           
            nodes.add(node);                  
           
           
            List<ManipulatingParameter> sParams = new ArrayList<ManipulatingParameter>();
//            se.setNodeParameter(80, ManipulatingParameterName.r.getManipulatingParameterIndex(), 0.8, sParams);       
View Full Code Here


            node.setNodeName(species.getName()); // set node name           
            node.setOriginFoodwebId(propertiesConfig.getProperty("serengetiNetworkId"));           
            nodes[i++] = node;
           
            //Connectance
            ManipulatingNodeProperty mnp = new ManipulatingNodeProperty();
            mnp.setNodeIdx(species.getNodeIndex());           
            mnp.setNodePropertyName(ManipulatingNodePropertyName.Connectance.name());
            mnp.setNodePropertyValue(Double.valueOf(propertiesConfig.getProperty("connectanceDefault")));
            lManipulatingNodeProperty.add(mnp);
            //Probability
            mnp = new ManipulatingNodeProperty();
            mnp.setNodeIdx(species.getNodeIndex());           
            mnp.setNodePropertyName(ManipulatingNodePropertyName.Probability.name());
            mnp.setNodePropertyValue(Double.valueOf(propertiesConfig.getProperty("probabilityDefault"))); // if this value is low, invasion may fail.
            lManipulatingNodeProperty.add(mnp);
            //SpeciesZoneType count
            mnp = new ManipulatingNodeProperty();
            mnp.setNodeIdx(species.getNodeIndex());           
            mnp.setNodePropertyName(ManipulatingNodePropertyName.SpeciesCount.name());
            mnp.setNodePropertyValue(species.getSpeciesCount());
            lManipulatingNodeProperty.add(mnp);
           
            List<ManipulatingParameter> params = this.getSystemParameter(species, timestep);           
            sysParamList.addAll(params);
View Full Code Here

        nodes[0] = node;               


        List<ManipulatingNodeProperty> lManipulatingNodeProperty = new ArrayList<ManipulatingNodeProperty>();
        //Connectance
        ManipulatingNodeProperty mnp = new ManipulatingNodeProperty();
        mnp.setNodePropertyName(ManipulatingNodePropertyName.Connectance.name());
        mnp.setNodePropertyValue(Double.valueOf(propertiesConfig.getProperty("connectanceDefault")));
        lManipulatingNodeProperty.add(mnp);
        //Probability
        mnp = new ManipulatingNodeProperty();
        mnp.setNodePropertyName(ManipulatingNodePropertyName.Probability.name());
        mnp.setNodePropertyValue(Double.valueOf(propertiesConfig.getProperty("probabilityDefault"))); // if this value is low, invasion may fail.
        lManipulatingNodeProperty.add(mnp);
        //SpeciesZoneType count
        mnp = new ManipulatingNodeProperty();
        mnp.setNodePropertyName(ManipulatingNodePropertyName.SpeciesCount.name());
        mnp.setNodePropertyValue(species.getSpeciesCount());
        lManipulatingNodeProperty.add(mnp);

        List<ManipulatingParameter> params = this.getSystemParameter(species, timestep);
       
        ManipulatingNodeProperty[] nps = (ManipulatingNodeProperty[]) lManipulatingNodeProperty.toArray(new ManipulatingNodeProperty[0]);       
View Full Code Here

        return null;
    }   
   
   public String setLinkParameter(int predIdx, int preyIdx, int paramIdx, double paramValue, int tsIdx, List<ManipulatingParameter> sParams )
    {
        ManipulatingParameter param = new ManipulatingParameter();       
       
        if(paramIdx == ManipulatingParameterName.e.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Assimilation efficiency rate should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.e.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.e.name());
            param.setParamIdx(ManipulatingParameterName.e.getManipulatingParameterIndex());           
            param.setPredIdx(predIdx);
            param.setPreyIdx(preyIdx);
            param.setTimestepIdx(tsIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.a.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Relative Half Saturation Density should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.a.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.a.name());
            param.setParamIdx(ManipulatingParameterName.a.getManipulatingParameterIndex());           
            param.setPredIdx(predIdx);
            param.setPreyIdx(preyIdx);
            param.setParamValue(paramValue);           
            param.setTimestepIdx(tsIdx);           
        }
        else if(paramIdx == ManipulatingParameterName.q.getManipulatingParameterIndex())
        {
            param.setParamType(ManipulatingParameterName.q.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.q.name());
            param.setParamIdx(ManipulatingParameterName.q.getManipulatingParameterIndex());           
            param.setPredIdx(predIdx);
            param.setPreyIdx(preyIdx);
            param.setParamValue(paramValue);           
            param.setTimestepIdx(tsIdx);           
        }
        else if(paramIdx == ManipulatingParameterName.d.getManipulatingParameterIndex())
        {
            param.setParamType(ManipulatingParameterName.d.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.d.name());
            param.setParamIdx(ManipulatingParameterName.d.getManipulatingParameterIndex());           
            param.setPredIdx(predIdx);
            param.setPreyIdx(preyIdx);
            param.setParamValue(paramValue);           
            param.setTimestepIdx(tsIdx);
        }
        else if(paramIdx == ManipulatingParameterName.b0.getManipulatingParameterIndex())
        {
            param.setParamType(ManipulatingParameterName.b0.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.b0.name());
            param.setParamIdx(ManipulatingParameterName.b0.getManipulatingParameterIndex());           
            param.setPredIdx(predIdx);
            param.setPreyIdx(preyIdx);
            param.setParamValue(paramValue);           
            param.setTimestepIdx(tsIdx);
        }       
       
        else
        {
            return "that type of link parameter is not supported yet";
View Full Code Here

            // for example, if carrying capacity is 10, maximum biomass of species is 10.
            // Higher growth rate means that species with higher growth rate will gain biomass faster.
            // Metabolic rate (x) are effective for both animals and plants
            // higher metabolic rate means that biomass of species will decrease compared to other species

            ManipulatingParameter param = new ManipulatingParameter();
            param.setParamType(ManipulatingParameterName.k.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.k.name());
            param.setNodeIdx(nodeIdx);
            param.setParamIdx(ManipulatingParameterName.k.getManipulatingParameterIndex());
               // parameter k, r, x can't have negative value. if they have negative value, it means that data is not assigned yet.)
            double paramKVal = species.getParamK();
            if(paramKVal < 0)
                param.setParamValue(Double.valueOf(propertiesConfig.getProperty("carryingCapacityDefault")));
            else
                param.setParamValue(paramKVal);           

            param.setTimestepIdx(timestepIdx);                   
            sParams.add(param);

            param = new ManipulatingParameter();
            param.setParamType(ManipulatingParameterName.r.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.r.name());
            param.setNodeIdx(nodeIdx);
            param.setParamIdx(ManipulatingParameterName.r.getManipulatingParameterIndex());
            double paramRVal = species.getParamR();
            if(paramRVal < 0)
                param.setParamValue(Double.valueOf(propertiesConfig.getProperty("growthRateDefault")));
            else
                param.setParamValue(paramRVal);                       
            param.setTimestepIdx(timestepIdx);                   
            sParams.add(param);
           
            param = new ManipulatingParameter();
            param.setParamType(ManipulatingParameterName.x.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.x.name());
            param.setNodeIdx(nodeIdx);
            param.setParamIdx(ManipulatingParameterName.x.getManipulatingParameterIndex());
            double paramXVal = species.getParamR();
            if(paramXVal < 0)
                param.setParamValue(Double.valueOf(propertiesConfig.getProperty("metabolicRateDefault")));
            else
                param.setParamValue(paramXVal);           
            param.setTimestepIdx(timestepIdx);                   
            sParams.add(param);           
        }
        else if(type == SpeciesTypeEnum.ANIMAL)
        {

            // Metabolic rate (x) are effective for both animals and plants           
            // higher metabolic rate means that biomass of species will decrease compared to other species           
            // Assimilation efficiency (e) is only available for animals.
            // higher assimilation efficiency means that biomass of species will increase.
           
            ManipulatingParameter param = new ManipulatingParameter();
            param.setParamType(ManipulatingParameterName.x.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.x.name());
            param.setNodeIdx(nodeIdx);
            param.setParamIdx(ManipulatingParameterName.x.getManipulatingParameterIndex());
            double paramXVal = species.getParamR();
            if(paramXVal < 0)
                param.setParamValue(Double.valueOf(propertiesConfig.getProperty("metabolicRateDefault")));
            else
                param.setParamValue(paramXVal);           
            param.setTimestepIdx(timestepIdx);                   
            sParams.add(param);
           
            List<Integer> preys = species.getlPreyIndex();
            if(preys != null)
            {
                for(Integer prey: preys)
                {
                    param = new ManipulatingParameter();
                    param.setParamType(ManipulatingParameterName.e.getManipulatingParameterType());
                    param.setParamName(ManipulatingParameterName.e.name());
                    param.setPredIdx(nodeIdx);
                    param.setPreyIdx(prey);
                    param.setParamIdx(ManipulatingParameterName.e.getManipulatingParameterIndex());
                    if(species.getParamE() != null && species.getParamE(prey) != null)
                        param.setParamValue(species.getParamE(prey).getParamValue());                           
                    else
                        param.setParamValue(Double.valueOf(propertiesConfig.getProperty("assimilationEfficiencyDefault")));
                    param.setTimestepIdx(timestepIdx);                   
                    sParams.add(param);
                }

                for(Integer prey: preys)
                {
                    param = new ManipulatingParameter();
                    param.setParamType(ManipulatingParameterName.a.getManipulatingParameterType());
                    param.setParamName(ManipulatingParameterName.a.name());
                    param.setPredIdx(nodeIdx);
                    param.setPreyIdx(prey);
                    param.setParamIdx(ManipulatingParameterName.a.getManipulatingParameterIndex());
                    if(species.getParamA() != null && species.getParamA(prey) != null)
                        param.setParamValue(species.getParamA(prey).getParamValue());                           
                    else
                        param.setParamValue(Double.valueOf(propertiesConfig.getProperty("relativeHalfSaturationDensityDefault")));
                    param.setTimestepIdx(timestepIdx);                   
                    sParams.add(param);
                }
           
                for(Integer prey: preys)
                {
                    param = new ManipulatingParameter();
                    param.setParamType(ManipulatingParameterName.q.getManipulatingParameterType());
                    param.setParamName(ManipulatingParameterName.q.name());
                    param.setPredIdx(nodeIdx);
                    param.setPreyIdx(prey);
                    param.setParamIdx(ManipulatingParameterName.q.getManipulatingParameterIndex());
                    if(species.getParamQ() != null && species.getParamQ(prey) != null)
                        param.setParamValue(species.getParamQ(prey).getParamValue());                           
                    else
                        param.setParamValue(Double.valueOf(propertiesConfig.getProperty("functionalResponseControlParameterDefault")));
                    param.setTimestepIdx(timestepIdx);                   
                    sParams.add(param);
                }           
           
                for(Integer prey: preys)
                {
                    param = new ManipulatingParameter();
                    param.setParamType(ManipulatingParameterName.d.getManipulatingParameterType());
                    param.setParamName(ManipulatingParameterName.d.name());
                    param.setPredIdx(nodeIdx);
                    param.setPreyIdx(prey);
                    param.setParamIdx(ManipulatingParameterName.d.getManipulatingParameterIndex());
                    if(species.getParamD() != null && species.getParamD(prey) != null)
                        param.setParamValue(species.getParamD(prey).getParamValue());                           
                    else
                        param.setParamValue(Double.valueOf(propertiesConfig.getProperty("predatorInterferenceDefault")));
                    param.setTimestepIdx(timestepIdx);                   
                    sParams.add(param);
                }
            }
        }       
       
View Full Code Here

    }
   
   
   public String setNodeParameter(int nodeIdx, int paramIdx, double paramValue, int timestep, List<ManipulatingParameter> sParams )
    {
        ManipulatingParameter param = new ManipulatingParameter();       
       
        if(paramIdx == ManipulatingParameterName.k.getManipulatingParameterIndex())
        {
            if(paramValue <= 0)
                return "Carrying capacity should be bigger than 0";
            param.setParamType(ManipulatingParameterName.k.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.k.name());
            param.setParamIdx(ManipulatingParameterName.k.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setTimestepIdx(timestep);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.x.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Metabolic rate should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.x.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.x.name());
            param.setParamIdx(ManipulatingParameterName.x.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setTimestepIdx(timestep);           
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.r.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Plant growth rate should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.r.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.r.name());
            param.setParamIdx(ManipulatingParameterName.r.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setTimestepIdx(timestep);           
            param.setParamValue(paramValue);           
        }
        else
        {
            return "that type of node parameter is not supported yet";
        }
View Full Code Here

    }       
   
    public String setNodeParameter(int nodeIdx, int paramIdx, double paramValue, List<ManipulatingParameter> sParams )
    {
      System.out.println("SetNodeParameter [nodeIdx]-"+nodeIdx);
        ManipulatingParameter param = new ManipulatingParameter();       
       
        if(paramIdx == ManipulatingParameterName.k.getManipulatingParameterIndex())
        {
            if(paramValue <= 0)
                return "Carrying capacity should be bigger than 0";
            param.setParamType(ManipulatingParameterName.k.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.k.name());
            param.setParamIdx(ManipulatingParameterName.k.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.x.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Metabolic rate should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.x.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.x.name());
            param.setParamIdx(ManipulatingParameterName.x.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.r.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Plant growth rate should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.r.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.r.name());
            param.setParamIdx(ManipulatingParameterName.r.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else
        {
            return "that type of node parameter is not supported yet";
        }
View Full Code Here

   

//HJR
    public String setFunctionalNodeParameter(int nodeIdx, int preyIdx, int paramIdx, double paramValue, List<ManipulatingParameter> sParams ,SpeciesZoneType szt)
    {
        ManipulatingParameter param = new ManipulatingParameter();       
        List<Integer> predatorIndex = szt.getlPredatorIndex();
        List<Integer> preyIndex = szt.getlPreyIndex();
        if(paramIdx == ManipulatingParameterName.x.getManipulatingParameterIndex())
        {
            if(paramValue <= 0)
                return "Metabolic Rate for Plants should be bigger than 0";
            param.setParamType(ManipulatingParameterName.x.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.x.name());
            param.setParamIdx(ManipulatingParameterName.x.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.ax.getManipulatingParameterIndex())
        {
            if(paramValue <= 0)
                return "Metabolic Rate for Animals should be bigger than 0";
            param.setParamType(ManipulatingParameterName.ax.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.ax.name());
            param.setParamIdx(ManipulatingParameterName.ax.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.e.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Assimilation Efficiency should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.e.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.e.name());
            param.setParamIdx(ManipulatingParameterName.e.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setPreyIdx(preyIdx);
            param.setPredIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.d.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Predator Interference should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.d.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.d.name());
            param.setParamIdx(ManipulatingParameterName.d.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setPreyIdx(preyIdx);
            param.setPredIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.q.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Functional Response Control should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.q.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.q.name());
            param.setParamIdx(ManipulatingParameterName.q.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setPreyIdx(preyIdx);
            param.setPredIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }
        else if(paramIdx == ManipulatingParameterName.a.getManipulatingParameterIndex())
        {
            if(paramValue < 0 || paramValue > 1)
                return "Relative Half Saturation Density should be between 0 and 1";
            param.setParamType(ManipulatingParameterName.a.getManipulatingParameterType());
            param.setParamName(ManipulatingParameterName.a.name());
            param.setParamIdx(ManipulatingParameterName.a.getManipulatingParameterIndex());           
            param.setNodeIdx(nodeIdx);
            param.setPreyIdx(preyIdx);
            param.setPredIdx(nodeIdx);
            param.setParamValue(paramValue);           
        }       
        else
        {
            return "that type of node parameter is not supported yet";
        }
View Full Code Here

    public String createSeregenttiSubFoodweb(String networkName, int nodeList[], boolean overwrite)
    {
        String netId = null;
       
        ModelParam[] networkParams = new ModelParam[2];
        networkParams[0] = new ModelParam();
        networkParams[0].setParamName(ManipulatingNodePropertyName.Connectance.name());
        networkParams[0].setParamValue(Double.valueOf(propertiesConfig.getProperty("connectanceDefault")));
        networkParams[1] = new ModelParam();
        networkParams[1].setParamName(ManipulatingNodePropertyName.SpeciesCount.name());
        networkParams[1].setParamValue(Integer.valueOf(propertiesConfig.getProperty("speciesCountDefault")));

        NetworkCreationRequest req = new NetworkCreationRequest();
        req.setUser(user); // Owner of network
View Full Code Here

    {
        return propertiesConfig;
    }
    public ManipulationResponse createDefaultSubFoodweb(String networkName) {
        ModelParam[] networkParams = new ModelParam[2];
        networkParams[0] = new ModelParam();
        networkParams[0].setParamName(ManipulatingNodePropertyName.Connectance.name());
        networkParams[0].setParamValue(Double.valueOf(propertiesConfig.getProperty("connectanceDefault")));
        networkParams[1] = new ModelParam();
        networkParams[1].setParamName(ManipulatingNodePropertyName.SpeciesCount.name());
        networkParams[1].setParamValue(Integer.valueOf(propertiesConfig.getProperty("speciesCountDefault")));

        NetworkCreationRequest req = new NetworkCreationRequest();
        req.setUser(user); // Owner of network
View Full Code Here

TOP

Related Classes of org.datacontract.schemas._2004._07.trade.BSConfigResponse

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.