code
stringlengths
10
174k
nl
stringlengths
3
129k
MetricProcessor(BatchService batchService){ this.batchService=batchService; }
Creates a new MetricProcessor object.
public void readCache(){ final File userConfigFile=FileSystemService.getUserConfigFile(CACHE_FILE_NAME); if (!userConfigFile.exists()) { return; } LogService.getRoot().log(Level.CONFIG,"com.rapidminer.gui.security.Wallet.reading_secrets_file"); Document doc; try { doc=XMLTools.parse(userConfigFile); } catch ( Exception e) { LogService.getRoot().log(Level.WARNING,I18N.getMessage(LogService.getRoot().getResourceBundle(),"com.rapidminer.gui.security.Wallet.reading_secrets_file_error",e),e); return; } readCache(doc); }
Reads the wallet from the secrets.xml file in the user's home directory.
public static double[] minus(double[] v1,double[] v2){ checkLength(v2,v1.length); double[] array=new double[v1.length]; for (int i=0; i < v1.length; i++) array[i]=v1[i] - v2[i]; return array; }
Element-wise subtraction of two arrays. Arrays must be same size.
public static String UTF8toUTF16(byte[] utf8,int offset,int len){ char[] out=new char[len]; int n=UTF8toUTF16(utf8,offset,len,out,0); return new String(out,0,n); }
Convert UTF8 bytes into a String
public void addAudioFileTypes(String type){ if (!type.startsWith(".")) { type="." + type; } if (!audioFileTypes.contains(type)) { audioFileTypes.add(type); firePropertyChange(AUDIO_FILE_TYPE,null,audioFileTypes); } }
Adds the audio file types.
private static boolean emptyMeet(Type p,Type q,Unit unit){ if (p == null || q == null) { return false; } if (p.isExactlyNothing() || q.isExactlyNothing()) { return true; } TypeDeclaration pd=p.getDeclaration(); TypeDeclaration qd=q.getDeclaration(); if (q.isUnion()) { for ( Type t : q.getCaseTypes()) { if (!emptyMeet(p,t,unit)) { return false; } } return true; } else if (qd.getCaseTypes() != null) { boolean all=true; for ( Type t : qd.getCaseTypes()) { if (t.getDeclaration().isSelfType() || !emptyMeet(p,t,unit)) { all=false; break; } } if (all) return true; } if (p.isUnion()) { for ( Type t : p.getCaseTypes()) { if (!emptyMeet(q,t,unit)) { return false; } } return true; } else if (pd.getCaseTypes() != null) { boolean all=true; for ( Type t : pd.getCaseTypes()) { if (t.getDeclaration().isSelfType() || !emptyMeet(q,t,unit)) { all=false; break; } } if (all) return true; } if (q.isIntersection() || q.isTypeParameter()) { for ( Type t : q.getSatisfiedTypes()) { if (emptyMeet(p,t,unit)) { return true; } } return false; } if (p.isIntersection() || p.isTypeParameter()) { for ( Type t : p.getSatisfiedTypes()) { if (emptyMeet(q,t,unit)) { return true; } } return false; } if (p.isClass() && q.isClass() || p.isInterface() && q.isNull() || q.isInterface() && p.isNull()) { if (!qd.inherits(pd) && !pd.inherits(qd)) { return true; } } if (pd.isFinal()) { if (pd.getTypeParameters().isEmpty() && !q.involvesTypeParameters() && !p.isSubtypeOf(q)&& !(qd instanceof UnknownType)) { return true; } if (q.isClassOrInterface() && !pd.inherits(qd)) { return true; } } if (qd.isFinal()) { if (qd.getTypeParameters().isEmpty() && !p.involvesTypeParameters() && !q.isSubtypeOf(p)&& !(p.isUnknown())) { return true; } if (p.isClassOrInterface() && !qd.inherits(pd)) { return true; } } Interface st=unit.getSequentialDeclaration(); if (q.isClassOrInterface() && pd.inherits(st) && !qd.inherits(st)&& !st.inherits(qd) || p.isClassOrInterface() && qd.inherits(st) && !pd.inherits(st)&& !st.inherits(pd)) { return true; } Interface nst=unit.getSequenceDeclaration(); if (pd.inherits(nst) && qd.inherits(st) || qd.inherits(nst) && pd.inherits(st)) { Type pet=unit.getSequentialElementType(p); Type qet=unit.getSequentialElementType(q); if (emptyMeet(pet,qet,unit)) { return true; } } Class td=unit.getTupleDeclaration(); if (pd.inherits(td) && qd.inherits(td)) { List<Type> pal=p.getTypeArgumentList(); List<Type> qal=q.getTypeArgumentList(); if (pal.size() >= 3 && qal.size() >= 3) { if (emptyMeet(pal.get(1),qal.get(1),unit) || emptyMeet(pal.get(2),qal.get(2),unit)) { return true; } } } if (pd.inherits(td) && qd.inherits(st)) { List<Type> pal=p.getTypeArgumentList(); Type qet=unit.getSequentialElementType(q); if (pal.size() >= 3) { if (emptyMeet(pal.get(1),qet,unit) || emptyMeet(pal.get(2),unit.getSequentialType(qet),unit)) { return true; } } } if (qd.inherits(td) && pd.inherits(st)) { List<Type> qal=q.getTypeArgumentList(); Type pet=unit.getSequentialElementType(p); if (qal.size() >= 3) { if (emptyMeet(qal.get(1),pet,unit) || emptyMeet(qal.get(2),unit.getSequentialType(pet),unit)) { return true; } } } return false; }
The meet of two classes unrelated by inheritance, or of Null with an interface type is empty. The meet of an anonymous class with a type to which it is not assignable is empty.
@DSComment("constructor") @DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:07.571 -0500",hash_original_method="5333FFC8A800A9BDD5C93C0D81F44606",hash_generated_method="8ABBA94AFCE96480E8CA6B2F52A5AE36") public Paint(Paint paint){ mNativePaint=native_initWithPaint(paint.mNativePaint); setClassVariablesFrom(paint); }
Create a new paint, initialized with the attributes in the specified paint parameter.
public static String toHexString(final byte[] data){ return toHexString(data,0,data.length); }
Converts the specified data to hex string.
public jMatrix(int m,int n){ this.m=m; this.n=n; A=new double[m][n]; }
Construct an m-by-n matrix of zeros.
public void invite(Player player,Player targetPlayer){ openInvites.put(targetPlayer.getName(),Long.valueOf(System.currentTimeMillis())); targetPlayer.addEvent(new GroupInviteEvent(player.getName(),false)); targetPlayer.notifyWorldAboutChanges(); }
invites a player to join this group.
private void migrateBlockVolumes(){ log.info("Migrating BlockConsistencyGroup references on Volume objects."); DbClient dbClient=getDbClient(); List<URI> volumeURIs=dbClient.queryByType(Volume.class,false); Iterator<Volume> volumes=dbClient.queryIterativeObjects(Volume.class,volumeURIs,true); List<BlockObject> blockObjects=new ArrayList<BlockObject>(); while (volumes.hasNext()) { blockObjects.add(volumes.next()); } migrateBlockObjects(blockObjects); }
Update the Volume object to migrate the old consistencyGroups field into the new consistencyGroup list field.
JavaFile brewClassDataFile(){ CodeBlock.Builder staticBlockBuilder=CodeBlock.builder(); String addRealNameStmt="realNames.add($S)"; staticBlockBuilder.add("// Add all real names of classes.\n"); for ( String realName : realClassNames) staticBlockBuilder.addStatement(addRealNameStmt,realName); String addQueryableNameStmt="queryable.add($S)"; staticBlockBuilder.add("// Add names of classes annotated with @Queryable.\n"); for ( String queryableName : queryable) staticBlockBuilder.addStatement(addQueryableNameStmt,queryableName); String addClassStmt="classMap.put($S, $T.class)"; staticBlockBuilder.add("// Add class objects.\n"); for ( Map.Entry<String,ClassName> entry : classMap.entrySet()) staticBlockBuilder.addStatement(addClassStmt,entry.getKey(),entry.getValue()); String addVisibleNameStmt="visibleNames.put($S, $S)"; staticBlockBuilder.add("// Add visible names.\n"); for ( Map.Entry<String,String> entry : visibleNames.entrySet()) staticBlockBuilder.addStatement(addVisibleNameStmt,entry.getKey(),entry.getValue()); String addFieldDataStmt="fieldData.put($S, new $T())"; staticBlockBuilder.add("// Add field data classes.\n"); for ( Map.Entry<String,FieldDataBuilder> entry : fieldData.entrySet()) staticBlockBuilder.addStatement(addFieldDataStmt,entry.getKey(),entry.getValue().getClassName()); CodeBlock staticBlock=staticBlockBuilder.build(); TypeSpec clazz=TypeSpec.classBuilder(C.GEN_CLASS_DATA_CLASS_NAME).superclass(TypeNames.CLASS_DATA).addModifiers(Modifier.FINAL).addStaticBlock(staticBlock).build(); messager.printMessage(Diagnostic.Kind.NOTE,"Creating " + C.GEN_CLASS_DATA_CLASS_NAME); return JavaFile.builder(C.GEN_PKG,clazz).addFileComment(C.GEN_CODE_FILE_COMMENT).build(); }
Build the JavaFile object which will create the "Ruqus$$RuqusClassData.java" file.
private void addWebsphereDescriptor() throws IOException, JDOMException { InputStream in=null; try { in=getResource("WEB-INF/ibm-web-bnd.xmi"); if (in != null) { IbmWebBndXmi descr=IbmWebBndXmiIo.parseIbmWebBndXmi(in); if (descr != null) { this.webXml.addVendorDescriptor(descr); } } } finally { if (in != null) { in.close(); } } }
Associates the webXml with a ibm-web-bnd.xmi, if one is present in the war.
public void openCamera(Activity activity,String path){ openCamera(activity,path,"IMG_" + System.currentTimeMillis() + ".jpg"); }
Open camera
private void initialize(){ cardLayout=new CardLayout(); this.setLayout(cardLayout); this.setName("AlertView"); if (!editable) { this.add(getDefaultPane(),getDefaultPane().getName()); } this.add(getAlertPane(),getAlertPane().getName()); }
This method initializes this
public static synchronized TypeReference findOrCreateInternal(ClassLoader cl,Atom tn){ TypeReference key=new TypeReference(cl,tn,nextId); TypeReference val=dictionary.get(key); if (val == null) { val=key; nextId++; int column=val.id >> LOG_ROW_SIZE; if (column == types.length) { TypeReference[][] tmp=new TypeReference[column + 1][]; for (int i=0; i < column; i++) { tmp[i]=types[i]; } types=tmp; types[column]=new TypeReference[1 << LOG_ROW_SIZE]; } types[column][val.id & ROW_MASK]=val; dictionary.add(val); } return val; }
Find or create the canonical TypeReference instance for the given pair without type descriptor parsing.
public TomcatManager(URL url,String username){ this(url,username,""); }
Creates a Tomcat manager wrapper for the specified URL and username that uses an empty password and ISO-8859-1 URL encoding.
public void addCandle(Candle candle){ this.candles.add(candle); }
Method addCandle.
public void addTarget(IStreamTarget<T> target) throws AdeFlowException { if (m_targets.contains(target)) { throw new AdeFlowException(target + " has already been added as a target!"); } m_targets.add(target); }
Add a target for this object that will receive objects of type T once they are generated.
public void addToken(char[] array,int start,int end,int tokenType,int startOffset,boolean hyperlink){ super.addToken(array,start,end,tokenType,startOffset,hyperlink); zzStartRead=zzMarkedPos; }
Adds the token specified to the current linked list of tokens.
public static _Fields findByThriftId(int fieldId){ switch (fieldId) { case 1: return VERSIONS; case 2: return TIMESTAMP; default : return null; } }
Find the _Fields constant that matches fieldId, or null if its not found.
public T recycle(View root){ this.root=root; this.view=root; reset(); this.context=null; return self(); }
Recycle this AQuery object. The method is designed to avoid recreating an AQuery object repeatedly, such as when in list adapter getView method.
public BufferedScanner(Scanner usedScanner) throws IllegalArgumentException { if (usedScanner == null) throw new IllegalArgumentException("The Scanner passed to BufferedScanner may not be null!"); fScanner=usedScanner; fTokenQueue=new LinkedList<ScannerToken<? extends Object>>(); }
create a BufferedScanner as decorator for a Scanner in CUP2.
private static boolean mightCombineWithDecimalPoint(String token){ char last=token.charAt(token.length() - 1); return ('0' <= last && last <= '9') && !ParserBase.isJavascriptIdentifier(token.substring(0,1)); }
True if a dot adjacent to this token might be treated as a decimal point instead of a dot operator. Matches 1, 1.2, 1e3, .5, .5e-2, etc. but not foo1 or all hex literals 0xabcd.
public void initUIEvent(String typeArg,boolean canBubbleArg,boolean cancelableArg,AbstractView viewArg,int detailArg){ initEvent(typeArg,canBubbleArg,cancelableArg); this.view=viewArg; this.detail=detailArg; }
DOM: The <code>initUIEvent</code> method is used to initialize the value of a <code>UIEvent</code> created through the <code>DocumentEvent</code> interface. This method may only be called before the <code>UIEvent</code> has been dispatched via the <code>dispatchEvent</code> method, though it may be called multiple times during that phase if necessary. If called multiple times, the final invocation takes precedence.
public boolean hasMatches(String type){ if (hasMatchCache.containsKey(type)) { return hasMatchCache.get(type); } EntryType entryType=EntryType.valueOf(type); if (entryType == null) { throw new IllegalArgumentException("The argument to hasMatches MUST be the name of a member of the uk.ac.ebi.interpro.scan.web.model.EntryType enum."); } for ( final SimpleEntry entry : entries) { if (entryType == entry.getType()) { hasMatchCache.put(type,true); return true; } } hasMatchCache.put(type,false); return false; }
USED BY FREEMARKER - DON'T DELETE <p/> Method to return an HTML attribute class="disabled" if there is no match to an Entry of the specified type.
private void addRandomPoint(final int width,final int height){ Point location=geometryFactory.createPoint(new Coordinate(random.nextInt(width),random.nextInt(height))); objects.addGeometry(new MasonGeometry(location)); }
Add a random point to the objects layer
@Override public void invalidateLayout(Container target){ }
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
public CudaException(String message){ super(message); }
Creates a new CudaException with the given error message.
public MethodRefConstant(ConstantPool pool,int index,int classIndex,int nameAndTypeIndex){ super(pool,index); _classIndex=classIndex; _nameAndTypeIndex=nameAndTypeIndex; }
Creates a new field ref constant.
public final double trace(){ int i, l; double t; if (nRow < nCol) { l=nRow; } else { l=nCol; } t=0.0; for (i=0; i < l; i++) { t+=values[i][i]; } return t; }
Returns the trace of this matrix.
final public SyntaxTreeNode Recursive() throws ParseException { SyntaxTreeNode tn, sn[]; Token t; bpa("Recursive"); expecting="RECURSIVE"; t=jj_consume_token(RECURSIVE); addHeir(new SyntaxTreeNode(mn,t)); expecting="Identifier, operator or _"; tn=ConstantDeclarationItems(); addHeir(tn); expecting=","; label_6: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default : jj_la1[15]=jj_gen; break label_6; } t=jj_consume_token(COMMA); addHeir(new SyntaxTreeNode(mn,t)); expecting="Identifier, operator or _"; tn=ConstantDeclarationItems(); addHeir(tn); expecting="`,' or `)'"; } sn=getLastHeirs(); epa(); { if (true) return new SyntaxTreeNode(mn,N_Recursive,sn); } throw new Error("Missing return statement in function"); }
Recursive ::= <CONSTANT> ConstantDeclarationItems ( <COMMA> ConstantDeclarationItems )* * Produces an N_Recursive node.
public void fullyConnect(Endpoint endpoint){ throw new UnsupportedOperationException(); }
Removes all edges from the graph and fully connects it using #-# edges, where # is the given endpoint.
public boolean[][] fillIn(int[] order,boolean[][] bAdjacencyMatrix){ int nNodes=bAdjacencyMatrix.length; int[] inverseOrder=new int[nNodes]; for (int iNode=0; iNode < nNodes; iNode++) { inverseOrder[order[iNode]]=iNode; } for (int i=nNodes - 1; i >= 0; i--) { int iNode=order[i]; for (int j=0; j < i; j++) { int iNode2=order[j]; if (bAdjacencyMatrix[iNode][iNode2]) { for (int k=j + 1; k < i; k++) { int iNode3=order[k]; if (bAdjacencyMatrix[iNode][iNode3]) { if (m_debug && (!bAdjacencyMatrix[iNode2][iNode3] || !bAdjacencyMatrix[iNode3][iNode2])) { System.out.println("Fill in " + iNode2 + "--"+ iNode3); } bAdjacencyMatrix[iNode2][iNode3]=true; bAdjacencyMatrix[iNode3][iNode2]=true; } } } } } return bAdjacencyMatrix; }
Apply Tarjan and Yannakakis (1984) fill in algorithm for graph triangulation. In reverse order, insert edges between any non-adjacent neighbors that are lower numbered in the ordering. Side effect: input matrix is used as output
public boolean isSetStore(){ return this.store != null; }
Returns true if field store is set (has been assigned a value) and false otherwise
@Override public Instances generateExamples() throws Exception { getGenerator().setOptions(getGenerator().getOptions()); getGenerator().generateRandomNetwork(); getGenerator().generateInstances(); getGenerator().m_Instances.renameAttribute(0,"class"); getGenerator().m_Instances.setRelationName(getRelationNameToUse()); return getGenerator().m_Instances; }
Generates all examples of the dataset. Re-initializes the random number generator with the given seed, before generating instances.
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:11.658 -0500",hash_original_method="A55E654199D420BD447FD45C56E388DE",hash_generated_method="04E26C740CBB268443E88B1C4173063B") @Override public final boolean equals(Object socketAddr){ if (this == socketAddr) { return true; } if (!(socketAddr instanceof InetSocketAddress)) { return false; } InetSocketAddress iSockAddr=(InetSocketAddress)socketAddr; if (port != iSockAddr.port) { return false; } if ((addr == null) && (iSockAddr.addr == null)) { return hostname.equals(iSockAddr.hostname); } if (addr == null) { return false; } return addr.equals(iSockAddr.addr); }
Compares two socket endpoints and returns true if they are equal. Two socket endpoints are equal if the IP address or the hostname of both are equal and they are bound to the same port.
@Override public void run(){ amIActive=true; String inputHeader=null; String outputHeader=null; int row, col; float progress=0; double z, z2, zMin; int x, y, a, b, i; double h=0; int whichCell; double infVal=9999999; int[] dX=new int[]{-1,-1,0,1,1,1,0,-1}; int[] dY=new int[]{0,-1,-1,-1,0,1,1,1}; int[] Gx=new int[]{1,1,0,1,1,1,0,1}; int[] Gy=new int[]{0,1,1,1,0,1,1,1}; double gridRes; double bufferSize=1; boolean bufferInGridCells=false; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } for (i=0; i < args.length; i++) { if (i == 0) { inputHeader=args[i]; } else if (i == 1) { outputHeader=args[i]; } else if (i == 2) { bufferSize=Double.parseDouble(args[i]); } else if (i == 3) { if (args[i].toLowerCase().contains("cells")) { bufferInGridCells=true; } } } if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { WhiteboxRaster image=new WhiteboxRaster(inputHeader,"r"); int rows=image.getNumberRows(); int cols=image.getNumberColumns(); double noData=image.getNoDataValue(); gridRes=(image.getCellSizeX() + image.getCellSizeY()) / 2; WhiteboxRaster outputImage=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,infVal); outputImage.setPreferredPalette(image.getPreferredPalette()); WhiteboxRaster allocation=new WhiteboxRaster(outputHeader.replace(".dep","_temp1.dep"),"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,infVal); allocation.isTemporaryFile=true; WhiteboxRaster Rx=new WhiteboxRaster(outputHeader.replace(".dep","_temp2.dep"),"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,0); Rx.isTemporaryFile=true; WhiteboxRaster Ry=new WhiteboxRaster(outputHeader.replace(".dep","_temp3.dep"),"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,0); Ry.isTemporaryFile=true; double[] data; for (row=0; row < rows; row++) { data=image.getRowValues(row); for (col=0; col < cols; col++) { if (data[col] != 0) { outputImage.setValue(row,col,0); allocation.setValue(row,col,data[col]); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=outputImage.getValue(row,col); if (z != 0) { zMin=infVal; whichCell=-1; for (i=0; i <= 3; i++) { x=col + dX[i]; y=row + dY[i]; z2=outputImage.getValue(y,x); if (z2 != noData) { switch (i) { case 0: h=2 * Rx.getValue(y,x) + 1; break; case 1: h=2 * (Rx.getValue(y,x) + Ry.getValue(y,x) + 1); break; case 2: h=2 * Ry.getValue(y,x) + 1; break; case 3: h=2 * (Rx.getValue(y,x) + Ry.getValue(y,x) + 1); break; } z2+=h; if (z2 < zMin) { zMin=z2; whichCell=i; } } } if (zMin < z) { outputImage.setValue(row,col,zMin); x=col + dX[whichCell]; y=row + dY[whichCell]; Rx.setValue(row,col,Rx.getValue(y,x) + Gx[whichCell]); Ry.setValue(row,col,Ry.getValue(y,x) + Gy[whichCell]); allocation.setValue(row,col,allocation.getValue(y,x)); } } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } for (row=rows - 1; row >= 0; row--) { for (col=cols - 1; col >= 0; col--) { z=outputImage.getValue(row,col); if (z != 0) { zMin=infVal; whichCell=-1; for (i=4; i <= 7; i++) { x=col + dX[i]; y=row + dY[i]; z2=outputImage.getValue(y,x); if (z2 != noData) { switch (i) { case 5: h=2 * (Rx.getValue(y,x) + Ry.getValue(y,x) + 1); break; case 4: h=2 * Rx.getValue(y,x) + 1; break; case 6: h=2 * Ry.getValue(y,x) + 1; break; case 7: h=2 * (Rx.getValue(y,x) + Ry.getValue(y,x) + 1); break; } z2+=h; if (z2 < zMin) { zMin=z2; whichCell=i; } } } if (zMin < z) { outputImage.setValue(row,col,zMin); x=col + dX[whichCell]; y=row + dY[whichCell]; Rx.setValue(row,col,Rx.getValue(y,x) + Gx[whichCell]); Ry.setValue(row,col,Ry.getValue(y,x) + Gy[whichCell]); allocation.setValue(row,col,allocation.getValue(y,x)); } } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * (rows - 1 - row) / (rows - 1)); updateProgress((int)progress); } if (bufferInGridCells) { bufferSize=bufferSize * bufferSize; } else { bufferSize=(bufferSize / gridRes) * (bufferSize / gridRes); } for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { if (image.getValue(row,col) != noData) { z=outputImage.getValue(row,col); if (z <= bufferSize) { outputImage.setValue(row,col,allocation.getValue(row,col)); } else { outputImage.setValue(row,col,0); } } else { outputImage.setValue(row,col,noData); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } outputImage.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputImage.addMetadataEntry("Created on " + new Date()); image.close(); allocation.close(); outputImage.close(); Rx.close(); Ry.close(); returnData(outputHeader); } catch (OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch (Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(),e); } finally { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
public EventType(int eventCode){ this(); this.eventCode=eventCode; }
Creates a new browser based event type.
private final void lockRoot(){ if (!U.compareAndSwapInt(this,LOCKSTATE,0,WRITER)) contendedLock(); }
Acquires write lock for tree restructuring.
public boolean simulateConnections(){ return this.simulateConnections; }
Returns true if connections should be simulated
public VisualTable(Visualization vis,String group,Schema schema,Class tupleType){ super(tupleType); init(vis,group,schema); }
Create a new VisualTable without a parent table.
public T caretDecoding(boolean enable){ caretDecoding=enable; return this_; }
Sets whether the reader will decode characters in parameter values that use circumflex accent encoding (enabled by default).
public static void restore(Context ctx){ if (isAdaptiveBacklightSupported()) { final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(ctx); final boolean enabled=prefs.getBoolean(KEY_ADAPTIVE_BACKLIGHT,true); if (!AdaptiveBacklight.setEnabled(enabled)) { Log.e(TAG,"Failed to restore adaptive backlight settings."); } else { Log.d(TAG,"Adaptive backlight settings restored."); } } }
Restore the properties associated with this preference on boot
public MediaInfo(){ }
Instantiates a new media info.
private void mergeUpdates(BSPPeer<LongWritable,FloatVectorWritable,NullWritable,NullWritable,ParameterMessage> peer) throws IOException { int numMessages=peer.getNumCurrentMessages(); boolean converge=false; if (numMessages == 0) { converge=true; return; } double avgTrainingError=0; FloatMatrix[] matricesUpdates=null; FloatMatrix[] prevMatricesUpdates=null; while (peer.getNumCurrentMessages() > 0) { ParameterMessage message=peer.getCurrentMessage(); if (matricesUpdates == null) { matricesUpdates=message.getCurMatrices(); prevMatricesUpdates=message.getPrevMatrices(); } else { LayeredNeuralNetwork.matricesAdd(matricesUpdates,message.getCurMatrices()); LayeredNeuralNetwork.matricesAdd(prevMatricesUpdates,message.getPrevMatrices()); } avgTrainingError+=message.getTrainingError(); } if (numMessages > 1) { avgTrainingError/=numMessages; for (int i=0; i < matricesUpdates.length; ++i) { matricesUpdates[i]=matricesUpdates[i].divide(numMessages); prevMatricesUpdates[i]=prevMatricesUpdates[i].divide(numMessages); } } this.inMemoryModel.updateWeightMatrices(matricesUpdates); this.inMemoryModel.setPrevWeightMatrices(prevMatricesUpdates); if (peer.getSuperstepCount() > 0 && iterations % convergenceCheckInterval == 0) { if (prevAvgTrainingError < curAvgTrainingError) { converge=true; } prevAvgTrainingError=curAvgTrainingError; LOG.info("Training error: " + curAvgTrainingError + " at "+ (iterations)+ " iteration."); curAvgTrainingError=0; } curAvgTrainingError+=avgTrainingError / convergenceCheckInterval; this.isConverge=converge; if (iterations < maxIterations) { for ( String peerName : peer.getAllPeerNames()) { ParameterMessage msg=new ParameterMessage(0,converge,this.inMemoryModel.getWeightMatrices(),this.inMemoryModel.getPrevMatricesUpdates()); if (!peer.getPeerName().equals(peerName)) peer.send(peerName,msg); } } }
Merge the updates according to the updates of the grooms.
public boolean supportsCustomEditor(){ return true; }
Indicates whether the date format can be edited in a GUI, which it can.
public ConnectionConfig(jmri.jmrix.SerialPortAdapter p){ super(p); }
Ctor for an object being created during load process; Swing init is deferred.
@SuppressWarnings("unchecked") @Override public void eSet(int featureID,Object newValue){ switch (featureID) { case UmplePackage.ANONYMOUS_INLINE_STATE_MACHINE_1__COMMENT_1: getComment_1().clear(); getComment_1().addAll((Collection<? extends Comment_>)newValue); return; case UmplePackage.ANONYMOUS_INLINE_STATE_MACHINE_1__STATE_1: getState_1().clear(); getState_1().addAll((Collection<? extends State_>)newValue); return; case UmplePackage.ANONYMOUS_INLINE_STATE_MACHINE_1__TRACE_1: getTrace_1().clear(); getTrace_1().addAll((Collection<? extends Trace_>)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static final boolean isJavaOperator(char ch){ return (ch <= '~') && (dataTable[ch] & JAVA_OPERATOR_MASK) > 0; }
Returns whether a character is a Java operator. Note that C and C++ operators are the same as Java operators.
public BrowsableEditableData(ListProvider dataprov,SaveProvider saveprov,EditorRecord ed,DirtyManager dirty){ this(new BrowsableData(dataprov,saveprov,null),ed,dirty); }
Ticket Dirty state
public static int binarySearch(char[] array,int startIndex,int endIndex,char value){ checkIndexForBinarySearch(array.length,startIndex,endIndex); int low=startIndex, mid=-1, high=endIndex - 1; while (low <= high) { mid=(low + high) >>> 1; if (value > array[mid]) { low=mid + 1; } else if (value == array[mid]) { return mid; } else { high=mid - 1; } } if (mid < 0) { int insertPoint=endIndex; for (int index=startIndex; index < endIndex; index++) { if (value < array[index]) { insertPoint=index; } } return -insertPoint - 1; } return -mid - (value < array[mid] ? 1 : 2); }
Performs a binary search for the specified element in a part of the specified sorted array.
public static Appendable format(double d,int digits,boolean scientific,boolean showZero,Appendable a) throws IOException { if (a == null) throw new IllegalArgumentException("Appendable Cannot Be Null"); if (a instanceof TextBuilder) return ((TextBuilder)a).append(d,digits,scientific,showZero); TextBuilder tb=new TextBuilder(); tb.append(d,digits,scientific,showZero); return a.append(tb); }
Formats the specified <code>double</code> value according to the specified formatting arguments.
public final static double plus(double left,double right){ return left + right; }
plus operation
public static List<HistoryDTO> transformToDto(List<History> list){ if (list == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.",Status.INTERNAL_SERVER_ERROR); } List<HistoryDTO> result=new ArrayList<HistoryDTO>(); for ( History history : list) { result.add(transformToDto(history)); } return result; }
Converts a list of history entities to DTOs.
private final void consumeExpected(String expected) throws javax.xml.transform.TransformerException { if (tokenIs(expected)) { nextToken(); } else { error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,new Object[]{expected,m_token}); throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR); } }
Consume an expected token, throwing an exception if it isn't there.
public CopyOnWriteArraySet(){ al=new CopyOnWriteArrayList<E>(); }
Creates an empty set.
public int indexOf(int data){ for (int i=0; i < size; i++) { if (array[i] == data) { return i; } } return -1; }
Searches for the first occurrence of the given argument.
private static String generateDA(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String wBit,final IOperandTreeNode rootNodeOfRegisterList){ final String startAddress=environment.getNextVariableString(); final String endAddress=environment.getNextVariableString(); final String tmpStartAddress=environment.getNextVariableString(); long baseOffset=offset; final Integer numberOfSetBits=rootNodeOfRegisterList.getChildren().size(); instructions.add(ReilHelpers.createSub(baseOffset++,dw,registerNodeValue,wd,String.valueOf((numberOfSetBits * 4)),dw,tmpStartAddress)); instructions.add(ReilHelpers.createAdd(baseOffset++,dw,tmpStartAddress,wd,String.valueOf(4),dw,startAddress)); instructions.add(ReilHelpers.createStr(baseOffset++,dw,registerNodeValue,dw,endAddress)); if (wBit.equals("2")) { instructions.add(ReilHelpers.createStr(baseOffset++,dw,tmpStartAddress,dw,registerNodeValue)); } return startAddress; }
Decrement after DA ( LDMDA || LDMFA ) || ( STMDA || STMED ) start_address = Rn - (Number_Of_Set_Bits_In(register_list) * 4) + 4 end_address = Rn if ConditionPassed(cond) and W == 1 then Rn = Rn - (Number_Of_Set_Bits_In(register_list) * 4)
private static void err(String message,Throwable t){ if (!LOGGER.isErrorEnabled()) { System.err.println(message); t.printStackTrace(); } else { LOGGER.error(message,t); } }
Method that prints error message even when shutting down (ie. LOGGER is disabled)
public void translateX(double x){ setX(getX() + x); }
Translate X by given value.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:05.789 -0500",hash_original_method="A6990485F5A51C8B42D23EBD17A2489C",hash_generated_method="2A6442F3D03BF7CBAC6B03C1CC234357") public static Bitmap decodeFileDescriptor(FileDescriptor fd,Rect outPadding,Options opts){ if (nativeIsSeekable(fd)) { Bitmap bm=nativeDecodeFileDescriptor(fd,outPadding,opts); if (bm == null && opts != null && opts.inBitmap != null) { throw new IllegalArgumentException("Problem decoding into existing bitmap"); } return finishDecode(bm,outPadding,opts); } else { FileInputStream fis=new FileInputStream(fd); try { return decodeStream(fis,outPadding,opts); } finally { try { fis.close(); } catch ( Throwable t) { } } } }
Decode a bitmap from the file descriptor. If the bitmap cannot be decoded return null. The position within the descriptor will not be changed when this returns, so the descriptor can be used again as-is.
@Override public synchronized void write(byte b[],int off,int len) throws IOException { String s=new String(b,off,len); appendMessage(s); flushTextArea(); }
Writes the messages. <p>
protected void messageReceived(){ synchronized (this) { this.receiveCount++; synchronized (this.messageReceiveSync) { this.messageReceiveSync.notifyAll(); } } }
Mark the receipt of a message from one of the consumers.
@Override public void collectStatisticsInformation(AccessProfile accessProfile) throws BaseCollectionException { try { _logger.info("Access Profile Details :" + accessProfile.toString()); _wbemClient=getCIMClient(accessProfile); initMap(accessProfile); StorageSystem storageSystem=queryStorageSystem(accessProfile); String providerVersion=getProviderVersionString(storageSystem); if (null != providerVersion) { _keyMap.put(Constants.VERSION,providerVersion); _keyMap.put(Constants.IS_NEW_SMIS_PROVIDER,isSMIS8XProvider(providerVersion)); } Namespace _ns=null; _ns=(Namespace)namespaces.getNsList().get(METERING); _logger.info("CIMClient initialized successfully"); executor.setKeyMap(_keyMap); executor.execute(_ns); _logger.info("Started Injection of Stats to Cassandra"); dumpStatRecords(); injectStats(); } catch ( Exception e) { throw new SMIPluginException(e.getMessage()); } finally { releaseResources(); } }
To-Do : Argument Changes, to accomodate ProSphere usage
@Override protected EClass eStaticClass(){ return N4JSPackage.Literals.PROPERTY_ASSIGNMENT_ANNOTATION_LIST; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static void isDN(String member,String value,boolean flag) throws ValidationException { maxLength(member,value,ADMValidator.LENGTH_DN,flag); }
Checks that the value isn't too long for a distinguished name.
boolean inSubroutine(final long id){ if ((status & Label.VISITED) != 0) { return (srcAndRefPositions[(int)(id >>> 32)] & (int)id) != 0; } return false; }
Returns true is this basic block belongs to the given subroutine.
public JsonWriter endObject() throws IOException { return close(JsonScope.EMPTY_OBJECT,JsonScope.NONEMPTY_OBJECT,"}"); }
Ends encoding the current object.
public ForumPostConfig fetch(ForumPostConfig config){ config.addCredentials(this); String xml=POST(this.url + "/check-forum-post",config.toXML()); Element root=parse(xml); if (root == null) { return null; } try { ForumPostConfig post=new ForumPostConfig(); post.parseXML(root); return post; } catch ( Exception exception) { this.exception=SDKException.parseFailure(exception); throw this.exception; } }
Fetch the forum post details for the forum post id.
public boolean hasFeedLink(){ return hasExtension(FeedLink.class); }
Returns whether it has the A feedLink element representing the feed for announcements in this page.
public Object clone(){ try { return super.clone(); } catch ( CloneNotSupportedException e) { return null; } }
Returns a shallow clone of this instance. The clone is obtained by simply calling <tt>super.clone()</tt>, thus calling the default native shallow cloning mechanism implemented by <tt>Object.clone()</tt>. No deeper cloning of any internal field is made.
@Override public void onPageScrollStateChanged(int state){ }
Called when the scroll state changes. Useful for discovering when the user begins dragging, when the pager is automatically settling to the current page, or when it is fully stopped/idle.
public boolean isLegalOutputEvent(Method inputEvent,Method outputEvent){ if (!eventBlocks.containsKey(inputEvent)) return false; for ( Method m : eventBlocks.get(inputEvent)) { if (m.isMethodCallEnabled(outputEvent)) { return true; } } return false; }
Check if the output event is a legal api method call for the input event.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
private ColtDataBox(int rows,int cols){ this.data=new TetradMatrix(rows,cols); for (int i=0; i < rows; i++) { for (int j=0; j < cols; j++) { data.set(i,j,Double.NaN); } } }
Constructs an 2D COLT array consisting entirely of missing values (Double.NaN).
private synchronized CimConnection addConnection(String smisIPAddress,String port){ CimConnection connection=null; try { connection=_connectionManager.getConnection(smisIPAddress,Integer.parseInt(port)); if (null == connection) { String smisAltId=smisIPAddress + "-" + port; List<StorageProvider> providers=CustomQueryUtility.getActiveStorageProvidersByProviderId(_dbClient,smisAltId); if (providers.isEmpty()) { _log.error("No SMISProvider found with id {}",smisAltId); return connection; } StorageProvider smisProvider=providers.get(0); final CimConnectionInfo connInfo=new CimConnectionInfo(); connInfo.setHost(smisProvider.getIPAddress()); connInfo.setPort(smisProvider.getPortNumber()); connInfo.setUser(smisProvider.getUserName()); connInfo.setPassword(smisProvider.getPassword()); connInfo.setUseSSL(smisProvider.getUseSSL()); if (smisProvider.getInterfaceType().equals(StorageProvider.InterfaceType.ibmxiv.name()) || "IBM".equals(smisProvider.getManufacturer())) { connInfo.setType(CimConstants.CIM_CONNECTION_TYPE); connInfo.setImplNS(CimConstants.DFLT_IBM_CIM_CONNECTION_IMPL_NS); } else { connInfo.setType(CimConstants.ECOM_CONNECTION_TYPE); connInfo.setImplNS(CimConstants.DFLT_CIM_CONNECTION_IMPL_NS); } connInfo.setInteropNS(CimConstants.DFLT_CIM_CONNECTION_INTEROP_NS); _connectionManager.addConnection(connInfo); connection=_connectionManager.getConnection(smisIPAddress,Integer.parseInt(port)); _log.info("Connection Added to Cache {}",ConnectionManager.generateConnectionCacheKey(smisProvider.getIPAddress(),smisProvider.getPortNumber())); } } catch ( ConnectionManagerException ex) { _log.error("Exception occurred while adding connections due to ",ex); } catch ( Exception ex) { _log.error("Exception occurred while adding connections due to ",ex); } return connection; }
If connection is null, create a new Connection
public boolean isBound(){ return isBound; }
Returns whether this server socket is bound to a local address and port or not.
public Flockers(long seed){ super(seed); }
Creates a Flockers simulation with the given random number seed.
public TDoubleDoubleHashMapDecorator(TDoubleDoubleHashMap map){ super(); this._map=map; }
Creates a wrapper that decorates the specified primitive map.
public void addTable(TableKelp tableKelp,String sql,BackupKelp backupCb){ RowCursor cursor=_metaTable.cursor(); cursor.setBytes(1,tableKelp.tableKey(),0); cursor.setString(2,tableKelp.getName()); cursor.setString(3,sql); _metaTable.put(cursor,backupCb,Result.ignore()); }
Table callbacks.
public static SegmentInfos pruneUnreferencedFiles(String segmentsFileName,Directory directory) throws IOException { final SegmentInfos si=readSegmentInfos(segmentsFileName,directory); try (Lock writeLock=directory.obtainLock(IndexWriter.WRITE_LOCK_NAME)){ int foundSegmentFiles=0; for ( final String file : directory.listAll()) { if (file.startsWith(IndexFileNames.SEGMENTS) || file.equals(IndexFileNames.OLD_SEGMENTS_GEN)) { foundSegmentFiles++; if (file.equals(si.getSegmentsFileName()) == false) { directory.deleteFile(file); } } } assert SegmentInfos.getLastCommitSegmentsFileName(directory).equals(segmentsFileName); if (foundSegmentFiles == 0) { throw new IllegalStateException("no commit found in the directory"); } } final CommitPoint cp=new CommitPoint(si,directory); try (IndexWriter writer=new IndexWriter(directory,new IndexWriterConfig(Lucene.STANDARD_ANALYZER).setIndexCommit(cp).setCommitOnClose(false).setMergePolicy(NoMergePolicy.INSTANCE).setOpenMode(IndexWriterConfig.OpenMode.APPEND))){ } return si; }
This method removes all files from the given directory that are not referenced by the given segments file. This method will open an IndexWriter and relies on index file deleter to remove all unreferenced files. Segment files that are newer than the given segments file are removed forcefully to prevent problems with IndexWriter opening a potentially broken commit point / leftover. <b>Note:</b> this method will fail if there is another IndexWriter open on the given directory. This method will also acquire a write lock from the directory while pruning unused files. This method expects an existing index in the given directory that has the given segments file.
@SuppressWarnings("unchecked") @Override public void preProcess(ResultProducer rp) throws Exception { m_RP=rp; if ((m_OutputFile == null) || (m_OutputFile.getName().equals("-"))) { m_Out=new PrintWriter(System.out,true); } else { m_Out=new PrintWriter(new BufferedOutputStream(new FileOutputStream(m_OutputFile)),true); } Object[] keyTypes=m_RP.getKeyTypes(); Object[] resultTypes=m_RP.getResultTypes(); m_AttributeTypes=new int[keyTypes.length + resultTypes.length]; m_NominalIndexes=new Hashtable[m_AttributeTypes.length]; m_NominalStrings=new ArrayList[m_AttributeTypes.length]; m_Instances=new ArrayList<Instance>(); for (int i=0; i < m_AttributeTypes.length; i++) { Object attribute=null; if (i < keyTypes.length) { attribute=keyTypes[i]; } else { attribute=resultTypes[i - keyTypes.length]; } if (attribute instanceof String) { m_AttributeTypes[i]=Attribute.NOMINAL; m_NominalIndexes[i]=new Hashtable<String,Double>(); m_NominalStrings[i]=new ArrayList<String>(); } else if (attribute instanceof Double) { m_AttributeTypes[i]=Attribute.NUMERIC; } else { throw new Exception("Unknown attribute type in column " + (i + 1)); } } }
Prepare for the results to be received.
private void useItemOnGround(final Player player,final RPAction action){ final Entity entity=EntityHelper.entityFromTargetName(action.get(TARGET),player); if (entity != null) { tryUse(player,entity); } }
Use a top level entity.
void torsoTwist(Coords twistTarget){ int direction=ce().getFacing(); if (twistTarget != null) { direction=ce().clipSecondaryFacing(ce().getPosition().direction(twistTarget)); } if (direction != ce().getSecondaryFacing()) { clearAttacks(); attacks.addElement(new TorsoTwistAction(cen,direction)); ce().setSecondaryFacing(direction); refreshAll(); } }
Torso twist in the proper direction.
@Override public boolean loadWeapon(Mounted mounted,Mounted mountedAmmo){ boolean success=false; WeaponType wtype=(WeaponType)mounted.getType(); AmmoType atype=(AmmoType)mountedAmmo.getType(); if (mounted.getLocation() != mountedAmmo.getLocation()) { return success; } Mounted bay=whichBay(getEquipmentNum(mounted)); if ((bay != null) && !bay.ammoInBay(getEquipmentNum(mountedAmmo))) { return success; } if (mountedAmmo.isAmmoUsable() && !wtype.hasFlag(WeaponType.F_ONESHOT) && (atype.getAmmoType() == wtype.getAmmoType())&& (atype.getRackSize() == wtype.getRackSize())) { mounted.setLinked(mountedAmmo); success=true; } return success; }
need to check bay location before loading ammo
public AttributeDefinitionBuilder immutable(){ this.writable=false; return this; }
Causes the generated attribute to be immutable. The <tt>value</tt> field is declared <tt>final</tt> and no setter is generated.
public void putConfig(java.lang.String key,PListObject value){ configMap.put(key,value); }
Put the config value with the given key.
protected void error(Throwable error){ doClose(); }
Override for custom error handling. By default, it closes the channel.
public Builder url(String url){ return url(HttpUrl.parse(url)); }
Sets the image url.
public String name(){ return this.name; }
The name of the repository.
public DOMReference(Element refElem,XMLCryptoContext context,Provider provider) throws MarshalException { boolean secVal=Utils.secureValidation(context); Element nextSibling=DOMUtils.getFirstChildElement(refElem); List<Transform> transforms=new ArrayList<Transform>(5); if (nextSibling.getLocalName().equals("Transforms")) { Element transformElem=DOMUtils.getFirstChildElement(nextSibling,"Transform"); transforms.add(new DOMTransform(transformElem,context,provider)); transformElem=DOMUtils.getNextSiblingElement(transformElem); while (transformElem != null) { String localName=transformElem.getLocalName(); if (!localName.equals("Transform")) { throw new MarshalException("Invalid element name: " + localName + ", expected Transform"); } transforms.add(new DOMTransform(transformElem,context,provider)); if (secVal && (transforms.size() > MAXIMUM_TRANSFORM_COUNT)) { String error="A maxiumum of " + MAXIMUM_TRANSFORM_COUNT + " "+ "transforms per Reference are allowed with secure validation"; throw new MarshalException(error); } transformElem=DOMUtils.getNextSiblingElement(transformElem); } nextSibling=DOMUtils.getNextSiblingElement(nextSibling); } if (!nextSibling.getLocalName().equals("DigestMethod")) { throw new MarshalException("Invalid element name: " + nextSibling.getLocalName() + ", expected DigestMethod"); } Element dmElem=nextSibling; this.digestMethod=DOMDigestMethod.unmarshal(dmElem); String digestMethodAlgorithm=this.digestMethod.getAlgorithm(); if (secVal && MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5.equals(digestMethodAlgorithm)) { throw new MarshalException("It is forbidden to use algorithm " + digestMethod + " when secure validation is enabled"); } Element dvElem=DOMUtils.getNextSiblingElement(dmElem,"DigestValue"); try { this.digestValue=Base64.decode(dvElem); } catch ( Base64DecodingException bde) { throw new MarshalException(bde); } if (DOMUtils.getNextSiblingElement(dvElem) != null) { throw new MarshalException("Unexpected element after DigestValue element"); } this.uri=DOMUtils.getAttributeValue(refElem,"URI"); Attr attr=refElem.getAttributeNodeNS(null,"Id"); if (attr != null) { this.id=attr.getValue(); refElem.setIdAttributeNode(attr,true); } else { this.id=null; } this.type=DOMUtils.getAttributeValue(refElem,"Type"); this.here=refElem.getAttributeNodeNS(null,"URI"); this.refElem=refElem; this.transforms=transforms; this.allTransforms=transforms; this.appliedTransformData=null; this.provider=provider; }
Creates a <code>DOMReference</code> from an element.
public static GeneralizedSemPm serializableInstance(){ Dag dag=new Dag(); GraphNode node1=new GraphNode("X"); dag.addNode(node1); return new GeneralizedSemPm(Dag.serializableInstance()); }
Generates a simple exemplar of this class to test serialization.
public void testConstrStringWithExponentWithPoint4(){ String a="23809648392384754573567356745735635678.90295784902768787678287E+21"; int aScale=2; BigInteger bA=new BigInteger("2380964839238475457356735674573563567890295784902768787678287"); BigDecimal aNumber=new BigDecimal(a); assertEquals("incorrect value",bA,aNumber.unscaledValue()); assertEquals("incorrect scale",aScale,aNumber.scale()); }
new BigDecimal(String value); value contains both exponent and decimal point
protected MimeBodyPart createAttachedOriginal(Mail originalMail,int attachmentType) throws MessagingException { MimeBodyPart part=new MimeBodyPart(); MimeMessage originalMessage=originalMail.getMessage(); if (attachmentType == HEADS) { part.setContent(getMessageHeaders(originalMessage),"text/plain"); part.setHeader("Content-Type","text/rfc822-headers"); } else { part.setContent(originalMessage,"message/rfc822"); } if ((originalMessage.getSubject() != null) && (originalMessage.getSubject().trim().length() > 0)) { part.setFileName(originalMessage.getSubject().trim()); } else { part.setFileName("No Subject"); } part.setDisposition("Attachment"); return part; }
Create a MimeBodyPart with the original Mail as Attachment
@Override public void start(){ super.start(); scenarioSimpleRoom(); peds=new ArrayList<Pedestrian>(); for ( Space s : landscape) { boolean addAll=peds.addAll(s.populate(this,initialAgentsPerFloor)); } }
Starts a new run of the simulation. Sets up the landscape and adds Pedestrians to every floor.
public void unlock(){ if (!VM.runningVM) return; Magic.sync(); Offset latestContenderOffset=Entrypoints.latestContenderField.getOffset(); RVMThread i=RVMThread.getCurrentThread(); if (!MCS_Locking) { Magic.setObjectAtOffset(this,latestContenderOffset,null); VM.enableYieldpoints(); return; } RVMThread p; do { p=Magic.objectAsThread(Magic.addressAsObject(Magic.prepareAddress(this,latestContenderOffset))); if (p == i) { if (Magic.attemptAddress(this,latestContenderOffset,Magic.objectAsAddress(p),Address.zero())) { break; } } else if (Magic.objectAsAddress(p).NE(IN_FLUX)) { if (Magic.attemptAddress(this,latestContenderOffset,Magic.objectAsAddress(p),IN_FLUX)) { break; } } else { handleMicrocontention(-1); } } while (true); if (p != i) { RVMThread q=p.contenderLink; if (p == q) { q.awaitingSpinLock=null; Magic.sync(); Magic.setObjectAtOffset(this,latestContenderOffset,q); } else { p.contenderLink=q.contenderLink; q.awaitingSpinLock=null; Magic.sync(); Magic.setObjectAtOffset(this,latestContenderOffset,p); } } VM.enableYieldpoints(); }
Release a lock.
private void requestLocationInternal(){ Log.v(TAG,ACTION_REQUEST_LOCATION); if (!Utils.checkFineLocationPermission(this)) { return; } GoogleApiClient googleApiClient=new GoogleApiClient.Builder(this).addApi(LocationServices.API).build(); ConnectionResult connectionResult=googleApiClient.blockingConnect(Constants.GOOGLE_API_CLIENT_TIMEOUT_S,TimeUnit.SECONDS); if (connectionResult.isSuccess() && googleApiClient.isConnected()) { Intent locationUpdatedIntent=new Intent(this,UtilityService.class); locationUpdatedIntent.setAction(ACTION_LOCATION_UPDATED); Location location=FusedLocationApi.getLastLocation(googleApiClient); if (location != null) { Intent lastLocationIntent=new Intent(locationUpdatedIntent); lastLocationIntent.putExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED,location); startService(lastLocationIntent); } LocationRequest mLocationRequest=new LocationRequest().setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); FusedLocationApi.requestLocationUpdates(googleApiClient,mLocationRequest,PendingIntent.getService(this,0,locationUpdatedIntent,0)); googleApiClient.disconnect(); } else { Log.e(TAG,String.format(Constants.GOOGLE_API_CLIENT_ERROR_MSG,connectionResult.getErrorCode())); } }
Called when a location update is requested
@Override @Inline protected Address allocPages(int reservedPages,int requiredPages,boolean zeroed){ if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(metaDataPagesPerRegion == 0 || requiredPages <= PAGES_IN_CHUNK - metaDataPagesPerRegion); lock(); boolean newChunk=false; int pageOffset=freeList.alloc(requiredPages); if (pageOffset == GenericFreeList.FAILURE && growable) { pageOffset=allocateContiguousChunks(requiredPages); newChunk=true; } if (pageOffset == GenericFreeList.FAILURE) { unlock(); return Address.zero(); } else { pagesCurrentlyOnFreeList-=requiredPages; if (pageOffset > highWaterMark) { if (highWaterMark == 0 || (pageOffset ^ highWaterMark) > EmbeddedMetaData.PAGES_IN_REGION) { int regions=1 + ((pageOffset - highWaterMark) >> EmbeddedMetaData.LOG_PAGES_IN_REGION); int metapages=regions * metaDataPagesPerRegion; reserved+=metapages; committed+=metapages; newChunk=true; } highWaterMark=pageOffset; } Address rtn=start.plus(Conversions.pagesToBytes(pageOffset)); Extent bytes=Conversions.pagesToBytes(requiredPages); commitPages(reservedPages,requiredPages); space.growSpace(rtn,bytes,newChunk); unlock(); HeapLayout.mmapper.ensureMapped(rtn,requiredPages); if (zeroed) VM.memory.zero(zeroNT,rtn,bytes); VM.events.tracePageAcquired(space,rtn,requiredPages); return rtn; } }
Allocate <code>pages</code> pages from this resource.<p> If the request can be satisfied, then ensure the pages are mmpapped and zeroed before returning the address of the start of the region. If the request cannot be satisfied, return zero.
public boolean visit(CompilationUnit node){ return true; }
Visits the given type-specific AST node. <p> The default implementation does nothing and return true. Subclasses may reimplement. </p>