code
stringlengths
10
174k
nl
stringlengths
3
129k
public XObject execute(XPathContext xctxt,int context,DTM dtm,int expType) throws javax.xml.transform.TransformerException { DTMIterator nl=m_functionExpr.asIterator(xctxt,context); XNumber score=SCORE_NONE; if (null != nl) { int n; while (DTM.NULL != (n=nl.nextNode())) { score=(n == context) ? SCORE_OTHER : SCORE_NONE; if (score == SCORE_OTHER) { context=n; break; } } nl.detach(); } return score; }
Test a node to see if it matches the given node test.
public void addNewarray(int atype,int length){ addIconst(length); addOpcode(NEWARRAY); add(atype); }
Appends NEWARRAY for primitive types.
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){ switch (featureID) { case N4mfPackage.TESTED_PROJECTS__TESTED_PROJECTS: return getTestedProjects(); } return super.eGet(featureID,resolve,coreType); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public boolean forEach(BooleanProcedure procedure){ boolean[] theElements=elements; int theSize=size; for (int i=0; i < theSize; ) if (!procedure.apply(theElements[i++])) return false; return true; }
Applies a procedure to each element of the receiver, if any. Starts at index 0, moving rightwards.
Name(BasicType type){ this(-1,type); }
Create a raw parameter of the given type.
public final SecretKey generateKey(){ return spiImpl.engineGenerateKey(); }
Generates a secret key.
@SuppressWarnings("TypeMayBeWeakened") public static void writeNearConfiguration(BinaryRawWriter out,NearCacheConfiguration cfg){ assert cfg != null; out.writeInt(cfg.getNearStartSize()); writeEvictionPolicy(out,cfg.getNearEvictionPolicy()); }
Reads the near config.
public Builder withSolrXml(String solrXml){ this.solrxml=solrXml; return this; }
Use the provided string as solr.xml content
public void store(float value,Offset offset){ }
Stores the float value in the memory location pointed to by the current instance.
public void updateSizes(int size){ if (size == LARGE) { setSizeParameters(CIRCLE_DIAMETER_LARGE,CIRCLE_DIAMETER_LARGE,CENTER_RADIUS_LARGE,STROKE_WIDTH_LARGE,ARROW_WIDTH_LARGE,ARROW_HEIGHT_LARGE); } else { setSizeParameters(CIRCLE_DIAMETER,CIRCLE_DIAMETER,CENTER_RADIUS,STROKE_WIDTH,ARROW_WIDTH,ARROW_HEIGHT); } }
Set the overall size for the progress spinner. This updates the radius and stroke width of the ring.
public String newSessionId(){ byte[] b=new byte[32]; random.nextBytes(b); return HexUtil.conventBytesToHexString(b); }
Generate new session id. Max 64 char.
public void assertArrayEqual(Object[] expected,Object[] actual){ TestUtils.assertArrayEqual(expected,actual); }
This method just invokes the test utils method, it is here for convenience
public static void main(String[] args) throws Exception { if (args.length != 1) { throw new IllegalArgumentException("Please supply one argument, file name of the validated ocsp fetch interval parameters xml."); } new OcspFetchIntervalSchemaValidator().validateFile(args[0]); }
Program entry point
public boolean add(E e){ return offer(e); }
Inserts the specified element into this priority queue.
private table printDescription(int activeNode,MWorkflow wf,MWFNode[] nodes,ArrayList nodes_ID){ table desTable=new table(); String WFName=""; String WFDescription=""; if (activeNode < 0) { WFName=wf.getName(); WFDescription=wf.getHelp(); } else { WFName=nodes[getIndex(activeNode,nodes_ID)].getName(); WFDescription=nodes[getIndex(activeNode,nodes_ID)].getHelp(); } tr aRow=new tr(); td aGrid=new td(); aGrid.addElement(new h6(WFName)); aGrid.addElement(new br()); aGrid.addElement(WFDescription); desTable.addElement(aRow.addElement(aGrid)); return desTable; }
Print the description for a workflow or a node.
@Override public void addPages(){ page=new NewFileSystemPage(getSelection()); addPage(page); }
Adding the page to the wizard.
public Object runSafely(Catbert.FastStack stack) throws Exception { Widget w=getWidget(stack); return (w != null) ? w.contents() : null; }
Gets the list of Widgets that are children of the specified Widget. The ordering of this list does have an effect.
ParseState parsePipleline(BashPsiBuilder builder){ if (!Parsing.command.parse(builder)) { return ParseState.ERROR; } boolean withPipeline=pipeTokens.contains(builder.getTokenType()); if (!withPipeline) { return ParseState.OK_NO_PIPELINE; } boolean result=true; while (result && pipeTokens.contains(builder.getTokenType())) { builder.advanceLexer(); builder.eatOptionalNewlines(); result=Parsing.command.parse(builder); } if (!result) { return ParseState.ERROR; } return ParseState.OK_PIPELINE; }
Parses a pipeline command. Marks if at least one pipeline is found. Does NOT mark if just one command or an error has been found.
public void startUpdate(){ myFilesWaitingForRevision.push(ContainerUtil.<Pair<String,String>>newArrayList()); }
Same UpdateEventHandler instance could be used to update several roots - for instance, when updating whole project that contains multiple working copies => so this method explicitly indicates when update of new root is started (to correctly collect updated files). <p/> Still UPDATE_NONE (which is currently fired by command line and by SVNKit for 1.6 and below working copies - and is just skipped by UpdateEventHandler) or UPDATE_STARTED (which is currently fired by SVNKit for 1.7 working copies) events should be considered for such purposes, especially if further we want to support commands like "svn update <folder1> <folder2>". <p/> TODO: Check if UPDATE_NONE is fired in some other cases by SVNKit. <p/> TODO: Currently for command line UPDATE_NONE event could be fired several times for the same folder - as "svn update" output is TODO: processed line by line, "Updating '.'" line (which results in firing UPDATE_NONE) is printed before auth request and then TODO: the command could be repeated with new credentials. This case should also be handled if we want to rely on UPDATE_NONE or TODO: UPDATE_STARTED event in some code paths.
public static PriceSource newInstance(Integer value){ final PriceSource returnInstance=new PriceSource(); returnInstance.setValue(value); return returnInstance; }
Method newInstance.
public ScatterGraph(int height,int width,Vector sites,float minyear,float maxyear,float mintemp,float maxtemp){ initialize(height,width,0,0,sites,minyear,maxyear,mintemp,maxtemp); }
Set up the size of the graph, and scale all the axes correctly.
public static double bachelierBlackFormula(final Option.Type optionType,@Real final double strike,@Real final double forward,@StdDev final double stddev){ return bachelierBlackFormula(optionType,strike,forward,stddev,1.0); }
Black style formula when forward is normal rather than log-normal. This is essentially the model of Bachelier.
@Override public boolean equals(Object obj){ if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CarbonMeasure)) { return false; } CarbonMeasure other=(CarbonMeasure)obj; if (columnSchema == null) { if (other.columnSchema != null) { return false; } } else if (!columnSchema.equals(other.columnSchema)) { return false; } return true; }
to check whether to dimension are equal or not
public static boolean canDeleteUnManagedVolume(UnManagedVolume unManagedVolume){ boolean canDelete=null == unManagedVolume.getUnmanagedExportMasks() || unManagedVolume.getUnmanagedExportMasks().isEmpty(); if (!canDelete) { _logger.info("cannot delete unmanaged volume {} because these unmanaged export masks are remaining to be ingested: {}",unManagedVolume.forDisplay(),unManagedVolume.getUnmanagedExportMasks()); } return canDelete; }
Validates if the given UnManagedVolume can be deleted safely.
public static void uncheckedClose(Reader reader,boolean rethrowAsUnchecked){ try { reader.close(); } catch ( IOException e) { if (rethrowAsUnchecked) throw melnorme.utilbox.core.ExceptionAdapter.unchecked(e); } }
Closes given reader, either ignoring IOExceptions, or rethrowing them unchecked, according to given rethrowAsUnchecked.
public synchronized void flush() throws IOException { checkNotClosed(); trimToSize(); trimToFileCount(); journalWriter.flush(); }
Force buffered operations to the filesystem.
protected void checkAntVersion(Hashtable h){ if (null == h) h=new Hashtable(); try { final String ANT_VERSION_CLASS="org.apache.tools.ant.Main"; final String ANT_VERSION_METHOD="getAntVersion"; final Class noArgs[]=new Class[0]; Class clazz=ObjectFactory.findProviderClass(ANT_VERSION_CLASS,ObjectFactory.findClassLoader(),true); Method method=clazz.getMethod(ANT_VERSION_METHOD,noArgs); Object returnValue=method.invoke(null,new Object[0]); h.put(VERSION + "ant",(String)returnValue); } catch ( Exception e) { h.put(VERSION + "ant",CLASS_NOTPRESENT); } }
Report product version information from Ant.
public static int unionSize(long x,long y){ return Long.bitCount(x | y); }
Compute the union size of two Bitsets.
@ApiOperation(value="Login",notes="Login to a Codenvy account. Either auth token or cookie are used",response=Token.class,position=2) @ApiResponses(value={@ApiResponse(code=200,message="OK"),@ApiResponse(code=400,message="Authentication error")}) @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/login") public Response authenticate(Credentials credentials,@ApiParam(value="Existing auth cookie. It is used to get deleted to a obtain new cookie") @CookieParam("session-access-key") Cookie tokenAccessCookie,@Context UriInfo uriInfo) throws AuthenticationException { return dao.login(credentials,tokenAccessCookie,uriInfo); }
Get token to be able to call secure api methods.
public int size(){ if (columns == null) return 0; else return columns.size(); }
Returns the number of columns in the key.
public static @Nullable Pair<Integer,Integer> decodeDimensions(InputStream is){ Preconditions.checkNotNull(is); ByteBuffer byteBuffer=DECODE_BUFFERS.acquire(); if (byteBuffer == null) { byteBuffer=ByteBuffer.allocate(DECODE_BUFFER_SIZE); } BitmapFactory.Options options=new BitmapFactory.Options(); options.inJustDecodeBounds=true; try { options.inTempStorage=byteBuffer.array(); BitmapFactory.decodeStream(is,null,options); return (options.outWidth == -1 || options.outHeight == -1) ? null : new Pair(options.outWidth,options.outHeight); } finally { DECODE_BUFFERS.release(byteBuffer); } }
Decodes only the bounds of an image and returns its width and height or null if the size can't be determined
public static Argument createArgument(Model model,Property argProperty,Resource argType,boolean optional){ Argument a=model.createResource(SPL.Argument).as(Argument.class); if (argProperty != null) { a.addProperty(SPL.predicate,argProperty); } if (argType != null) { a.addProperty(SPL.valueType,argType); } if (optional) { a.addProperty(SPL.optional,model.createTypedLiteral(true)); } return a; }
Creates an spl:Argument with a given property and value type. The new Argument resource will be a blank node in a given Model.
public static void compress(int format,Resource source,Resource target,boolean includeBaseFolder,int mode) throws IOException { if (format == FORMAT_GZIP) compressGZip(source,target); else if (format == FORMAT_BZIP2) compressBZip2(source,target); else { Resource[] sources=(!includeBaseFolder && source.isDirectory()) ? source.listResources() : new Resource[]{source}; compress(format,sources,target,mode); } }
compress data to a zip file
public boolean isTraining(){ return isTraining; }
Checks if is training.
public void add(String key,Tool item){ add(key,item,-1); }
Add an item to the tool bar.
public LinearInterpolator(long[] timestamps,double[] values){ this.timestamps=timestamps; this.values=values; validate(); }
Creates LinearInterpolator from arrays of timestamps and corresponding datasource values.
public void updateClassifier(Instance instance) throws Exception { if (!learningphase) { return; } int num_classes=(int)(0.5 * numClasses); int num_features=(int)(0.5 * numFeatures); double[] data=new double[numFeatures]; double[] labels=new double[numClasses]; int numChanges=0; int numCategories_1=numCategories - 1; numinstancestr+=1; if (!instance.classIsMissing()) { double suminputA=0; double suminputB=0; for (int j=0; j < num_features; j++) { data[j]=instance.value(num_classes + j); data[j + num_features]=1 - data[j]; suminputA+=data[j] + data[j + num_features]; } for (int j=0; j < num_classes; j++) { labels[j]=instance.value(j); labels[j + num_classes]=1 - labels[j]; suminputB+=labels[j] + labels[j + num_classes]; } SortPair2[] cateacti=ARTActivateCategories(data,labels); java.util.Arrays.sort(cateacti); boolean resonance=false; int currentSortedIndex=0; int currentCategory=-1; double matchA=0; double matchB=0; while (!resonance && currentSortedIndex < cateacti.length) { currentCategory=cateacti[currentSortedIndex].getOriginalIndex(); if (currentCategory == numCategories_1) { matchA=1; } else { matchA=cateacti[currentSortedIndex].getRawValue() / suminputA; } if (matchA >= roa) { if (currentCategory == numCategories_1) { if (currentSortedIndex == maxNumCategories) { System.out.println("WARNING: The maximum number of categories has been reached."); resonance=true; } else { sweightsA[currentCategory]=0; for (int j=0; j < data.length; j++) { weightsA[currentCategory][j]=data[j]; sweightsA[currentCategory]+=data[j]; } for (int j=0; j < weightsB[currentCategory].length; j++) { weightsB[currentCategory][j]=labels[j]; } String s=Arrays.toString(labels); if (hmclasses.containsKey(s)) { hmclasses.get(s).add(currentCategory); hmclasses.put(s,hmclasses.get(s)); } else { Vector v=new Vector(); v.add(currentCategory); hmclasses.put(s,v); } ARAMm_Add_New_Category(); numChanges=numChanges + 1; resonance=true; break; } } else { double weightChange=ARAMm_Update_Weights(data,labels,currentCategory); if (weightChange == 1) { numChanges+=1; } resonance=true; break; } } else { currentSortedIndex+=1; resonance=false; } } if (!resonance && currentSortedIndex >= cateacti.length) { sweightsA[numCategories_1]=0; for (int j=0; j < data.length; j++) { weightsA[numCategories_1][j]=data[j]; sweightsA[numCategories_1]+=data[j]; } for (int j=0; j < weightsB[numCategories_1].length; j++) { weightsB[numCategories_1][j]=labels[j]; } String s=Arrays.toString(labels); if (hmclasses.containsKey(s)) { hmclasses.get(s).add(numCategories_1); hmclasses.put(s,hmclasses.get(s)); } else { Vector v=new Vector(); v.add(numCategories_1); hmclasses.put(s,v); } ARAMm_Add_New_Category(); numChanges=numChanges + 1; } } }
Updates the classifier with the given instance.
private void putAndDestroy(){ region.put(new Integer(1),new Integer(1)); try { region.destroy(new Integer(1)); } catch ( Exception e) { logWriter.error("Exception occurred",e); fail(" failed to destory Integer"); } }
do a put followed by a destroy on the same entry
protected void emit_FunctionTypeExpressionOLD_PrimaryTypeExpression_LeftParenthesisKeyword_0_0_0_1_or___LeftCurlyBracketKeyword_1_FunctionKeyword_3_LeftParenthesisKeyword_5__(EObject semanticObject,ISynNavigable transition,List<INode> nodes){ acceptNodes(transition,nodes); }
Ambiguous syntax: ('{' 'function' '(') | '(' This ambiguous syntax occurs at: (rule start) '('* (ambiguity) fpars+=TAnonymousFormalParameter
public boolean isSingleThreaded(){ return singleThreaded; }
Checks if is single threaded.
public ObjectMatrix1D like1D(int size){ return new DenseObjectMatrix1D(size); }
Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. For example, if the receiver is an instance of type <tt>DenseObjectMatrix2D</tt> the new matrix must be of type <tt>DenseObjectMatrix1D</tt>, if the receiver is an instance of type <tt>SparseObjectMatrix2D</tt> the new matrix must be of type <tt>SparseObjectMatrix1D</tt>, etc.
private void visit(NodeItem n,NodeItem c,int doi,int ldist){ PrefuseLib.updateVisible(n,true); double localDOI=-ldist / Math.min(1000.0,m_divisor); n.setDOI(doi + localDOI); if (c != null) { EdgeItem e=(EdgeItem)c.getParentEdge(); e.setDOI(c.getDOI()); PrefuseLib.updateVisible(e,true); } }
Visit a specific node and update its degree-of-interest.
public boolean isWorkflowInterception(){ return this.getStateMachineDef() != null; }
This is used to determine if the LocalContext had been called before to register a new Workflow (which would happen as part of Workflow interception). If the current thread has not been called by the <code>WorkflowInterceptor</code> then it is being called by the client runtime to execute actual user code.
public static HashMap<String,String> loadHashMapFromFile(Context context,String fileName){ String filePath=context.getFilesDir().getPath() + "/" + fileName; File f=new File(filePath); try { if (f.exists()) { ObjectInputStream objISt=new ObjectInputStream(new FileInputStream(f)); HashMap<String,String> h=(HashMap<String,String>)objISt.readObject(); objISt.close(); System.out.println(h.get("c")); return h; } else { System.out.println("FILE DOESNOT EXIST !!"); } } catch ( IOException|ClassNotFoundException e) { e.printStackTrace(); } return new HashMap<>(1); }
Load hash map from file hash map.
@Override public void start(){ super.start(); landscape=setupLandscapeReadIn("data/elevation.txt.gz"); drops=new ArrayList<Raindrop>(); schedule.scheduleRepeating(new Raincloud()); }
Starts a new run of the simulation. Refreshes the landscape and schedules the addition of new Raindrops to the system.
static int interpretation(int[] elemInfo,int tripletIndex){ if (((tripletIndex * 3) + 2) >= elemInfo.length) { return -1; } return elemInfo[(tripletIndex * 3) + 2]; }
Extracts the SDO_ELEM_INFO interpretation value (SDO_INTERPRETATION) for a given triplet. <p> JTS valid interpretation values are: 1 for straight edges, 3 for rectangle Other interpretation value include: 2 for arcs, 4 for circles
public String backupNow(String backupFilePrefix) throws McException, IOException { _logger.debug("Backup triggered."); return Backup.backup(backupFilePrefix); }
Call this method to run immediate system backup
public void init(CipherParameters param){ if (param instanceof ParametersWithRandom) { ParametersWithRandom p=(ParametersWithRandom)param; if (!(p.getParameters() instanceof ECPublicKeyParameters)) { throw new IllegalArgumentException("ECPublicKeyParameters are required for encryption."); } this.key=(ECPublicKeyParameters)p.getParameters(); this.random=p.getRandom(); } else { if (!(param instanceof ECPublicKeyParameters)) { throw new IllegalArgumentException("ECPublicKeyParameters are required for encryption."); } this.key=(ECPublicKeyParameters)param; this.random=new SecureRandom(); } }
initialise the encryptor.
public TimeBounds(){ setTimes(Long.MAX_VALUE,Long.MIN_VALUE); }
Creates a TimeBounds object ready for times to be added to it. The starting time is set to Long.MAX_VALUE, the end time is set to Long.MIN_VALUE, so any time addition will cause start and end times to be replaced.
public InputStream fetchMountFSInfo(final Argument argument,final Map<String,Object> keyMap,int index) throws VNXFilePluginException { _logger.info("VNX File System Mount info query"); InputStream iStream=null; try { Query query=new Query(); MountQueryParams mountQueryParams=new MountQueryParams(); query.getQueryRequestChoice().add(mountQueryParams); iStream=_vnxFileInputRequestBuilder.getQueryParamPacket(mountQueryParams,false); } catch ( JAXBException jaxbException) { throw new VNXFilePluginException("Exception occurred while generating input xml for celerra system info",jaxbException.getCause()); } return iStream; }
create Mount query and returns its stream after marshalling.
public void testConstructor5(){ Phaser parent=new Phaser(); assertSame(parent,new Phaser(parent,0).getParent()); assertNull(new Phaser(null,0).getParent()); }
The parent being input into the parameter should equal the original parent when being returned
public Bitmap drawableToBitmap(Drawable drawable){ if (drawable == null) { return null; } else if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable)drawable).getBitmap(); } Bitmap bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888); Canvas canvas=new Canvas(bitmap); drawable.setBounds(0,0,canvas.getWidth(),canvas.getHeight()); drawable.draw(canvas); return bitmap; }
Convert a drawable object into a Bitmap
public boolean isSetKey(){ return this.key != null; }
Returns true if field key is set (has been assigned a value) and false otherwise
private SceneGraph createSceneGraph(final int time,Rect rect){ List<Rect> rects=new LinkedList<>(); if (OTFClientControl.getInstance().getOTFVisConfig().isScaleQuadTreeRect()) { rect=rect.scale(5.0,5.0); } SceneGraph cachedResult=this.cachedTimes.get(time); if (cachedResult != null) { Rect cachedRect=cachedResult.getRect(); if ((cachedRect == null) || cachedRect.containsOrEquals(rect)) return cachedResult; Rect intersec=rect.intersection(cachedRect); if (intersec == null) { cachedResult=null; } else { rect=rect.union(cachedRect); double r1w=cachedRect.minX - rect.minX; double r2h=cachedRect.minY - rect.minY; double r3h=rect.maxY - cachedRect.maxY; double r4w=rect.maxX - cachedRect.maxX; if (r1w > 0) rects.add(new Rect(rect.minX,rect.minY,cachedRect.minX,rect.maxY)); if (r4w > 0) rects.add(new Rect(cachedRect.maxX,rect.minY,rect.maxX,rect.maxY)); if (r2h > 0) rects.add(new Rect(cachedRect.minX,rect.minY,cachedRect.maxX,cachedRect.minY)); if (r3h > 0) rects.add(new Rect(cachedRect.minX,cachedRect.maxY,cachedRect.maxX,rect.maxY)); } } if (this.host.isLive() == false) { rect=null; cachedResult=null; } SceneGraph result; if (cachedResult == null) { result=new SceneGraph(rect); QuadTree.Rect bound2=this.host.isLive() ? rect : this.top.getBounds(); byte[] bbyte; bbyte=this.host.getQuadDynStateBuffer(bound2); ByteBuffer in=ByteBuffer.wrap(bbyte); this.execute(bound2,new ReadDataExecutor(in,false,result)); for ( OTFDataReader element : this.additionalElements) { try { element.readDynData(in,result); } catch ( IOException e) { e.printStackTrace(); } } invalidate(rect,result); } else { result=cachedResult; result.setRect(rect); for ( Rect rectPart : rects) { QuadTree.Rect bound2=this.host.isLive() ? rectPart : this.top.getBounds(); byte[] bbyte; bbyte=this.host.getQuadDynStateBuffer(bound2); ByteBuffer in=ByteBuffer.wrap(bbyte); this.execute(bound2,new ReadDataExecutor(in,false,result)); invalidate(rectPart,result); } } result.finish(); if (this.host.isLive() == false) { this.cachedTimes.put(time,result); } return result; }
I think that this requests the scene graph for a given time step and for the rectangle that is visible.
public CTagNodeComponent(final JTree projectTree,final IDatabase database,final TreeNode<CTag> tagTreeNode){ super(new BorderLayout()); Preconditions.checkNotNull(projectTree,"IE02000: Project tree argument can not be null"); Preconditions.checkNotNull(tagTreeNode,"IE02001: Tree node argument can not be null"); m_database=database; m_tagTreeNode=tagTreeNode; m_nameTextField=new CHelpSaveField(tagTreeNode.getObject().getName(),new CNameHelp()); m_descriptionField=new CHelpSavePane(tagTreeNode.getObject().getDescription(),new CDescriptionHelp()); m_childrenTagTable=new CChildTagsTable(projectTree,m_tagTreeNode,database); m_tableBorder=new TitledBorder(getBorderText()); createGui(); m_database.getContent().getViewTagManager().addListener(m_tagManagerListener); m_tagTreeNode.getObject().addListener(m_tagListener); final UpdateListener updateListener=new UpdateListener(); m_nameTextField.getDocument().addDocumentListener(updateListener); m_descriptionField.getDocument().addDocumentListener(updateListener); updateGUI(); }
Creates a new component object.
XSLTElementDef(XSLTSchema schema,String namespace,String name,String nameAlias,XSLTElementDef[] elements,XSLTAttributeDef[] attributes,XSLTElementProcessor contentHandler,Class classObject,boolean has_order,int order,boolean multiAllowed){ this(schema,namespace,name,nameAlias,elements,attributes,contentHandler,classObject,order,multiAllowed); this.m_isOrdered=has_order; }
Construct an instance of XSLTElementDef.
public static void main(String[] args){ doLoop(SillyPeds.class,args); System.exit(0); }
Main function, runs the simulation without any visualization.
public static final double sigma(double a){ return 1.0 / (1.0 + Math.exp(-a)); }
Sigmoid / Logistic function
private Bitmap createPaddedSourceImage(Uri sourceImageUri,boolean previewSize){ InputStream is=getInputStream(sourceImageUri); if (is == null) { Log.e(TAG,"Could not create input stream for image."); dismiss(); } Bitmap sourceBitmap=BitmapFactory.decodeStream(is); is=getInputStream(sourceImageUri); XMPMeta xmp=XmpUtil.extractXMPMeta(is); if (xmp != null) { int size=previewSize ? getDisplaySize() : sourceBitmap.getWidth(); sourceBitmap=createPaddedBitmap(sourceBitmap,xmp,size); } return sourceBitmap; }
From the given URI this method creates a 360/180 padded image that is ready to be made a tiny planet.
public SparseIntArray(){ this(10); }
Creates a new SparseIntArray containing no mappings.
public static void cleanup(EvolutionState state){ state.output.flush(); PrintWriter pw=new PrintWriter(System.err); state.parameters.getBoolean(new Parameter(P_PRINTUSEDPARAMETERS),null,false); state.parameters.getBoolean(new Parameter(P_PRINTACCESSEDPARAMETERS),null,false); state.parameters.getBoolean(new Parameter(P_PRINTUNUSEDPARAMETERS),null,false); state.parameters.getBoolean(new Parameter(P_PRINTUNACCESSEDPARAMETERS),null,false); state.parameters.getBoolean(new Parameter(P_PRINTALLPARAMETERS),null,false); if (state.parameters.getBoolean(new Parameter(P_PRINTUSEDPARAMETERS),null,false)) { pw.println("\n\nUsed Parameters\n===============\n"); state.parameters.listGotten(pw); } if (state.parameters.getBoolean(new Parameter(P_PRINTACCESSEDPARAMETERS),null,false)) { pw.println("\n\nAccessed Parameters\n===================\n"); state.parameters.listAccessed(pw); } if (state.parameters.getBoolean(new Parameter(P_PRINTUNUSEDPARAMETERS),null,false)) { pw.println("\n\nUnused Parameters\n" + "================= (Ignore parent.x references) \n"); state.parameters.listNotGotten(pw); } if (state.parameters.getBoolean(new Parameter(P_PRINTUNACCESSEDPARAMETERS),null,false)) { pw.println("\n\nUnaccessed Parameters\n" + "===================== (Ignore parent.x references) \n"); state.parameters.listNotAccessed(pw); } if (state.parameters.getBoolean(new Parameter(P_PRINTALLPARAMETERS),null,false)) { pw.println("\n\nAll Parameters\n==============\n"); state.parameters.list(pw,false); } pw.flush(); System.err.flush(); System.out.flush(); state.output.close(); }
Begins a fresh evolutionary run with a given state. The state should have been provided by initialize(...). The jobPrefix is added to the front of output and checkpoint filenames. If it's null, nothing is added to the front.
void decrypt(long id,int len,byte[] data,int offset){ byte[] tweak=initTweak(id), tweakEnd=tweak; int i=0; for (; i + CIPHER_BLOCK_SIZE <= len; i+=CIPHER_BLOCK_SIZE) { if (i > 0) { updateTweak(tweak); if (i + CIPHER_BLOCK_SIZE + CIPHER_BLOCK_SIZE > len && i + CIPHER_BLOCK_SIZE < len) { tweakEnd=tweak.clone(); updateTweak(tweak); } } xorTweak(data,i + offset,tweak); cipher.decrypt(data,i + offset,CIPHER_BLOCK_SIZE); xorTweak(data,i + offset,tweak); } if (i < len) { swap(data,i,i - CIPHER_BLOCK_SIZE + offset,len - i + offset); xorTweak(data,i - CIPHER_BLOCK_SIZE + offset,tweakEnd); cipher.decrypt(data,i - CIPHER_BLOCK_SIZE + offset,CIPHER_BLOCK_SIZE); xorTweak(data,i - CIPHER_BLOCK_SIZE + offset,tweakEnd); } }
Decrypt the data.
public void testBogusArguments() throws Exception { IllegalArgumentException expected=expectThrows(IllegalArgumentException.class,null); assertTrue(expected.getMessage().contains("Unknown parameters")); }
Test that bogus arguments result in exception
public static void addMapBehavior(Region mock){ Map underlyingMap=new HashMap(); when(mock.get(any())).then(null); when(mock.put(any(),any())).then(null); }
Add real map behavior to a mock region. Useful for tests where you want to mock region that just behaves like a map.
public static byte[] decode(byte[] source) throws java.io.IOException { byte[] decoded=null; decoded=decode(source,0,source.length,Base64.NO_OPTIONS); return decoded; }
Low-level access to decoding ASCII characters in the form of a byte array. <strong>Ignores GUNZIP option, if it's set.</strong> This is not generally a recommended method, although it is used internally as part of the decoding process. Special case: if len = 0, an empty array is returned. Still, if you need more speed and reduced memory footprint (and aren't gzipping), consider this method.
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
private synchronized void handleServiceConnectionError(LicenseValidator validator){ mPolicy.processServerResponse(Policy.RETRY,null); if (mPolicy.allowAccess()) { validator.getCallback().allow(Policy.RETRY); } else { validator.getCallback().dontAllow(Policy.RETRY); } }
Generates policy response for service connection errors, as a result of disconnections or timeouts.
protected SystemMember removeSystemMember(SystemMember systemMember){ return removeSystemMember(((SystemMemberImpl)systemMember).getInternalId()); }
Removes a SystemMember from this system's list of known members.
public void drawResultBitmap(Bitmap barcode){ resultBitmap=barcode; invalidate(); }
Draw a bitmap with the result points highlighted instead of the live scanning display.
@Override public int nextIndex(){ return tokenPos; }
Gets the index of the next token to return.
public void testMaxLess(){ byte aBytes[]={45,91,3,-15,35,26,3,91}; byte bBytes[]={12,56,100,-2,-76,89,45,91,3,-15,35,26,3,91}; int aSign=1; int bSign=1; byte rBytes[]={12,56,100,-2,-76,89,45,91,3,-15,35,26,3,91}; BigInteger aNumber=new BigInteger(aSign,aBytes); BigInteger bNumber=new BigInteger(bSign,bBytes); BigInteger result=aNumber.max(bNumber); byte resBytes[]=new byte[rBytes.length]; resBytes=result.toByteArray(); for (int i=0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertTrue("incorrect sign",result.signum() == 1); }
max(BigInteger val). the first is less.
public ConcurrentDisposableLazy(){ super(); }
Constructs an empty lazy object with no provider. Stored variable has to be set manually.
public String contentType(){ return contentType; }
Returns content type of object.
public NodeRegistrationResponse registerNode(final String protocol,final String remoteHost,final int servicePort,final int adminPort){ if (StringUtils.isBlank(protocol)) return new NodeRegistrationResponse("",NodeRegistrationState.MISSING_PROTOCOL,"Missing required protocol"); if (StringUtils.isBlank(remoteHost)) return new NodeRegistrationResponse("",NodeRegistrationState.MISSING_HOST,"Missing required remote host"); if (servicePort < 1) return new NodeRegistrationResponse("",NodeRegistrationState.MISSING_SERVICE_PORT,"Missing required service port"); if (adminPort < 1) return new NodeRegistrationResponse("",NodeRegistrationState.MISSING_ADMIN_PORT,"Missing required admin port"); String nodeId=null; int retries=this.numIdentifierComputationRetries; while (retries > 0) { nodeId=uuidGenerator.generate().toString(); if (!this.processingNodes.containsKey(nodeId)) break; } if (nodeId == null || this.processingNodes.containsKey(nodeId)) return new NodeRegistrationResponse("",NodeRegistrationState.NODE_ID_COMPUTATION_FAILED,"Failed to compute node identifier"); try { this.processingNodes.put(nodeId,new SPQRNodeClient(protocol,remoteHost,servicePort,adminPort,getHttpClient(nodeId))); } catch ( RequiredInputMissingException e) { return new NodeRegistrationResponse("",NodeRegistrationState.TECHNICAL_ERROR,"Failed to create spqr node client. Error: " + e.getMessage()); } return new NodeRegistrationResponse(nodeId,NodeRegistrationState.OK,""); }
Registers a new processing node living at the given host and reachable at the provided ports (admin and service).
public synchronized Label addStyle(SGR sgr){ additionalStyles.add(sgr); return this; }
Adds an additional SGR style to use when drawing the label, in case it wasn't enabled by the theme
protected boolean isTopEdge(@NonNull SpanLookup spanLookup,int position,int childCount){ int latestCheckedPosition=0; for (; latestCheckedPosition < childCount; latestCheckedPosition++) { int spanEndIndex=spanLookup.getIndex(latestCheckedPosition) + spanLookup.getSpanSize(latestCheckedPosition) - 1; if (spanEndIndex == spanLookup.getSpanCount() - 1) { break; } } return position <= latestCheckedPosition; }
Determines if the item at <code>position</code> is a top-most view
@ExceptionHandler(UserException.class) public ModelAndView handleUserException(UserException ex){ return getDisplayErrorMessageModelAndView(ex.getMessage()); }
Handle all user exceptions by returning to a general error page while displaying the exception message to the user. A "message" model is returned.
public WrappedByteBuffer putLongAt(int index,long v){ _checkForWriteAt(index,8); _buf.putLong(index,v); return this; }
Puts an eight-byte long into the buffer at the specified index.
public GenericEDNSOption(int code,byte[] data){ super(code); this.data=Record.checkByteArrayLength("option data",data,0xFFFF); }
Construct a generic EDNS option.
public ProtocolException(){ }
Constructs a new instance.
public Boolean isDigestAlgorithmsEqual(){ return digestAlgorithmsEqual; }
Gets the value of the digestAlgorithmsEqual property.
public boolean isContainsValue(){ return this.opType == OP_TYPE_CONTAINS_VALUE; }
Returns true if this operation checks whether given value is present in region.
public static boolean killServer(){ if (Cfg.getOs().equals("null")) { Logger.appendLog("[AdbUtils][E]ADB is not supported by this OS"); return false; } String[] cmd={S.getAdbBin(),"kill-server"}; return CmdUtils.runCommand(cmd) == 0; }
this will run "adb kill-server" and gets it's output returns true only if the adb exit code was 0
public void update(int index,Number value){ TimeSeriesDataItem item=(TimeSeriesDataItem)this.data.get(index); boolean iterate=false; Number oldYN=item.getValue(); if (oldYN != null) { double oldY=oldYN.doubleValue(); if (!Double.isNaN(oldY)) { iterate=oldY <= this.minY || oldY >= this.maxY; } } item.setValue(value); if (iterate) { updateMinMaxYByIteration(); } else if (value != null) { double yy=value.doubleValue(); this.minY=minIgnoreNaN(this.minY,yy); this.maxY=maxIgnoreNaN(this.maxY,yy); } fireSeriesChanged(); }
Updates (changes) the value of a data item.
public static String numberToString(final String strNumberToConvert){ if (StringUtils.contains(strNumberToConvert,".")) { throw new ApplicationRuntimeException("Can not pass decimal values"); } else { return NumberToWord.convertToWord(strNumberToConvert).replace("Rupees","").replace("Only",""); } }
Number to string.
public boolean isDelayedCapture(){ Object oo=get_Value(COLUMNNAME_IsDelayedCapture); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Delayed Capture.
public static void unselectNodes(final ZyGraph graph,final CTag tag){ unselectNodes(graph,Sets.newHashSet(tag),true); }
Unselects all nodes of a given graph that are tagged with a given tag.
public synchronized void cleanWaitTaskQueue(){ for ( ParallelTask task : waitQ) { task.setState(ParallelTaskState.COMPLETED_WITH_ERROR); task.getTaskErrorMetas().add(new TaskErrorMeta(TaskErrorType.USER_CANCELED,"NA")); logger.info("task {} removed from wait q. This task has been marked as USER CANCELED.",task.getTaskId()); } waitQ.clear(); }
Clean wait task queue.
public Outline(){ }
Constructs an empty Outline. Call one of the setter methods to make the outline valid for use with a View.
public void testEdgeNGramFilter() throws Exception { Reader reader=new StringReader("test"); TokenStream stream=whitespaceMockTokenizer(reader); stream=tokenFilterFactory("EdgeNGram").create(stream); assertTokenStreamContents(stream,new String[]{"t"}); }
Test EdgeNGramFilterFactory
private Ref impOp() throws PageException { Ref ref=eqvOp(); while (cfml.forwardIfCurrentAndNoWordAfter("imp")) { cfml.removeSpace(); ref=new Imp(ref,eqvOp()); } return ref; }
Transfomiert eine Implication (imp) Operation. <br /> EBNF:<br /> <code>eqvOp {"imp" spaces eqvOp};</code>
public void transmit(String userId,JSONObject message){ JSONObject usrMsgJson=new JSONObject(); try { usrMsgJson.put(PnRTCMessage.JSON_USERMSG,message); this.pcClient.transmitMessage(userId,usrMsgJson); } catch ( JSONException e) { e.printStackTrace(); } }
Send a custom JSONObject user message to a single peer.
public synchronized void reset(){ this.oldDataList.clear(); this.newDataList.clear(); this.lastNewData=null; this.lastOldData=null; isInvoked=false; }
Reset listener, clearing all associated state.
private boolean authenticate(byte method,InputStream in,BufferedOutputStream out) throws IOException { return authenticate(method,in,out,0L); }
Provides the authentication machanism required by the proxy.
public ActionFakeDefinition createActionFakeDefinition(){ ActionFakeDefinitionImpl actionFakeDefinition=new ActionFakeDefinitionImpl(); return actionFakeDefinition; }
<!-- begin-user-doc --> <!-- end-user-doc -->
final int inc(int i){ return (++i == items.length) ? 0 : i; }
Circularly increment i.
public double[] evaluateConstraint(double[] x){ return CocoJNI.cocoEvaluateConstraint(this.pointer,x); }
Evaluates the constraint in point x and returns the result as an array of doubles.
public JulianDate(Date date){ julian=toJulian(date); }
Constructs a julian date from a java date.
public static RasterPlotComponent open(final InputStream input,final String name,final String format){ RasterModel dataModel=(RasterModel)RasterModel.getXStream().fromXML(input); return new RasterPlotComponent(name,dataModel); }
Opens a saved raster plot.
public static String convertByte2HexString(byte b){ char u8=convertByte2Uint8(b); return Integer.toHexString(u8); }
Convert byte to Hex String