栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

网络工程信号覆盖IOT检测系统 (java)第二版

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

网络工程信号覆盖IOT检测系统 (java)第二版

学生大二编写的第二个小软件,已在学校科技处申报,请品鉴。

有不到位之处,请您指正。

版权自发布之日起即有,翻版本人学校科技处会追究。

packagecom.quzheng.pipeengine;
importjava.util.
import java.io;
import java.util.; 
package junit.framework;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
publicclassOrderend{	
privateVectororders=newVector();
privateVectorstyles=newVector();
privateVectorstarts=newVector();
privateVectorends=newVector();privatestaticfinalOrderendINSTANCE=
newOrderend();
privateOrderend(){
}
publicstaticOrderendgetInstance(){
returnINSTANCE;
}publicbooleanisendable(intnumRqdDays,DateendDate){
Calendarcal=Calendar.getInstance();
for(inti=0;itmpStyle.getProcessID()){
distinctStyles.remove(tmpStyle);
distinctStyles.add(aStyle);
return;
}else{
return;
}
}
}
distinctStyles.add(aStyle);
publicVectorgetDistinctStyles(){
returndistinctStyles;
}
publicvoidcomputeStartTimeOffset(){
intcycleTime=SimpleDispatchRule.getInstance().getCycleTime();
doublepercent=1for(inti=0;i=tmpStyle.getQuantity()){
vec.insertElementAt(aStyle,i);
return;
}
}
vec.add(aStyle);
}publicintgetNumOfStylesByProcID(intprocID){
Stringkey=newInteger(procID).toString();
return((Vector)stylesByProcID.get(key)).size();
}publicdoublegetRank(StyleaStyle){
Stringkey=newInteger(aStyle.getProcessID()).toString();
Vectorstyles=(Vector)stylesByProcID.get(key);
for(inti=0;i0){
for(inti=bucketID-1;i>0;i--){
remainingCycleTime-=f.getNumWorkingDaysForBucket(i);
if(remainingCycleTime<0){
bucketID=i;
break;
}
}
}
else{
returnb;
}if(bucketID==b.getBucketID()){
returnnull;
}bucket=DataModel.getInstance().getCalendar().getBucket(bucketID);
returnbucket;}publicBucketgetEarliestRouteStartBucket(Router,Productp,Bucketb){
FacilitiesallFacilities=DataModel.getInstance().getFacilities();
doublerteCycleTime=r.getCycleTime();
Facilityf=allFacilities.getFacility(r.getFacilityID());
Bucketbucket=null;doubleremainingCycleTime=rteCycleTime;
intbucketID=b.getBucketID();
if(bucketID<2)
returnb;if(remainingCycleTime>0){
for(inti=bucketID-1;i>0;i--){
remainingCycleTime-=f.getNumWorkingDaysForBucket(i)if(remainingCycleTime>=0){
bucketID=i;
}
else{
break;
}
packagecom.quzheng.pipeengine;
importjava.util.
publicclassPeriodDate{privateintbucketID;
privateintseqNum;
privateDatestartingDate;
privatedoublebucketLength=2;
publicPeriodDate(intpID,intsNum,DatesDate){
bucketID=pID;
seqNum=sNum;
startingDate=sDate;
}publicintgetBucketID(){
returnbucketID;
}
publicintgetSequenceNumber(){
returnseqNum;
}publicDategetStartingDate(){
returnstartingDate;
}publicvoidsetBucketLength(doubleaDbl){
bucketLength=aDbl;
}
} packagecom.quzheng.pipeengine;
importjava.util.
importjava.io.
importjava.text.
importcom.quzheng.pipeengine.
importcom.quzheng.pipeengine.Entity.
importcom.quzheng.pipeengine.InputData.
importcom.quzheng.pipe.
importcom.quzheng.util.Message.
importcom.quzheng.pipeengine.DispatchReportMap.
publicclassPeriodDateMap
extendsInputReader{
staticResourceBundleres=ResourceBundle.getBundle(
"com.quzheng.pipeengine.Res",
EngineConfig.getInstance().getLocale());
privateString_fileName="perioddatemap";privateVectormapTable=newVector();
privateHashtablegroupByDate=newHashtable();privatedouble[]hoursInBuckets=newdouble[DataModel.getInstance().
getCalendar().getTotalNumOfBuckets()];privatestaticfinalPeriodDateMapINSTANCE=
newPeriodDateMap();privatePeriodDateMap(){
}publicstaticPeriodDateMapgetInstance(){
returnINSTANCE;
}publicVectorgetPeriodsInDate(DateaDate){
return(Vector)groupByDate.get(aDate.toString());
}publicbooleanisLastBucketInDate(DateaDate,intbucketID){
Vectorbuckets=getPeriodsInDate(aDate);
for(inti=0;ibucketID){
returnfalse;
}
}returntrue;
}publicdoublegetDateEndTime(DateaDate){
Vectorbuckets=getPeriodsInDate(aDate);doubleworkHoursInDate=0;
for(inti=0;i 0.0F) && (f2 > 0.0F))
          localImage.scalePercent(f1 > f2 ? f2 : f1);
        else if (f1 > 0.0F)
          localImage.scalePercent(f1);
        else if (f2 > 0.0F)
          localImage.scalePercent(f2);
        localImage.setWidthPercentage(0.0F);
        if (localObject3 != null)
        {
          endElement("p");
          int j = 1;
          if (((String)localObject3).equalsIgnoreCase("left"))
            j = 0;
          else if (((String)localObject3).equalsIgnoreCase("right"))
            j = 2;
          localImage.setAlignment(j);
          Img localImg = null;
          boolean bool = false;
          if (this.interfaceProps != null)
          {
            localImg = (Img)this.interfaceProps.get("img_interface");
            if (localImg != null)
              bool = localImg.process(localImage, paramHashMap, this.cprops, this.document);
          }
          if (!bool)
            this.document.add(localImage);
          this.cprops.removeChain(paramString);
        }
        else
        {
          this.cprops.removeChain(paramString);
          if (this.currentParagraph == null)
            this.currentParagraph = FactoryProperties.createParagraph(this.cprops);
          this.currentParagraph.add(new Chunk(localImage, 0.0F, 0.0F));
        }
        return;
      }
      endElement("p");
      if ((paramString.equals("h1")) || (paramString.equals("h2")) || (paramString.equals("h3")) || (paramString.equals("h4")) || (paramString.equals("h5")) || (paramString.equals("h6")))
      {
        if (!paramHashMap.containsKey("size"))
        {
          int i = 7 - Integer.parseInt(paramString.substring(1));
          paramHashMap.put("size", Integer.toString(i));
        }
        this.cprops.addToChain(paramString, paramHashMap);
        return;
      }
      Object localObject2;
      if (paramString.equals("ul"))
      {
        if (this.pendingLI)
          endElement("li");
        this.skipText = true;
        this.cprops.addToChain(paramString, paramHashMap);
        localObject2 = new List(false, 10.0F);
        ((List)localObject2).setListSymbol("?");
        this.stack.push(localObject2);
        return;
      }
      if (paramString.equals("ol"))
      {
        if (this.pendingLI)
          endElement("li");
        this.skipText = true;
        this.cprops.addToChain(paramString, paramHashMap);
        localObject2 = new List(true, 10.0F);
        this.stack.push(localObject2);
        return;
      }
      if (paramString.equals("li"))
      {
        if (this.pendingLI)
          endElement("li");
        this.skipText = false;
        this.pendingLI = true;
        this.cprops.addToChain(paramString, paramHashMap);
        this.stack.push(FactoryProperties.createListItem(this.cprops));
        return;
      }
      if ((paramString.equals("div")) || (paramString.equals("body")))
      {
        this.cprops.addToChain(paramString, paramHashMap);
        return;
      }
      if (paramString.equals("pre"))
      {
        if (!paramHashMap.containsKey("face"))
          paramHashMap.put("face", "Courier");
        this.cprops.addToChain(paramString, paramHashMap);
        this.isPRE = true;
        return;
      }
      if (paramString.equals("p"))
      {
        this.cprops.addToChain(paramString, paramHashMap);
        this.currentParagraph = FactoryProperties.createParagraph(paramHashMap);
        return;
      }
      if (paramString.equals("tr"))
      {
        if (this.pendingTR)
          endElement("tr");
        this.skipText = true;
        this.pendingTR = true;
        this.cprops.addToChain("tr", paramHashMap);
        return;
      }
      if ((paramString.equals("td")) || (paramString.equals("th")))
      {
        if (this.pendingTD)
          endElement(paramString);
        this.skipText = false;
        this.pendingTD = true;
        this.cprops.addToChain("td", paramHashMap);
        this.stack.push(new IncCell(paramString, this.cprops));
        return;
      }
      if (paramString.equals("table"))
      {
        this.cprops.addToChain("table", paramHashMap);
        localObject2 = new IncTable(paramHashMap);
        this.stack.push(localObject2);
        this.tableState.push(new boolean[] { this.pendingTR, this.pendingTD });
        this.pendingTR = (this.pendingTD = 0);
        this.skipText = true;
        return;
      }
    }
    catch (Exception localException)
    {
      throw new ExceptionConverter(localException);
    }
  }
  public void endElement(String paramString)
  {
    if (!tagsSupported.containsKey(paramString))
      return;
    try
    {
      String str = (String)FactoryProperties.followTags.get(paramString);
      if (str != null)
      {
        this.cprops.removeChain(str);
        return;
      }
      if ((paramString.equals("font")) || (paramString.equals("span")))
      {
        this.cprops.removeChain(paramString);
        return;
      }
      Object localObject1;
      Object localObject3;
      Object localObject4;
      if (paramString.equals("a"))
      {
        if (this.currentParagraph == null)
          this.currentParagraph = new Paragraph();
        localObject1 = null;
        boolean bool = false;
        if (this.interfaceProps != null)
        {
          localObject1 = (ALink)this.interfaceProps.get("alink_interface");
          if (localObject1 != null)
            bool = ((ALink)localObject1).process(this.currentParagraph, this.cprops);
        }
        if (!bool)
        {
          localObject3 = this.cprops.getProperty("href");
          if (localObject3 != null)
          {
            localObject4 = this.currentParagraph.getChunks();
            for (int i = 0; i < ((ArrayList)localObject4).size(); i++)
            {
              Chunk localChunk = (Chunk)((ArrayList)localObject4).get(i);
              localChunk.setAnchor((String)localObject3);
            }
          }
        }
        localObject3 = (Paragraph)this.stack.pop();
        localObject4 = new Phrase();
        ((Phrase)localObject4).add(this.currentParagraph);
        ((Paragraph)localObject3).add(localObject4);
        this.currentParagraph = ((Paragraph)localObject3);
        this.cprops.removeChain("a");
        return;
      }
      if (paramString.equals("br"))
        return;
      Object localObject2;
      if (this.currentParagraph != null)
        if (this.stack.empty())
        {
          this.document.add(this.currentParagraph);
        }
        else
        {
          localObject1 = this.stack.pop();
          if ((localObject1 instanceof TextElementArray))
          {
            localObject2 = (TextElementArray)localObject1;
            ((TextElementArray)localObject2).add(this.currentParagraph);
          }
          this.stack.push(localObject1);
        }
	publicvoidprint(){
		System.out.println("nnnCalendar---------------------");
		for(inti=0;i<_buckets.size();i++){
			Bucketb=(Bucket)_buckets.elementAt(i);
			b.print();
		}
	}}
packagecom.quzheng.pipeengine;
importjava.awt.importjava.io.importjava.text.importjava.awt.event.importjavax.swing.importjavanet.importjava.util.
importcom.quzheng.util.Message.importcom.quzheng.util.urltools.importcom.quzheng.pipeengine.Constraint.importcom.quzheng.pipeengine.Entity.importcom.quzheng.pipeengine.InputData.importcom.quzheng.pipeengine.LPModel.importcom.quzheng.pipeengine.Report.importcom.quzheng.pipeengine.Variable.importcom.quzheng.pipeengine.EngineUI.importcom.quzheng.pipeengine.DispatchReport.importcom.quzheng.lpsolver.LPSolve.importjava.util.ResourceBundle;
importcom.quzheng.pipe.
extendsThread{
privateStringerrMsg="privateintINTERVAL=30;staticResourceBundleres=ResourceBundle.getBundle(
"com.quzheng.pipeengine.Res",
EngineConfig.getInstance().getLocale());
privatestaticfinalPIPEMainINSTANCE=
newPIPEMain();privatePIPEMain(){
}publicstaticPIPEMaingetInstance(){
returnINSTANCE;
}privatebooleanrunPIPE=true;
privatebooleanisWait;
privatebooleandb2CSVError=false;
privatebooleancsv2DBError=false;
privateJletenginelet;publicvoidsetEnginelet(Jletanlet){
enginelet=anlet;
}publicvoidrunpipe(){while(true){
if(EngineConfig.getInstance().getRunFlag()==true){
EngineConfig.getInstance().setRunFlag(false);
runpipe();
}try{
isWait=true;
waitThreadwT=newwaitThread(2);
wT.start();
while(isWait){}
;
}
catch(Exceptione){
MessageArea.getInstance().addMessage("Errorwhilewaiting:"+
e.getMessage()+"n");
}}}publicvoidextractDataFromDB(StringfileName){
StringurlAddr=GlobalConfig.getInstance().getLPServerURL()+
"com.quzheng.pipeengine.LP_ConvertData";
URLurl=null;
HttpURLConnectionurlconn=null;
BufferedReaderd=null;
InputStreamin=null;
try{
url=newURL(urlAddr+"?"+
"cmd=DB-CSV&"+
"FileName=c:\paraster\script\"+fileName+"&"+
"Folder=c:\paraster\input");
urlconn=(HttpURLConnection)(url.openConnection());
urlconn.setRequestMethod("GET");
in=urlconn.getInputStream();
d=newBufferedReader(newInputStreamReader(in));
StringtmpStr;
while((tmpStr=d.readLine())!=null){
if(tmpStr.length()>=errMsg.length()&&
tmpStr.substring(0,errMsg.length()).equals(errMsg)){
MessageArea.getInstance().addMessage(
"ErrorwritingfilethroughURL:"+tmpStr+"n");
db2CSVError=true;
break;
}
else
MessageArea.getInstance().addSvrSideMsg(tmpStr+"n");
}
}
catch(Exceptione){
MessageArea.getInstance().addSvrSideMsg(e.getMessage()+"n");
}
finally{
try{
d.close();
in.close();
}
catch(Exceptione){
MessageArea.getInstance().addSvrSideMsg(e.getMessage()+"n");
}
}
}publicvoidwriteDispatchListToDB(StringcsvName,StringtblName){StringurlAddr=GlobalConfig.getInstance().getLPServerURL()+
"com.quzheng.pipeengine.LP_ConvertData";
URLurl=null;
HttpURLConnectionurlconn=null;
BufferedReaderd=null;
InputStreamin=null;
try{
url=newURL(urlAddr+"?"+
"cmd=CSV-DB&"+
"FileName=c:\paraster\output\"+csvName+"&"+
"TableName="+tblName);
urlconn=(HttpURLConnection)(url.openConnection());
urlconn.setRequestMethod("POST");
in=urlconn.getInputStream();
d=newBufferedReader(newInputStreamReader(in));
StringtmpStr;
while((tmpStr=d.readLine())!=null){
if(tmpStr.length()>=errMsg.length()&&
tmpStr.substring(0,errMsg.length()).equals(errMsg)){
MessageArea.getInstance().addMessage(
"ErrorwritingfilethroughURL:"+tmpStr+"n");
csv2DBError=true;
break;
}
else
MessageArea.getInstance().addSvrSideMsg(tmpStr+"n");
}
}
catch(Exceptione){
MessageArea.getInstance().addSvrSideMsg(e.getMessage()+"n");
}
finally{
try{
d.close();
in.close();
}
catch(Exceptione){
MessageArea.getInstance().addSvrSideMsg(e.getMessage()+"n");
}
}privatevoidpreAssignCriticalRsc(){
for(inti=0;i=0;i--){
			key[idx]=facility.charAt(i);
			idx--;
		}		idx=24;
		for(inti=_productID.length()-1;i>=0;i--){
			key[idx]=_productID.charAt(i);
			idx--;
		}		returnnewString(key);
	}	publicStringgetProductID(){
		return_productID;
	}	publicintgetFacilityID(){
		return_facilityID;
	}	publicFacilitygetFacility(){
		Facilitiesfacilities=DataModel.getInstance().getFacilities();
		returnfacilities.getFacility(_facilityID);
	}	publicvoidaddProducingRoute(Router){
		_producingRoutes.addElement(r);
	}	publicVectorgetProducingRoutes(){
		return_producingRoutes;
	}	publicvoidaddSourcingRoute(Router){
		_sourcingRoutes.addElement(r);
	}	publicVectorgetSourcingRoutes(){
		return_sourcingRoutes;
	}	publicvoidaddDemand(ProductDemandprodDmd){
		_demands.addElement(prodDmd);
	}	publicVectorgetDemands(){
		return_demands;
	}	publicdoublegetDemand(intbucketID){
		doubledmd=0.0;		for(inti=0;i<_demands.size();i++){
			ProductDemandprodDmd=(ProductDemand)_demands.elementAt(i);
			if(prodDmd.getBucketID()==bucketID){
				dmd=prodDmd.getDmdQty();
				break;
			}
		}		returndmd;
	}	publicdoublegetASP(intbucketID){
		for(inti=0;i<_demands.size();i++){
			ProductDemandprodDmd=(ProductDemand)_demands.elementAt(i);
			if(prodDmd.getBucketID()==bucketID){
				returnprodDmd.getASP();
			}
		}		return0.0;
	}	publicbooleanhasDemand(){
		if(_demands.size()==0)returnfalse;		returntrue;
	}publicbooleanhasDemand(Bucketb){
		for(inti=0;i<_demands.size();i++){
			intbucket=((ProductDemand)_demands.elementAt(i)).getBucketID();
			if(bucket==b.getBucketID()){
				returntrue;
			}
		}returnfalse;
}publicintgetDemandPriority(Bucketb){
		for(inti=0;i<_demands.size();i++){
			intbucket=((ProductDemand)_demands.elementAt(i)).getBucketID();
			if(bucket==b.getBucketID()){
				return((ProductDemand)_demands.elementAt(i)).getPriority();
			}
		}return100;
}publicdoublegetMaxCost(){
doublemaxCost=0;
for(inti=0;i<_producingRoutes.size();i++){
Routerte=(Route)_producingRoutes.elementAt(i);
rte.print();
if(rte.getCostPerStart()>maxCost){
maxCost=rte.getCostPerStart();
}
}
InventoryCostsinvCosts=DataModel.getInstance().getInventoryCosts();maxCost+=invCosts.getInventoryCost(_productID,_facilityID).getMaxHoldingCost();returnmaxCost;
}	publicintgetFirstDemandPeriod(){
		if(_demands.size()==0)return-1;
		intminT=((ProductDemand)_demands.firstElement()).getBucketID();		for(inti=1;i<_demands.size();i++){
			intbucket=((ProductDemand)_demands.elementAt(i)).getBucketID();
			if(bucketr.getLastStartBucketHavingOuts())continue;					varName=startsVar.getVariable(r,p,b);
					constr+="+"+varName;					intcolIdx=mdl.getModelVariables().addVariable(varName);
					Elementelem=memMgr.getElement();
					elem.setProperties(colIdx,1.0);
					con.addElement(elem);
this.addMPSElem(con,colIdx,elem);
				}								if(constr.length()==0)continue;				if(bndType.equals(res.getString("UP"))){
					varName=bndVar.getVariable(bndType,f,p,b);
					constr+="-"+varName;					intcolIdx=mdl.getModelVariables().addVariable(varName);
					Elementelem=memMgr.getElement();
					elem.setProperties(colIdx,-1.0);
					con.addElement(elem);
this.addMPSElem(con,colIdx,elem);					constr+="<=";
					con.setSign("<=");
				}else{
					varName=bndVar.getVariable(bndType,f,p,b);
					constr+="+"+varName;					intcolIdx=mdl.getModelVariables().addVariable(varName);
					Elementelem=memMgr.getElement();
					elem.setProperties(colIdx,1.0);
					con.addElement(elem);
this.addMPSElem(con,colIdx,elem);					constr+=">=";
					con.setSign(">=");
				}				constr+=newDouble(bndQty).toString();
				con.setRHS(bndQty);				mdl.addConstraint(con);				_constraints.addElement(constr);
			}
		}
	}}
packagecom.quzheng.pipeengine;importjava.util.importjava.io.importcom.quzheng.pipeengine.Entity.importcom.quzheng.pipe.
publicclassProductBoundsextendsInputReader
{
privateHashtable_productBounds=newHashtable();
	privateString_fileName="ProductBounds";	publicProductBounds(){
	}	privatevoidaddProductBound(intfID,
								StringprodID,
								intbucketID,
								StringbndType,
								doubleqty,
								doublecost){
		Stringkey=createKey(fID,prodID);
		ProductBoundpb=(ProductBound)_productBounds.get(key);		if(null==pb){
			pb=newProductBound(fID,prodID);
			_productBounds.put(key,pb);
		}		pb.addBound(bucketID,bndType,qty,cost);
	}	privateStringcreateKey(intfID,StringprodID){
		char[]key=newchar[105];
		Stringfacility=newInteger(fID).toString();		intidx=104;
		for(inti=facility.length()-1;i>=0;i--){
			key[idx]=facility.charAt(i);
			idx--;
		}		idx=99;
		for(inti=prodID.length()-1;i>=0;i--){
			key[idx]=prodID.charAt(i);
			idx--;
		}		returnnewString(key);
	}	publicHashtablegetProductBounds(){
		return_productBounds;
	}	protectedStringgetFileName(){
		return_fileName;
	}	publicvoidreadData()throwsException{
		BufferedReaderd=super.getReader();if(null==d){
return;
}		Stringtoken=GlobalConfig.getInstance().getSeparator();
		StringaLine=d.readLine();
		Facilitiesfacilities=DataModel.getInstance().getFacilities();		while(aLine!=null){
if(aLine.length()<=1){
aLine=d.readLine();
continue;
}
			StringTokenizerst=newStringTokenizer(aLine,token);			intfacilityID=newInteger(st.nextToken()).intValue();
			StringproductID=st.nextToken();
			inteffectiveBucket=newInteger(st.nextToken()).intValue();
			StringbndType=st.nextToken();
			doubleqty=newDouble(st.nextToken()).doubleValue();
			doublecost=newDouble(st.nextToken()).doubleValue();			FacilityaFacility=facilities.getFacility(facilityID);
if(null==aFacility){
reportError("FacilityID",newInteger(facilityID).toString(),aLine);
aLine=d.readLine();
continue;
}Productp=DataModel.getInstance().getProducts().getProduct(facilityID,productID);
if(null==p){
reportError("ProductID",productID,aLine);
aLine=d.readLine();
continue;
}			addProductBound(facilityID,
							productID,
							effectiveBucket,
							bndType,
							qty,
							cost);
			aLine=d.readLine();
		}		d.close();
super.closeURLConnection();	}	publicvoidprint(){
		System.out.println("nnnProductBound---------------------");
		EnumerationallBnds=_productBounds.elements();		while(allBnds.hasMoreElements()){
			ProductBoundprodBnd=(ProductBound)allBnds.nextElement();
			prodBnd.print();
		}
	}
}
packagecom.quzheng.pipeengine;importjava.util.ResourceBundle;
importjava.util.importcom.quzheng.pipeengine.Entity.importcom.quzheng.pipeengine.InputData.
publicclassProductDemand
{
privateProduct_product;
	privateint_bucket;
	privateint_priority;
	privateint_facilityID;
	privatedouble_dmdQty;
	privatedouble_asp;	publicProductDemand(Productprod,
						intbucket,
						intpriority,
						intfacility,
						doubledmdQty,
						doubleasp){
		_product=prod;
		_bucket=bucket;
		_priority=priority;
		_facilityID=facility;
		_dmdQty=dmdQty;
		_asp=asp;
	}	publicProductgetProduct(){
		return_product;
	}	publicintgetBucketID(){
		return_bucket;
	}	publicintgetPriority(){
		return_priority;
	}	publicintgetFacilityID(){
		return_facilityID;
	}	publicdoublegetDmdQty(){
		return_dmdQty;
	}	publicdoublegetASP(){
		return_asp;
	}privateVectorroutes=newVector();
publicvoidgenProducingRoutes(){
findProducingRoutes(routes,_product,null);
for(inti=0;i=0;i--){
			key[idx]=fID.charAt(i);
			idx--;
		}		StringbucketID=newInteger(pd.getBucketID()).toString();		idx=34;
		for(inti=bucketID.length()-1;i>=0;i--){
			key[idx]=bucketID.charAt(i);
			idx--;
		}		
		idx=29;
		for(inti=priority.length()-1;i>=0;i--){
			key[idx]=priority.charAt(i);
			idx--;
		}		idx=29;		StringprodID=pd.getProduct().getProductID();
		for(inti=prodID.length()-1;i>=0;i--){
			key[idx]=prodID.charAt(i);
			idx--;
		}		returnnewString(key);
	}	protectedStringgetFileName(){
		return_fileName;
	}	publicvoidreadData()throwsException{
		Stringtoken=GlobalConfig.getInstance().getSeparator();
		BufferedReaderd=super.getReader();if(null==d){
return;
}		StringaLine=d.readLine();
		Productsproducts=DataModel.getInstance().getProducts();
		Facilitiesfacilities=DataModel.getInstance().getFacilities();
intcnt=0;		while(aLine!=null){
if(aLine.length()<=1){
aLine=d.readLine();
continue;
}
			StringTokenizerst=newStringTokenizer(aLine,token);			StringproductID=st.nextToken();			intbucketID=newInteger(st.nextToken()).intValue();
			intpriority=newInteger(st.nextToken()).intValue();
			intfacility=newInteger(st.nextToken()).intValue();
			doubleqty=newDouble(st.nextToken()).doubleValue();
			doubleasp=newDouble(st.nextToken()).doubleValue();			Productp=products.getProduct(facility,productID);
if(null==p){
reportError("ProductID",productID,aLine);
aLine=d.readLine();
continue;
}			FacilityaFacility=facilities.getFacility(facility);
if(null==aFacility){
reportError("FacilityID",newInteger(facility).toString(),aLine);
aLine=d.readLine();
continue;
}if(null==DataModel.getInstance().getCalendar().getBucket(bucketID)){
reportError("BucketID",newInteger(bucketID).toString(),aLine);
aLine=d.readLine();
continue;
}if(priority==2&&!EngineConfig.getInstance().isATPScheduling()){
}else{
ProductDemandprodDmd=newProductDemand(p,
bucketID,
priority,
facility,
qty,
asp);addProductDemand(prodDmd,cnt);p.addDemand(prodDmd);
}			aLine=d.readLine();
cnt++;
		}d.close();
		super.closeURLConnection();
checkDataSufficiency();
	}privatevoidcheckDataSufficiency(){
if(_productDemands.size()<1){
MessageArea.getInstance().addMessage(
res.getString("Engine17002")+
res.getString("required_to_create_a"));EngineConfig.getInstance().setDataSufficiency(false);
}
}
	publicvoidprint(){
		System.out.println("nnnProductDemand---------------------");
		EnumerationallDemand=_productDemands.elements();		while(allDemand.hasMoreElements()){
			ProductDemandprodDmd=(ProductDemand)allDemand.nextElement();
			prodDmd.print();
		}
	}privateHashtablelastRoutes=newHashtable();
publicvoidgenLastRoutes(){
HashtableallDmds=DataModel.getInstance().getProductDemands().getAllDemands();
Enumerationdmds=allDmds.elements();while(dmds.hasMoreElements()){
ProductDemandaDmd=(ProductDemand)dmds.nextElement();
VectorproducingRoutes=aDmd.getProduct().getProducingRoutes();
for(inti=0;i=1.0){
decimal-=1.0;
lastSchedule.augmentOuts();
lastSchedule=aSchedule;
}
													b.getFormatedDate()+separator+
									p.getProductID()+separator+
									p.getFacility().getDescription()+separator+
									outValue+"n";				content.end(lineOut);
if(decimal>0.2){
lastSchedule.augmentOuts();
}
		}for(inti=0;i=0;i--){
Routerte=(Route)routes.elementAt(i);
VectorrteArray=routeArray[rte.getRouteID()-1];
if(null==rteArray)continue;
doubledecimal=0;
StartsSchedulelastSchedule=null;
intlastIndex=0;
VectorrscUseVec=rscUses.getResourceUse(rte.getRouteID());
ResourceUserscUse=null;
Resourcersc=null;
if(null!=rscUseVec){
rscUse=(ResourceUse)rscUseVec.elementAt(0);
rsc=rscUse.getResource();
}
for(intj=0;j=.85){
if(null!=rscUseVec){
for(intk=lastIndex;k<=j;k++){
lastSchedule=(StartsSchedule)rteArray.elementAt(k);
if(!mayAdjustStarts(lastSchedule.getRouteID(),
lastSchedule.getBucketID())){
continue;
}booleanlastBucketInDate=PeriodDateMap.getInstance().
isLastBucketInDate(
PeriodDateMap.getInstance().getDateBucketBelongsTo(
lastSchedule.getBucketID()),
lastSchedule.getBucketID());if(rsc.getResourceHours(lastSchedule.getBucketID())1.0||lastBucketInDate){
if(rsc.getResourceHours(lastSchedule.getBucketID())<-2.0)
continue;
lastSchedule.augmentStarts();
rsc.consumeCapacity(lastSchedule.getBucketID(),
1.0decimal-=1.0;
lastIndex=j;
break;
}
}
}else{
for(intk=lastIndex;k<=j;k++){
lastSchedule=(StartsSchedule)rteArray.elementAt(k);
if(!mayAdjustStarts(lastSchedule.getRouteID(),
lastSchedule.getBucketID())){
continue;
}
lastSchedule.augmentStarts();
decimal-=1.0;
lastIndex=j;
break;
}
}
}
}}
if(decimal>=0.5){
booleanfound=false;
if(null!=rscUseVec){
for(intk=lastIndex;k4){
lastSchedule.augmentStarts();
found=true;
decimal--;
break;
}
if(!mayAdjustStarts(lastSchedule.getRouteID(),
lastSchedule.getBucketID())){
continue;
}
if(rsc.getResourceHours(lastSchedule.getBucketID())1.0lastSchedule.augmentStarts();
rsc.consumeCapacity(lastSchedule.getBucketID(),
1.0found=true;
decimal--;
break;
}
}

}else{
RouteaRoute=DataModel.getInstance().getRoutes().getRoute(
lastSchedule.getRouteID());
if(aRoute.getFacility().getNumWorkingDaysForBucket(lastSchedule.
getBucketID())>4||mayAdjustStarts(lastSchedule.getRouteID(),
lastSchedule.getBucketID())){
lastSchedule.augmentStarts();
found=true;
decimal--;
}
}
if(!found){
if(mayAdjustStarts(lastSchedule.getRouteID(),
lastSchedule.getBucketID())){
lastSchedule.augmentStarts();
decimal--;
}
}}}
}
try{
createIntegrizedReport();
}catch(Exceptione){}}privatebooleanmayAdjustStarts(intrteID,intbucketID){
VectorprevRoutes=DataModel.getInstance().getRoutes().getRoute(rteID).getPrevRoutes();
if(null==prevRoutes||prevRoutes.size()==0)returntrue;if(bucketID==1)returnfalse;Router=DataModel.getInstance().getRoutes().getRoute(rteID);
if(r.getFacility().getNumWorkingDaysForBucket(bucketID)>4){
returntrue;
}if(getCumStartsOfPrevRoutes(rteID,bucketID-1)>getCumStarts(rteID,bucketID)){
returntrue;
}returnfalse;
}privateintgetMinSrcInv(Router,intbucketID){
VectorrteSrcVec=DataModel.getInstance().getRouteSources().getRouteSources(r);
intminInv=Integer.MAX_VALUE;
for(inti=0;i errors)
        {
        }
        public Statement methodBlock(FrameworkMethod method)
        {
          final Statement statement = super.methodBlock(method);
          return new Statement()
          {
            public void evaluate() throws Throwable {
              try {
                statement.evaluate();
                Theories.TheoryAnchor.this.handleDataPointSuccess();
              } catch (AssumptionViolatedException e) {
                Theories.TheoryAnchor.this.handleAssumptionViolation(e);
              } catch (Throwable e) {
                Theories.TheoryAnchor.this.reportParameterizedError(e, Theories.TheoryAnchor.1.this.val$complete.getArgumentStrings(Theories.TheoryAnchor.this.nullsOk()));
              }
            }
          };
        }
        protected Statement methodInvoker(FrameworkMethod method, Object test)
        {
          return Theories.TheoryAnchor.this.methodCompletesWithParameters(method, complete, test);
        }
        public Object createTest() throws Exception
        {
          return getTestClass().getOnlyConstructor().newInstance(complete.getConstructorArguments(Theories.TheoryAnchor.this.nullsOk()));
        }
      }
      .methodBlock(this.fTestMethod).evaluate();
    }
    private Statement methodCompletesWithParameters(final FrameworkMethod method, final Assignments complete, final Object freshInstance)
    {
      return new Statement()
      {
        public void evaluate() throws Throwable {
          try {
            Object[] values = complete.getMethodArguments(Theories.TheoryAnchor.this.nullsOk());
            method.invokeExplosively(freshInstance, values);
          }
          catch (PotentialAssignment.CouldNotGenerateValueException e) {
          }
        }
      };
    }
    protected void handleAssumptionViolation(AssumptionViolatedException e) {
      this.fInvalidParameters.add(e);
    }
    protected void reportParameterizedError(Throwable e, Object[] params) throws Throwable
    {
      if (params.length == 0)
        throw e;
      throw new ParameterizedAssertionError(e, this.fTestMethod.getName(), params);
    }
    private boolean nullsOk()
    {
      Theory annotation = (Theory)this.fTestMethod.getMethod().getAnnotation(Theory.class);
      if (annotation == null)
        return false;
      return annotation.nullsAccepted();
    }
    protected void handleDataPointSuccess() {
      this.successes += 1;
    }
  }

}package org.junit.experimental;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.junit.runner.Computer;
import org.junit.runner.Runner;
import org.junit.runners.ParentRunner;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
import org.junit.runners.model.RunnerScheduler;
public class ParallelComputer extends Computer
{
  private final boolean fClasses;
  private final boolean fMethods;
  public ParallelComputer(boolean classes, boolean methods)
  {
    this.fClasses = classes;
    this.fMethods = methods;
  }
  public static Computer classes() {
    return new ParallelComputer(true, false);
  }
  public static Computer methods() {
    return new ParallelComputer(false, true);
  }
  private static  Runner parallelize(Runner runner) {
    if ((runner instanceof ParentRunner)) {
      ((ParentRunner)runner).setScheduler(new RunnerScheduler() {
        private final List> fResults = new ArrayList();
        private final ExecutorService fService = Executors.newCachedThreadPool();
        public void schedule(final Runnable childStatement)
        {
          this.fResults.add(this.fService.submit(new Callable() {
            public Object call() throws Exception {
              childStatement.run();
              return null;
            }
          }));
        }
        public void finished() {
          for (Future each : this.fResults)
            try {
              each.get();
            } catch (Exception e) {
              e.printStackTrace();
            }
        }
      });
    }
    return runner;
  }
  public Runner getSuite(RunnerBuilder builder, Class[] classes)
    throws InitializationError
  {
    Runner suite = super.getSuite(builder, classes);
    return this.fClasses ? parallelize(suite) : suite;
  }
  protected Runner getRunner(RunnerBuilder builder, Class testClass)
    throws Throwable
  {
    Runner runner = super.getRunner(builder, testClass);
    return this.fMethods ? parallelize(runner) : runner;
  }
}
package org.junit.internal.builders;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.Runner;
import org.junit.runners.model.RunnerBuilder;
public class AllDefaultPossibilitiesBuilder extends RunnerBuilder
{
  private final boolean fCanUseSuiteMethod;
  public AllDefaultPossibilitiesBuilder(boolean canUseSuiteMethod)
  {
    this.fCanUseSuiteMethod = canUseSuiteMethod;
  }
  public Runner runnerForClass(Class testClass) throws Throwable
  {
    List builders = Arrays.asList(new RunnerBuilder[] { ignoredBuilder(), annotatedBuilder(), suiteMethodBuilder(), junit3Builder(), junit4Builder() });
    for (RunnerBuilder each : builders) {
      Runner runner = each.safeRunnerForClass(testClass);
      if (runner != null)
        return runner;
    }
    return null;
  }
  protected JUnit4Builder junit4Builder() {
    return new JUnit4Builder();
  }
  protected JUnit3Builder junit3Builder() {
    return new JUnit3Builder();
  }
  protected AnnotatedBuilder annotatedBuilder() {
    return new AnnotatedBuilder(this);
  }
  protected IgnoredBuilder ignoredBuilder() {
    return new IgnoredBuilder();
  }
  protected RunnerBuilder suiteMethodBuilder() {
    if (this.fCanUseSuiteMethod)
      return new SuiteMethodBuilder();
    return new NullBuilder();
  }
}
package org.logicalcobwebs.concurrent;
public abstract class FJTask

  implements Runnable
{
  private volatile boolean done;
  public static FJTaskRunner getFJTaskRunner()
  {
    return (FJTaskRunner)Thread.currentThread();
  }
  public static FJTaskRunnerGroup getFJTaskRunnerGroup()
  {
    return getFJTaskRunner().getGroup();
  }
  public final boolean isDone()
  {
    return this.done;
  }
  protected final void setDone()
  {
    this.done = true;
  }
  public void cancel()
  {
    setDone();
  }
  public void reset()
  {
    this.done = false;
  }
  public void start()
  {
    getFJTaskRunnerGroup().executeTask(this);
  }
  public void fork()
  {
    getFJTaskRunner().push(this);
  }
  public static void yield()
  {
    getFJTaskRunner().taskYield();
  }
  public void join()
  {
    getFJTaskRunner().taskJoin(this);
  }
  public static void invoke(FJTask t)
  {
    if (!t.isDone()) {
      t.run();
      t.setDone();
    }
  }
  public static void coInvoke(FJTask task1, FJTask task2)
  {
    getFJTaskRunner().coInvoke(task1, task2);
  }
  public static void coInvoke(FJTask[] tasks)
  {
    getFJTaskRunner().coInvoke(tasks);
  }
  public static FJTask seq(FJTask[] tasks)
  {
    return new Seq(tasks);
  }
  public static FJTask par(FJTask[] tasks)
  {
    return new Par(tasks);
  }
  public static FJTask seq(FJTask task1, FJTask task2)
  {
    return new Seq2(task1, task2);
  }
  public static FJTask par(FJTask task1, FJTask task2)
  {
    return new Par2(task1, task2);
  }
  public static class Par2 extends FJTask
  {
    protected final FJTask fst;
    protected final FJTask snd;
    public Par2(FJTask task1, FJTask task2)
    {
      this.fst = task1;
      this.snd = task2;
    }
    public void run() {
      FJTask.coInvoke(this.fst, this.snd);
    }
  }
  public static class Seq2 extends FJTask
  {
    protected final FJTask fst;
    protected final FJTask snd;
    public Seq2(FJTask task1, FJTask task2)
    {
      this.fst = task1;
      this.snd = task2;
    }
    public void run() {
      FJTask.invoke(this.fst);
      FJTask.invoke(this.snd);
    }
  }
  public static class Par extends FJTask
  {
    protected final FJTask[] tasks;
    public Par(FJTask[] tasks)
    {
      this.tasks = tasks;
    }
    public Par(FJTask task1, FJTask task2)
    {
      this.tasks = new FJTask[] { task1, task2 };
    }
    public void run()
    {
      FJTask.coInvoke(this.tasks);
    }
  }
  public static class Seq extends FJTask
  {
    protected final FJTask[] tasks;
    public Seq(FJTask[] tasks)
    {
      this.tasks = tasks;
    }
    public Seq(FJTask task1, FJTask task2)
    {
      this.tasks = new FJTask[] { task1, task2 };
    }
    public void run() {
      for (int i = 0; i < this.tasks.length; i++) FJTask.invoke(this.tasks[i]);
    }
  }

  public static class Wrap extends FJTask
  {
    protected final Runnable runnable;
    public Wrap(Runnable r)
    {
      this.runnable = r;
    }
    public void run() {
      this.runnable.run();
    }
  }
}
}publicvoidcreateIntegrizedReport()throwsIOException{
DataModeldataModel=DataModel.getInstance();
Vectorbuckets=dataModel.getCalendar().getBuckets();
Routesroutes=dataModel.getRoutes();
StartsVariablestartsVar=StartsVariable.getInstance();
OutsVariableoutsVar=OutsVariable.getInstance();
Solutionsol=Solution.getInstance();
RouteProductsrteProds=dataModel.getRouteProducts();EnumerationallRoutes=routes.getRoutes().elements();
Stringseparator=GlobalConfig.getInstance().getSeparator();
content=newStringBuffer();
for(inti=0;i=0;i--){
			key[idx]=facility.charAt(i);
			idx--;
		}		idx=24;
		for(inti=prodID.length()-1;i>=0;i--){
			key[idx]=prodID.charAt(i);
			idx--;
		}
		returnnewString(key);
	}	publicProductgetProduct(intfID,StringproductID){
ProductrtnProd=null;
Facilityf=DataModel.getInstance().getFacilities().getFacility(fID);
HashtableprodsAtFacility=(Hashtable)_products.get(f);
if(null!=prodsAtFacility){
rtnProd=(Product)prodsAtFacility.get(productID);
}
		returnrtnProd;
	}	publicHashtablegetProducts(){
		return_products;
	}	protectedStringgetFileName(){
		return_fileName;
	}	publicvoidreadData()throwsException{
		Stringtoken=GlobalConfig.getInstance().getSeparator();
		BufferedReaderd=super.getReader();if(null==d){
return;
}		StringaLine=d.readLine();
		intcnt=0;
		Facilitiesfacilities=DataModel.getInstance().getFacilities();		while(aLine!=null){
if(aLine.length()<=1){
aLine=d.readLine();
continue;
}
			StringTokenizerst=newStringTokenizer(aLine,token);			StringprodID=st.nextToken();
			intfacilityID=newInteger(st.nextToken()).intValue();			Productp=newProduct(prodID,facilityID);			Facilityf=facilities.getFacility(facilityID);
if(null==f){
reportError("FacilityID",newInteger(facilityID).toString(),aLine);
aLine=d.readLine();
continue;
}			p.setVariableCode(cnt,_productCodeLength);			addProduct(p);
			f.addProduct(p);			aLine=d.readLine();
			cnt++;
		}d.close();
		super.closeURLConnection();
checkDataSufficiency();
	}privatevoidcheckDataSufficiency(){
if(_products.size()<1){
MessageArea.getInstance().addMessage(
res.getString("Engine17003")+
res.getString("required_to_create_a"));EngineConfig.getInstance().setDataSufficiency(false);
}
}
	publicvoidprint(){
		System.out.println("nnnProduct---------------------");
		EnumerationallProducts=_products.elements();		while(allProducts.hasMoreElements()){
			Productp=(Product)allProducts.nextElement();
			p.print();
		}
	}
}
packagecom.quzheng.pipeengine.Variable;importjava.util.importcom.quzheng.pipeengine.Entity.importcom.quzheng.pipeengine.InputData.importcom.quzheng.pipeengine.
publicclassReceivingVariable
extendsVariable{
privatestaticfinalReceivingVariableINSTANCE=
newReceivingVariable();privateReceivingVariable(){
}publicstaticReceivingVariablegetInstance(){
returnINSTANCE;
}publicStringgetVariable(Facilityorig,Facilitydest,Productp,Bucketb){
Stringvar=getDefinedVar(orig,dest,p,b);if(null==var){
var=newString("RV"+
"F"+orig.getVariableCode()+
"F"+dest.getVariableCode()+
"P"+p.getVariableCode()+
"T"+b.getVariableCode());
addDefinedVar(orig,dest,p,b,var);
}if(p.hasDemand(b)&&
EngineConfig.getInstance().isMaxProfit()){
super.setObjElement(var,-p.getASP(b.getBucketID()));
}returnvar;
}publicBucketgetShippingStartBucket(Shipments,Bucketb){
doubleshipTime=s.getShippingTime();
longoneDayInMilSec=24longmidPointOfBucket=b.getStartDate().getTime()+
(long)(oneDayInMilSecDateshipStartDate=newDate(midPointOfBucket-timeOffset);VectorallBuckets=DataModel.getInstance().getCalendar().getBuckets();for(inti=0;i

 

 

恳请斧正,感谢。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/894749.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号