code
stringlengths
10
174k
nl
stringlengths
3
129k
ScheduledFutureTask(Callable<V> callable,long ns){ super(callable); this.time=ns; this.period=0; this.sequenceNumber=sequencer.getAndIncrement(); }
Creates a one-shot action with given nanoTime-based trigger time.
final boolean shouldMapTextChar(int value){ if (value < ASCII_MAX) return shouldMapTextChar_ASCII[value]; return get(value); }
Tell if the character argument that is from a text node has a mapping to a String, for example to map '<' to "&lt;".
public static StorageEvent parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { StorageEvent object=new StorageEvent(); int event; java.lang.String nillableValue=null; java.lang.String prefix=""; java.lang.String namespaceuri=""; try { while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type") != null) { java.lang.String fullTypeName=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type"); if (fullTypeName != null) { java.lang.String nsPrefix=null; if (fullTypeName.indexOf(":") > -1) { nsPrefix=fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix=nsPrefix == null ? "" : nsPrefix; java.lang.String type=fullTypeName.substring(fullTypeName.indexOf(":") + 1); if (!"StorageEvent".equals(type)) { java.lang.String nsUri=reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (StorageEvent)ExtensionMapper.getTypeObject(nsUri,type,reader); } } } java.util.Vector handledAttributes=new java.util.Vector(); reader.next(); java.util.ArrayList list8=new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","eventConfigType").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setEventConfigType(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","eventId").equals(reader.getName())) { java.lang.String content=reader.getElementText(); object.setEventId(org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(content)); reader.next(); } else { object.setEventId(java.lang.Long.MIN_VALUE); } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","eventObjType").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setEventObjType(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","eventTimeStamp").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setEventTimeStamp(org.apache.axis2.databinding.utils.ConverterUtil.convertToDateTime(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","eventType").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setEventType(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","messageId").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setMessageId(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","objectId").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if (!"true".equals(nillableValue) && !"1".equals(nillableValue)) { java.lang.String content=reader.getElementText(); object.setObjectId(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); } else { reader.getElementText(); } reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement() && new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","parameterList").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)) { list8.add(null); reader.next(); } else { list8.add(NameValuePair.Factory.parse(reader)); } boolean loopDone8=false; while (!loopDone8) { while (!reader.isEndElement()) { reader.next(); } reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isEndElement()) { loopDone8=true; } else { if (new javax.xml.namespace.QName("http://data.vasa.vim.vmware.com/xsd","parameterList").equals(reader.getName())) { nillableValue=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)) { list8.add(null); reader.next(); } else { list8.add(NameValuePair.Factory.parse(reader)); } } else { loopDone8=true; } } } object.setParameterList((NameValuePair[])org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(NameValuePair.class,list8)); } else { } while (!reader.isStartElement() && !reader.isEndElement()) { reader.next(); } if (reader.isStartElement()) { throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } } catch ( javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; }
static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
public ExifTag(String name,String value){ super(Namespaces.EXIF_NAMESPACE,name,null,value); this.name=name; setRequired(false); }
Construct an exif tag of &lt;ns:name&gt;value&lt;/ns:name&gt;.
public static String encodeWebSafe(byte[] source,boolean doPadding){ return encode(source,0,source.length,WEBSAFE_ALPHABET,doPadding); }
Encodes a byte array into web safe Base64 notation.
public static Optional<ReservedList> load(Key<ReservedList> key){ return get(key.getName()); }
Loads a ReservedList from its Objectify key.
public static int parseColon(String str){ final int[] multipliers={1,60,3600,86400,31536000}; String[] bits=str.split(":"); int result=0; for (int i=0; i < bits.length; i++) { String bit=bits[bits.length - (i + 1)].trim(); if (bit.length() > 0) { result+=multipliers[i] * Integer.parseInt(bit); } } return (result); }
parse time in h:m:s format to SECONDS
public TopDocs search(Document d,String indexPath) throws IOException { if (d.getField("ro-order") != null) return scoreDocs(d.getValues("ro-order")[0],DirectoryReader.open(FSDirectory.open(new File(indexPath)))); else { ImageSearcher searcher=new GenericImageSearcher(numReferenceObjectsUsed,featureClass,featureFieldName); ImageSearchHits hits=searcher.search(d,DirectoryReader.open(FSDirectory.open(new File(indexPath + "-ro")))); StringBuilder sb=new StringBuilder(numReferenceObjectsUsed * 4); for (int j=0; j < numReferenceObjectsUsed; j++) { sb.append(hits.doc(j).getValues("ro-id")[0]); sb.append(' '); } return scoreDocs(sb.toString(),DirectoryReader.open(FSDirectory.open(new File(indexPath)))); } }
Provides basic search functions ...
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.
public void balance(){ int i=0, n=length; String[] k=new String[n]; char[] v=new char[n]; Iterator iter=new Iterator(); while (iter.hasMoreElements()) { v[i]=iter.getValue(); k[i++]=iter.nextElement(); } init(); insertBalanced(k,v,0,n); }
Balance the tree for best search performance
public RequestHandle put(Context context,String url,RequestParams params,ResponseHandlerInterface responseHandler){ return put(context,url,paramsToEntity(params,responseHandler),null,responseHandler); }
Perform a HTTP PUT request and track the Android Context which initiated the request.
@Override public Object eInvoke(int operationID,EList<?> arguments) throws InvocationTargetException { switch (operationID) { case ValidationPackage.VALIDATION_MARKER___ERESOURCE: return eResource(); } return super.eInvoke(operationID,arguments); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void run(long jobsToComplete) throws AuditLogEntryException, IOException, StateUpdateException, SQLException { clearCounters(); long lastPersistedAuditLogId=0; if (startAfterAuditLogId.isPresent()) { lastPersistedAuditLogId=startAfterAuditLogId.get(); } else { LOG.debug("Fetching last persisted audit log ID"); Optional<String> lastPersistedIdString=keyValueStore.get(LAST_PERSISTED_AUDIT_LOG_ID_KEY); if (!lastPersistedIdString.isPresent()) { Optional<Long> maxId=auditLogReader.getMaxId(); lastPersistedAuditLogId=maxId.orElse(Long.valueOf(0)); LOG.warn(String.format("Since the last persisted ID was not " + "previously set, using max ID in the audit log: %s",lastPersistedAuditLogId)); } else { lastPersistedAuditLogId=Long.parseLong(lastPersistedIdString.get()); } } LOG.info("Using last persisted ID of " + lastPersistedAuditLogId); auditLogReader.setReadAfterId(lastPersistedAuditLogId); for ( PersistedJobInfo jobInfo : jobInfoStore.getRunnableFromDb()) { LOG.debug(String.format("Restoring %s to (re)run",jobInfo)); ReplicationJob job=restoreReplicationJob(jobInfo); prettyLogStart(job); jobRegistry.registerJob(job); queueJobForExecution(job); } TimeZone tz=TimeZone.getTimeZone("UTC"); DateFormat df=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); df.setTimeZone(tz); statsTracker.start(); long updateTimeForLastPersistedId=0; while (true) { if (pauseRequested) { LOG.debug("Pause requested. Sleeping..."); ReplicationUtils.sleep(pollWaitTimeMs); continue; } long completedJobs=counters.getCounter(ReplicationCounters.Type.SUCCESSFUL_TASKS) + counters.getCounter(ReplicationCounters.Type.NOT_COMPLETABLE_TASKS); if (jobsToComplete > 0 && completedJobs >= jobsToComplete) { LOG.debug(String.format("Hit the limit for the number of " + "successful jobs (%d) - returning.",jobsToComplete)); return; } if (jobExecutor.getNotDoneJobCount() > maxJobsInMemory) { LOG.debug(String.format("There are too many jobs in memory. " + "Waiting until more complete. (limit: %d)",maxJobsInMemory)); ReplicationUtils.sleep(pollWaitTimeMs); continue; } LOG.debug("Fetching the next entry from the audit log"); Optional<AuditLogEntry> auditLogEntry=auditLogReader.resilientNext(); if (!auditLogEntry.isPresent()) { LOG.debug(String.format("No more entries from the audit log. " + "Sleeping for %s ms",pollWaitTimeMs)); ReplicationUtils.sleep(pollWaitTimeMs); continue; } AuditLogEntry entry=auditLogEntry.get(); LOG.debug("Got audit log entry: " + entry); List<ReplicationJob> replicationJobs=jobFactory.createReplicationJobs(auditLogEntry.get(),replicationFilters); LOG.debug(String.format("Audit log entry id: %s converted to %s",entry.getId(),replicationJobs)); for ( ReplicationJob job : replicationJobs) { jobRegistry.registerJob(job); } if (System.currentTimeMillis() - updateTimeForLastPersistedId > 10000) { keyValueStore.resilientSet(LAST_PERSISTED_AUDIT_LOG_ID_KEY,Long.toString(entry.getId())); updateTimeForLastPersistedId=System.currentTimeMillis(); } for ( ReplicationJob replicationJob : replicationJobs) { LOG.debug("Scheduling: " + replicationJob); prettyLogStart(replicationJob); long tasksSubmittedForExecution=counters.getCounter(ReplicationCounters.Type.EXECUTION_SUBMITTED_TASKS); if (tasksSubmittedForExecution >= jobsToComplete) { LOG.warn(String.format("Not submitting %s for execution " + " due to the limit for the number of " + "jobs to execute",replicationJob)); continue; } else { queueJobForExecution(replicationJob); } } } }
Start reading the audit log and replicate entries.
public Boolean isMemoryReservationLockSupported(){ return memoryReservationLockSupported; }
Gets the value of the memoryReservationLockSupported property.
@DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-03-24 16:05:57.040 -0400",hash_original_method="2FE3DF2A181D04B622B627D661DD5F8F",hash_generated_method="F19E4AF2315240F3614DF3012C7D3968") public GraphEnvironment(){ super(null); }
Create a new GraphEnvironment with default components.
@Override protected void register(ContainerFactory containerFactory){ containerFactory.registerContainer("jonas4x",ContainerType.REMOTE,Jonas4xRemoteContainer.class); containerFactory.registerContainer("jonas4x",ContainerType.INSTALLED,Jonas4xInstalledLocalContainer.class); containerFactory.registerContainer("jonas5x",ContainerType.REMOTE,Jonas5xRemoteContainer.class); containerFactory.registerContainer("jonas5x",ContainerType.INSTALLED,Jonas5xInstalledLocalContainer.class); }
Register container.
public DTMIterator createDTMIterator(int node){ DTMIterator iter=new org.apache.xpath.axes.OneStepIteratorForward(Axis.SELF); iter.setRoot(node,this); return iter; }
Create a new <code>DTMIterator</code> that holds exactly one node.
@Override public void eUnset(int featureID){ switch (featureID) { case OrientedPackage.COMPONENT__INPUT_COMPONET_REFS: getInputComponetRefs().clear(); return; case OrientedPackage.COMPONENT__OUTPUT_COMPONET_REFS: getOutputComponetRefs().clear(); return; case OrientedPackage.COMPONENT__INPUT_PORT_REFS: getInputPortRefs().clear(); return; case OrientedPackage.COMPONENT__OUTPUT_PORT_REFS: getOutputPortRefs().clear(); return; case OrientedPackage.COMPONENT__ID: setId(ID_EDEFAULT); return; case OrientedPackage.COMPONENT__INPUT_CNT: setInputCnt(INPUT_CNT_EDEFAULT); return; case OrientedPackage.COMPONENT__OUTPUT_CNT: setOutputCnt(OUTPUT_CNT_EDEFAULT); return; } super.eUnset(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); int size=s.readInt(); if (size < 0) throw new java.io.StreamCorruptedException("Illegal mappings count: " + size); init(capacity(size)); for (int i=0; i < size; i++) { @SuppressWarnings("unchecked") K key=(K)s.readObject(); @SuppressWarnings("unchecked") V value=(V)s.readObject(); putForCreate(key,value); } }
Reconstitutes the <tt>IdentityHashMap</tt> instance from a stream (i.e., deserializes it).
private String createWorkflowStepForInvalidateCache(Workflow workflow,StorageSystem vplexSystem,URI vplexVolumeURI,String waitFor,Workflow.Method rollbackMethod){ Volume vplexVolume=getDataObject(Volume.class,vplexVolumeURI,_dbClient); URI vplexURI=vplexSystem.getId(); Workflow.Method invalidateCacheMethod=createInvalidateCacheMethod(vplexURI,vplexVolumeURI); workflow.createStep(INVALIDATE_CACHE_STEP,String.format("Invalidate read cache for VPLEX volume %s (%s) on system %s",vplexVolume.getLabel(),vplexVolumeURI,vplexURI),waitFor,vplexURI,vplexSystem.getSystemType(),this.getClass(),invalidateCacheMethod,rollbackMethod,null); _log.info("Created workflow step to invalidate the read cache for volume {}",vplexVolumeURI); return INVALIDATE_CACHE_STEP; }
Create a step in the passed workflow to invalidate the read cache for the passed volume on the passed VPLEX system.
protected long readLong() throws IOException, ReplicatorException, InterruptedException { assertReadMode(); return dataInput.readLong(); }
Reads a single long.
public void actionPerformed(ActionEvent e){ int currentTab=0; for (Iterator<String> i=this.tabs.keySet().iterator(); i.hasNext(); ) { String tabName=i.next(); TabInfo tabInfo=this.tabs.get(tabName); if (tabInfo.getHeader().getButton() == e.getSource()) { this.visibleTab=currentTab; render(); return; } currentTab++; } }
Invoked when one of our tabs is selected
public static void drawPath(@NonNull Canvas canvas,@NonNull Paint paint,@NonNull List<Point> points){ if (points.size() < 2) { return; } PATH.reset(); Point firstPoint=points.get(0); PATH.moveTo(firstPoint.x,firstPoint.y); Stream.of(points).skip(1).forEach(null); PATH.close(); canvas.drawPath(PATH,paint); }
Draws a path in the canvas using the <code>points</code> list, drawing a line between consecutive points
public Shape chartToScreenShape(Shape s){ GeneralPath p=new GeneralPath(); Transform inverse=Transform.makeTranslation(getAbsoluteX(),getAbsoluteY()); if (currentTransform != null) { inverse.concatenate(currentTransform); } p.append(s.getPathIterator(inverse),false); return p; }
Converts a screen coordinate spaced shape to the same shape in the chart coordinate space
public static boolean removeFromCache(String imageUri,DiskCache diskCache){ File image=diskCache.get(imageUri); return image != null && image.exists() && image.delete(); }
Removed cached image file from disk cache (if image was cached in disk cache before)
public Boolean isWakeOnLanEnabled(){ return wakeOnLanEnabled; }
Gets the value of the wakeOnLanEnabled property.
public EntityQuery filterByDate(){ this.filterByDate=true; this.filterByDateMoment=null; this.filterByFieldNames=null; return this; }
Specifies whether the query should return only values that are currently active using from/thruDate fields.
protected void stopHarvestTiming(int candidateCount){ this.lastHarvestingTime=this.getHarvestDuration(); this.lastStartHarvestingTime=-1; this.totalCandidateCount+=candidateCount; }
Stops the harvesting timer. Called when the harvest ends.
public double[][] dataProjections(V p){ double[] centered=minusEquals(p.toArray(),centroid); double[][] sum=new double[p.getDimensionality()][strongEigenvectors[0].length]; for (int i=0; i < strongEigenvectors[0].length; i++) { double[] v_i=getCol(strongEigenvectors,i); timesEquals(v_i,transposeTimes(centered,v_i)); setCol(sum,i,v_i); } return sum; }
Returns the data vectors after projection.
private static void ReleaseBooleanArrayElements(JNIEnvironment env,int arrayJREF,Address copyBufferAddress,int releaseMode){ if (traceJNI) VM.sysWrite("JNI called: ReleaseBooleanArrayElements \n"); RuntimeEntrypoints.checkJNICountDownToGC(); try { boolean[] sourceArray=(boolean[])env.getJNIRef(arrayJREF); if (Magic.objectAsAddress(sourceArray).NE(copyBufferAddress)) { int size=sourceArray.length; if ((releaseMode == 0 || releaseMode == 1) && size != 0) { for (int i=0; i < size; i+=BYTES_IN_INT) { Address addr=copyBufferAddress.plus(i); int data=addr.loadInt(); if (VM.LittleEndian) { if (i < size) sourceArray[i]=((data) & 0x000000ff) != 0; if (i + 1 < size) sourceArray[i + 1]=((data >>> BITS_IN_BYTE) & 0x000000ff) != 0; if (i + 2 < size) sourceArray[i + 2]=((data >>> (2 * BITS_IN_BYTE)) & 0x000000ff) != 0; if (i + 3 < size) sourceArray[i + 3]=((data >>> (3 * BITS_IN_BYTE)) & 0x000000ff) != 0; } else { if (i < size) sourceArray[i]=((data >>> (3 * BITS_IN_BYTE)) & 0x000000ff) != 0; if (i + 1 < size) sourceArray[i + 1]=((data >>> (2 * BITS_IN_BYTE)) & 0x000000ff) != 0; if (i + 2 < size) sourceArray[i + 2]=((data >>> BITS_IN_BYTE) & 0x000000ff) != 0; if (i + 3 < size) sourceArray[i + 3]=((data) & 0x000000ff) != 0; } } } if (releaseMode == 0 || releaseMode == 2) { sysCall.sysFree(copyBufferAddress); } } } catch ( Throwable unexpected) { if (traceJNI) unexpected.printStackTrace(System.err); env.recordException(unexpected); } }
ReleaseBooleanArrayElements: free the native copy of the array, update changes to Java array as indicated
protected boolean isInfoEnabled(){ return trace.isInfoEnabled(); }
Check if info trace level is enabled.
public int equivHashCode(){ return (getUnit().hashCode() * 17) + (getValue().equivHashCode() * 101); }
Non-deterministic hashcode consistent with equivTo() implementation. <p> <b>Note:</b> If you are concerned about non-determinism, remember that current implementations of equivHashCode() in other parts of Soot are non-deterministic as well (see Constant.java for example).
public void init(int WindowNo,FormFrame frame){ log.info(""); m_WindowNo=WindowNo; m_frame=frame; try { jbInit(); dynInit(); frame.getContentPane().add(centerPanel,BorderLayout.CENTER); frame.getContentPane().add(southPanel,BorderLayout.SOUTH); } catch ( Exception e) { log.log(Level.SEVERE,"",e); } }
Initialize Panel
private void simpleSyntaxValidation(String value){ Map<String,Integer> characterCounts=new HashMap<>(); characterCounts.put(START_DELIMITER,0); characterCounts.put(START_PAREN,0); for ( char theChar : value.toCharArray()) { if (START_DELIMITER.indexOf(theChar) != -1) { Integer count=characterCounts.get(START_DELIMITER); characterCounts.put(START_DELIMITER,count + 1); } else if (END_DELIMITER.indexOf(theChar) != -1) { Integer count=characterCounts.get(START_DELIMITER); characterCounts.put(START_DELIMITER,count - 1); } else if (START_PAREN.indexOf(theChar) != -1) { Integer count=characterCounts.get(START_PAREN); characterCounts.put(START_PAREN,count + 1); } else if (END_PAREN.indexOf(theChar) != -1) { Integer count=characterCounts.get(START_PAREN); characterCounts.put(START_PAREN,count - 1); } } for ( String character : characterCounts.keySet()) { Integer count=characterCounts.get(character); if (count != 0) { String invalid=""; if (START_DELIMITER.contains(character)) { invalid=END_DELIMITER; } else if (START_PAREN.contains(character)) { invalid=END_PAREN; } String reason=""; if (count > 0) { reason=String.format("Missing a '%s'",invalid); } else if (count < 0) { reason=String.format("Extra '%s' characters",invalid); } throw CustomConfigControllerException.exceptions.invalidSyntax(value,reason); } } }
Routine determines if the value looks invalid, like having too many parentheses or not enough.
public SequenceForMySQL(Session s,String sSeqTable){ sent1=new StaticSentence(s,"UPDATE " + sSeqTable + " SET ID = LAST_INSERT_ID(ID + 1)"); sent2=new StaticSentence(s,"SELECT LAST_INSERT_ID()",null,SerializerReadInteger.INSTANCE); }
Creates a new instance of SequenceForMySQL
public AbstractLongList elements(long[] elements){ this.elements=elements; this.size=elements.length; return this; }
Sets the receiver's elements to be the specified array (not a copy of it). The size and capacity of the list is the length of the array. <b>WARNING:</b> For efficiency reasons and to keep memory usage low, <b>the array is not copied</b>. So if subsequently you modify the specified array directly via the [] operator, be sure you know what you're doing.
public static int nextPoisson(double xm){ double em; double t, y; if (xm < 12.0) { if (xm != oldm) { oldm=xm; g=Math.exp(-xm); } em=-1.0; t=1.0; do { ++em; t*=MathUtils.nextDouble(); } while (t > g); } else { if (xm != oldm) { oldm=xm; sq=Math.sqrt(2.0 * xm); alxm=Math.log(xm); g=xm * alxm - gammln(xm + 1.0); } do { do { y=Math.tan(Math.PI * MathUtils.nextDouble()); em=sq * y + xm; } while (em < 0.0); em=Math.floor(em); t=0.9 * (1.0 + y * y) * Math.exp(em * alxm - gammln(em + 1.0) - g); } while (MathUtils.nextDouble() > t); } return (int)em; }
Returns an integer value that is a random deviate drawn from a Poisson distribution of mean xm.
private void snoopDHCPClientName(Ethernet eth,Device srcDevice){ if (!(eth.getPayload() instanceof IPv4)) return; IPv4 ipv4=(IPv4)eth.getPayload(); if (!(ipv4.getPayload() instanceof UDP)) return; UDP udp=(UDP)ipv4.getPayload(); if (!(udp.getPayload() instanceof DHCP)) return; DHCP dhcp=(DHCP)udp.getPayload(); byte opcode=dhcp.getOpCode(); if (opcode == DHCP.OPCODE_REQUEST) { DHCPOption dhcpOption=dhcp.getOption(DHCPOptionCode.OptionCode_Hostname); if (dhcpOption != null) { cntDhcpClientNameSnooped.updateCounterNoFlush(); srcDevice.dhcpClientName=new String(dhcpOption.getData()); } } }
Snoop and record client-provided host name from DHCP requests
@Override public synchronized void reset() throws IOException { in.reset(); }
Resets this stream to the last marked location. This implementation resets the target stream.
public Property monthOfYear(){ return new Property(this,getChronology().monthOfYear()); }
Get the month of year property which provides access to advanced functionality.
public ReilInterpreter(final Endianness endianness,final ICpuPolicy cpuPolicy,final IInterpreterPolicy interpreterPolicy){ Preconditions.checkNotNull(endianness,"Error: Argument endianness can't be null"); this.cpuPolicy=Preconditions.checkNotNull(cpuPolicy,"Error: Argument cpuPolicy can't be null"); this.interpreterPolicy=Preconditions.checkNotNull(interpreterPolicy,"Error: Argument interpreterPolicy can't be null"); this.memory=new ReilMemory(endianness); }
Creates a new REIL interpreter with the given options.
public static void initialize(final RPServerManager rpMan){ StendhalRPAction.rpman=rpMan; }
initializes the StendhalRPAction
public void add(Double value){ if (value == null) { addNull(); } else { _add(numberNode(value.doubleValue())); } }
Alternative method that we need to avoid bumping into NPE issues with auto-unboxing.
public SendableDocumentMessage.SendableDocumentMessageBuilder replyTo(Message replyTo){ this.replyTo=replyTo != null ? replyTo.getMessageId() : 0; return this; }
*Optional Sets the Message object that you want to reply to
protected ServiceCoded removeVolumesFromCGInternal(URI vplexURI,URI cgURI,List<URI> vplexVolumeURIs){ try { if (vplexVolumeURIs.isEmpty()) { log.info("Empty volume list; no volumes to remove from CG %s",cgURI.toString()); return null; } StorageSystem vplexSystem=getDataObject(StorageSystem.class,vplexURI,dbClient); VPlexApiClient client=getVPlexAPIClient(vplexApiFactory,vplexSystem,dbClient); log.info("Got VPLEX API client."); Map<String,List<String>> cgToVolumesMap=new HashMap<String,List<String>>(); List<Volume> vplexVolumes=new ArrayList<Volume>(); for ( URI vplexVolumeURI : vplexVolumeURIs) { Volume vplexVolume=getDataObject(Volume.class,vplexVolumeURI,dbClient); if (vplexVolume == null || vplexVolume.getInactive()) { log.error(String.format("Skipping null or inactive vplex volume %s",vplexVolumeURI.toString())); continue; } vplexVolume.setConsistencyGroup(NullColumnValueGetter.getNullURI()); vplexVolumes.add(vplexVolume); String cgName=getVplexCgName(vplexVolume,cgURI); List<String> vplexVolumeNames=cgToVolumesMap.get(cgName); if (vplexVolumeNames == null) { vplexVolumeNames=new ArrayList<String>(); cgToVolumesMap.put(cgName,vplexVolumeNames); } vplexVolumeNames.add(vplexVolume.getDeviceLabel()); log.info(String.format("Adding VPLEX volume [%s](%s) with device label [%s] to be removed from VPLEX CG [%s]",vplexVolume.getLabel(),vplexVolume.getId(),vplexVolume.getDeviceLabel(),cgName)); } for ( Map.Entry<String,List<String>> entry : cgToVolumesMap.entrySet()) { String cgName=entry.getKey(); List<String> vplexVolumeNames=entry.getValue(); log.info(String.format("Removing the following VPLEX volumes from VPLEX CG [%s]: %s",cgName,Joiner.on(", ").join(vplexVolumeNames))); client.removeVolumesFromConsistencyGroup(vplexVolumeNames,cgName,false); } log.info("Removed volumes from consistency group."); dbClient.updateObject(vplexVolumes); return null; } catch ( VPlexApiException vae) { log.error("Exception removing volumes from consistency group: " + vae.getMessage(),vae); return vae; } catch ( Exception ex) { log.error("Exception removing volumes from consistency group: " + ex.getMessage(),ex); String opName=ResourceOperationTypeEnum.DELETE_CG_VOLUME.getName(); ServiceError serviceError=VPlexApiException.errors.removeVolumesFromCGFailed(opName,ex); return serviceError; } }
The method called by the workflow to remove VPLEX volumes from a VPLEX consistency group.
protected void onStop(){ super.onStop(); try { if (client != null) { client.stop(); Log.i("Jetty","Stopped httpclient"); } } catch ( Exception e) { Log.e("Jetty","Error stopping httpclient ",e); } finally { client=null; fileInProgress=null; } }
Download activity is being stopped. Stop the httpclient (note that onPause should always be called first, so the client should be null).
public int length(){ return this.map.size(); }
Get the number of keys stored in the JSONObject.
public void addPropertyChangeListener(String propertyName,PropertyChangeListener in_pcl){ beanContextChildSupport.addPropertyChangeListener(propertyName,in_pcl); }
Method for BeanContextChild interface.
public void dispose(){ mRunButton.setSelected(false); super.dispose(); }
When the window closes, stop any sequences running
private void handleError(@NotNull Throwable e){ String errorMessage=(e.getMessage() != null && !e.getMessage().isEmpty()) ? e.getMessage() : constant.initFailed(); console.printError(errorMessage); notificationManager.showError(errorMessage); }
Handler some action whether some exception happened.
public final int yylength(){ return zzMarkedPos - zzStartRead; }
Returns the length of the matched text region.
public boolean isSensorMessage(){ return getElement(0) == 0x61 && getElement(1) >= 0x30 && getElement(2) >= 0x41 && getElement(2) <= 0x6F && getNumDataElements() == 3; }
Examine message to see if it is an asynchronous sensor (AIU) state report
public String toString(){ StringBuffer sb=new StringBuffer("MProjectLine["); sb.append(get_ID()).append("-").append(getLine()).append(",C_Project_ID=").append(getC_Project_ID()).append(",C_ProjectPhase_ID=").append(getC_ProjectPhase_ID()).append(",C_ProjectTask_ID=").append(getC_ProjectTask_ID()).append(",C_ProjectIssue_ID=").append(getC_ProjectIssue_ID()).append(", M_Product_ID=").append(getM_Product_ID()).append(", PlannedQty=").append(getPlannedQty()).append("]"); return sb.toString(); }
String Representation
private void addEndToken(int tokenType){ addToken(zzMarkedPos,zzMarkedPos,tokenType); }
Adds the token specified to the current linked list of tokens as an "end token;" that is, at <code>zzMarkedPos</code>.
public StrengthFitnessEvaluator(int k){ super(); this.k=k; comparator=new ParetoDominanceComparator(); }
Constructs a new fitness evaluator for computing the strength measure with crowding-based niching.
public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_right.bool(xctxt); }
Evaluate this operation directly to a boolean.
public void storeLocal(final int local){ storeInsn(getLocalType(local),local); }
Generates the instruction to store the top stack value in the given local variable.
public boolean letsRedstoneGoOut(byte aSide,int aCoverID,int aCoverVariable,ICoverable aTileEntity){ return false; }
If it lets RS-Signals out of the Block
@Override public int available() throws IOException { if (c.checkEOF() || (r.isAppDataValid() == false)) { return 0; } return r.available(); }
Return the minimum number of bytes that can be read without blocking. Currently not synchronized.
@Override public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException { }
Check server trusted
@Override public void shutdown(){ super.shutdown(); disconnect(); }
Stop sensing.
protected boolean isIncluded(EStructuralFeature feature){ return dataClass.isAssignableFrom(feature.getEType().getInstanceClass()); }
Indicates whether all elements from the specified source feature are included in this list.
public void notifyInSeconds(final int sec,final TurnListener turnListener){ notifyInTurns(SingletonRepository.getRPWorld().getTurnsInSeconds(sec),turnListener); }
Notifies the <i>turnListener</i> in <i>sec</i> seconds.
public boolean hasCursor(){ return isServerFlagSet(MySQLConstants.SERVER_STATUS_CURSOR_EXISTS); }
Tells whether or not a cursor exists.
protected GenericCDATASection(){ }
Creates a new CDATASection object.
public static _Fields findByThriftId(int fieldId){ switch (fieldId) { case 1: return VALUE; case 2: return VERSION; default : return null; } }
Find the _Fields constant that matches fieldId, or null if its not found.
protected AbstractCatchBlockImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
protected void onDeviceConnected(){ mField.setEnabled(true); mSendButton.setEnabled(true); }
Method called when the target device has connected.
private Item newString(final String value){ key2.set(STR,value,null,null); Item result=get(key2); if (result == null) { pool.put12(STR,newUTF8(value)); result=new Item(index++,key2); put(result); } return result; }
Adds a string to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item.
public final void update(byte[] data,int off,int len) throws SignatureException { if (state == SIGN || state == VERIFY) { if (data == null) { throw new IllegalArgumentException("data is null"); } if (off < 0 || len < 0) { throw new IllegalArgumentException("off or len is less than 0"); } if (data.length - off < len) { throw new IllegalArgumentException("data too small for specified offset and length"); } engineUpdate(data,off,len); } else { throw new SignatureException("object not initialized for " + "signature or verification"); } }
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
@Override public boolean isActive(){ return true; }
Is the scope active.
public char next() throws JSONException { int c; if (this.usePrevious) { this.usePrevious=false; c=this.previous; } else { try { c=this.reader.read(); } catch ( IOException exception) { throw new JSONException(exception); } if (c <= 0) { this.eof=true; c=0; } } this.index+=1; if (this.previous == '\r') { this.line+=1; this.character=c == '\n' ? 0 : 1; } else if (c == '\n') { this.line+=1; this.character=0; } else { this.character+=1; } this.previous=(char)c; return this.previous; }
Get the next character in the source string.
public static boolean intersect(long x,long y){ return (x & y) != 0L; }
Test whether two Bitsets intersect.
public boolean find(){ return matcher.find(); }
Attempts to find the next subsequence of the input sequence that matches the pattern. <p>This method starts at the beginning of this matcher's region, or, if a previous invocation of the method was successful and the matcher has not since been reset, at the first character not matched by the previous match.</p> <p>If the match succeeds then more information can be obtained via the start, end, and group methods.</p>
public void debug(Throwable throwable,String msg){ innerLog(Level.DEBUG,throwable,msg,UNKNOWN_ARG,UNKNOWN_ARG,UNKNOWN_ARG,null); }
Log a debug message with a throwable.
public void reset(){ list.iterReverse(); currentIndex=list.size() - 1; }
Restarts iteration from the list's tail (last element).
public FixedWidthTextTableReader(String location) throws DataIOException { this(FixedWidthTextTableSchema.load(location)); }
Creates a new FixedWidthTextTableReader using the schema at the given location.
@Override public boolean supportsNamedParameters(){ debugCodeCall("supportsNamedParameters"); return false; }
Does the database support named parameters.
private Builder(org.apache.nutch.storage.ProtocolStatus.Builder other){ super(other); }
Creates a Builder by copying an existing Builder
public PasswordManagerCtrl(){ this.setupCommandLine(); }
Creates a new <code>PasswordManager</code> object
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:13.024 -0500",hash_original_method="69EAD59EF006B3A496038767E7251C79",hash_generated_method="E8BF02F1B64289F3B2238534086D0E8C") @Override protected void shutdownInput() throws IOException { shutdownInput=true; try { Libcore.os.shutdown(fd,SHUT_RD); } catch ( ErrnoException errnoException) { throw errnoException.rethrowAsSocketException(); } }
Shutdown the input portion of the socket.
public JapaneseBaseFormFilterFactory(Map<String,String> args){ super(args); if (!args.isEmpty()) { throw new IllegalArgumentException("Unknown parameters: " + args); } }
Creates a new JapaneseBaseFormFilterFactory
private PhantomReferenceElement(E ref,ReferenceQueue<? super E> refQ){ super(ref,refQ); hashCode=ref != null ? ref.hashCode() : 0; }
Creates weak reference element.
public ColorList adjustSaturation(float step){ for ( TColor c : colors) { c.saturate(step); } return this; }
Adjusts the saturation component of all list colors by the given amount.
@Override public void logError(CacheErrorCategory category,Class<?> clazz,String message,@Nullable Throwable throwable){ }
Log an error of the specified category.
public void validateAttributes(){ if ((this.totalNumBuckets <= 0)) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_TOTALNUMBICKETS_0_IS_AN_ILLEGAL_VALUE_PLEASE_CHOOSE_A_VALUE_GREATER_THAN_0.toLocalizedString(Integer.valueOf(this.totalNumBuckets))); } if ((this.redundancy < 0) || (this.redundancy >= 4)) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_REDUNDANTCOPIES_0_IS_AN_ILLEGAL_VALUE_PLEASE_CHOOSE_A_VALUE_BETWEEN_0_AND_3.toLocalizedString(Integer.valueOf(this.redundancy))); } for (Iterator it=this.getLocalProperties().keySet().iterator(); it.hasNext(); ) { String propName=(String)it.next(); if (!PartitionAttributesFactory.LOCAL_MAX_MEMORY_PROPERTY.equals(propName)) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_UNKNOWN_LOCAL_PROPERTY_0.toLocalizedString(propName)); } } for (Iterator it=this.getGlobalProperties().keySet().iterator(); it.hasNext(); ) { String propName=(String)it.next(); if (!PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_PROPERTY.equals(propName) && !PartitionAttributesFactory.GLOBAL_MAX_MEMORY_PROPERTY.equals(propName)) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_UNKNOWN_GLOBAL_PROPERTY_0.toLocalizedString(propName)); } } if (this.recoveryDelay < -1) { throw new IllegalStateException("RecoveryDelay " + this.recoveryDelay + " is an illegal value, please choose a value that is greater than or equal to -1"); } if (this.startupRecoveryDelay < -1) { throw new IllegalStateException("StartupRecoveryDelay " + this.startupRecoveryDelay + " is an illegal value, please choose a value that is greater than or equal to -1"); } if (this.fixedPAttrs != null) { List<FixedPartitionAttributesImpl> duplicateFPAattrsList=new ArrayList<FixedPartitionAttributesImpl>(); Set<FixedPartitionAttributes> fpAttrsSet=new HashSet<FixedPartitionAttributes>(); for ( FixedPartitionAttributesImpl fpa : this.fixedPAttrs) { if (fpa == null || fpa.getPartitionName() == null) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_FIXED_PARTITION_NAME_CANNOT_BE_NULL.toString()); } if (fpAttrsSet.contains(fpa)) { duplicateFPAattrsList.add(fpa); } else { fpAttrsSet.add(fpa); } } if (duplicateFPAattrsList.size() != 0) { throw new IllegalStateException(LocalizedStrings.PartitionAttributesImpl_PARTITION_NAME_0_CAN_BE_ADDED_ONLY_ONCE_IN_FIXED_PARTITION_ATTRIBUTES.toString(duplicateFPAattrsList.toString())); } } }
Validates that the attributes are consistent with each other. The following rules are checked and enforced: <ul> <li>Redundancy should be between 1 and 4</li> <li>Scope should be either DIST_ACK or DIST_NO_ACK</li> </ul> NOTE: validation that depends on more than one attribute can not be done in this method. That validation needs to be done in validateWhenAllAttributesAreSet
public MySqlSelectIntoStatement parseSelectInto(){ MySqlSelectIntoParser parse=new MySqlSelectIntoParser(this.exprParser); return parse.parseSelectInto(); }
parse select into
private void configureValidators(ValidatorLogger logger,AbstractXtremIOValidator... validators){ for ( AbstractXtremIOValidator validator : validators) { validator.setFactory(this); validator.setLogger(logger); } }
Common configuration for XtremIO validators.
public void defineToFile(String key,File value){ define(key,value.getAbsolutePath()); }
Defines a property to a file for the ant task.
private boolean findAndAddClosestValidLeafNodes(Node start,boolean checkStart,boolean backward,AnchorElement baseAnchor){ Node node=checkStart ? start : (backward ? start.getPreviousSibling() : start.getNextSibling()); if (node == null) { node=start.getParentNode(); if (sInvalidParentWrapper == null) { sInvalidParentWrapper=RegExp.compile("(BODY)|(HTML)"); } if (sInvalidParentWrapper.test(node.getNodeName())) return false; return findAndAddClosestValidLeafNodes(node,false,backward,baseAnchor); } checkStart=false; switch (node.getNodeType()) { case Node.TEXT_NODE: String text=node.getNodeValue(); if (text.isEmpty() || StringUtil.countWords(text) == 0) break; boolean added=addNonLinkTextIfValid(node.getNodeValue()); if (backward || !added) return false; break; case Node.ELEMENT_NODE: Element e=Element.as(node); if (e.hasTagName("A")) { if (backward) return false; mNumForwardLinksProcessed++; if (!addLinkIfValid(AnchorElement.as(e),baseAnchor)) return false; break; } default : if (!node.hasChildNodes()) break; checkStart=true; if (backward) { node=node.getLastChild(); } else { node=node.getFirstChild(); } break; } return findAndAddClosestValidLeafNodes(node,checkStart,backward,baseAnchor); }
Finds and adds the leaf node(s) closest to the given start node. This recurses and keeps finding and, if necessary, adding the numeric text of valid nodes, collecting the PageParamInfo.PageInfo's for the current adjacency group. For backward search, i.e. nodes before start node, search terminates (i.e. recursion stops) once a text node or anchor is encountered. If the text node contains numeric text, it's added to the current adjacency group. Otherwise, a new group is created to break the adjacency. For forward search, i.e. nodes after start node, search continues (i.e. recursion continues) until a text node or anchor with non-numeric text is encountered. In the process, text nodes and anchors with numeric text are added to the current adjacency group. When a non-numeric text node or anchor is encountered, a new group is started to break the adjacency, and search ends.
@Override public int helo(String hostname) throws IOException { return sendCommand("LHLO",hostname); }
Issue the LHLO command
public RFF_RBF(int featurSize,double sigma,int dim,Random rand,boolean inMemory){ this(sigma,dim,inMemory); if (featurSize <= 0) throw new IllegalArgumentException("The number of numeric features must be positive, not " + featurSize); if (sigma <= 0 || Double.isInfinite(sigma) || Double.isNaN(sigma)) throw new IllegalArgumentException("The sigma parameter must be positive, not " + sigma); if (dim <= 1) throw new IllegalArgumentException("The target dimension must be positive, not " + dim); transform=new RandomMatrixRFF_RBF(Math.sqrt(0.5 / (sigma * sigma)),featurSize,dim,rand.nextLong()); offsets=new RandomVectorRFF_RBF(dim,rand.nextLong()); if (inMemory) { transform=transform.add(0.0); offsets=new DenseVector(offsets); } }
Creates a new RFF RBF object
public int size(){ return data.length; }
Returns the number of bytes in this ByteString.
public InputBuilder<T> emitAll(Collection<T> records){ input.addAll(records); return this; }
Adds a collection of elements to the input
public JHyperlink(String text){ this(); setText(text); }
Creates a new instance of JHyperlink
public void endElement(String name) throws org.xml.sax.SAXException { endElement(null,null,name); }
Receive notification of the end of an element.
public void trace() throws IOException { print("trace",null); }
Description of the Method
public void nextPage(){ skipResults+=pageSize; pageNumber+=1; }
metodo para obtener la siguiente pagina de la busqueda realizada previamente
public void ready(String message){ setMessage(message); setProgress(100); updateStatus(Status.ready.name()); }
This method sets the status of the operation to "ready" and updates progress to be 100%
public boolean saveLogToLocal(String path){ String content=PcStringUtils.renderJson(new ParallelTaskBean(this)); File file=new File(path); boolean success=false; try { FileUtils.writeStringToFile(file,content); success=true; } catch ( IOException e) { logger.error("error writing parallel task to path {} details ",path,e); } logger.info("Save parallel task {} log to disk at path {}. Success?: {}",this.taskId,path,success); return success; }
Save log to local.