code
stringlengths
10
174k
nl
stringlengths
3
129k
private void buildClassPath() throws InterruptedException, IOException, CheckedAnalysisException { IClassPathBuilder builder=classFactory.createClassPathBuilder(bugReporter); { HashSet<String> seen=new HashSet<String>(); for ( String path : project.getFileArray()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path),true); } } for ( String path : project.getAuxClasspathEntryList()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path),false); } } } builder.scanNestedArchives(analysisOptions.scanNestedArchives); builder.build(classPath,progress); appClassList=builder.getAppClassList(); if (PROGRESS) { System.out.println(appClassList.size() + " classes scanned"); } for (Iterator<? extends ICodeBase> i=classPath.appCodeBaseIterator(); i.hasNext(); ) { ICodeBase appCodeBase=i.next(); if (appCodeBase.containsSourceFiles()) { String pathName=appCodeBase.getPathName(); if (pathName != null) { project.addSourceDir(pathName); } } project.addTimestamp(appCodeBase.getLastModifiedTime()); } }
Build the classpath from project codebases and system codebases.
public void endEntity(String name) throws SAXException { if (null != m_resultLexicalHandler) m_resultLexicalHandler.endEntity(name); }
Report the end of an entity.
public void firePropertyChange(String propertyName,int oldValue,int newValue){ }
Overridden for performance reasons. See the <a href="#override">Implementation Note</a> for more information.
public HGRemoveRefusedException(HGHandle atom,Object reason){ super("Remove of hypergraph atom failed"); this.atom=atom; this.reason=reason; }
<p> </p>
public double totalCount(){ return entries.sum(); }
Finds the total of all counts in the counter. This implementation iterates through the entire counter every time this method is called.
private String readPropName(ByteBuffer buffer){ int nameLength=buffer.getShort(); byte[] nameBytes=ByteUtil.getBytes(buffer,nameLength); return ColumnImpl.decodeUncompressedText(nameBytes,_database.getCharset()); }
Reads a property name from the given data block
public void flush() throws Exception { if (writingChannel != null) { sequentialFile.position(0); writingChannel.writerIndex(writingChannel.capacity()); sequentialFile.writeDirect(writingChannel.toByteBuffer(),true); sequentialFile.close(); newDataFiles.add(currentFile); } writingChannel=null; }
Write pending output into file
private void load(File file) throws IOException { BufferedReader reader=null; try { reader=new BufferedReader(new FileReader(file)); String[] tokens=reader.readLine().split("\\s+"); if (tokens.length != 3) { throw new IOException("expected 3 values on first line"); } n=Integer.parseInt(tokens[0]); k=Integer.parseInt(tokens[1]); overlap=Integer.parseInt(tokens[2]); checkArguments(); int numberOfFunctions=(n - k) / (k - overlap) + 1; function=new double[numberOfFunctions][1 << k]; tokens=reader.readLine().split("\\s+"); if (tokens.length != numberOfFunctions * (1 << k)) { throw new IOException("incorrect number of values on second line, expected " + (numberOfFunctions * (1 << k))); } for (int i=0; i < numberOfFunctions; i++) { for (int j=0; j < (1 << k); j++) { function[i][j]=Double.parseDouble(tokens[i * (1 << k) + j]); } } reader.readLine(); permutation=new int[n]; tokens=reader.readLine().split("\\s+"); if (tokens.length != n) { throw new IOException("incorrect number of values on fourth line, expected " + n); } for (int i=0; i < n; i++) { permutation[i]=Integer.parseInt(tokens[i]); } } finally { if (reader != null) { reader.close(); } } }
Loads the instance file.
public BaseItemProviderAdapterFactory(){ supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
public void clear(){ synchronized (keyInfoMap) { for ( final WatchKey key : keyInfoMap.keySet()) key.cancel(); keyInfoMap.clear(); } }
Clears all previously registered watched folders.
private <T>T[] copyElements(T[] a){ if (head < tail) { System.arraycopy(elements,head,a,0,size()); } else if (head > tail) { int headPortionLen=elements.length - head; System.arraycopy(elements,head,a,0,headPortionLen); System.arraycopy(elements,0,a,headPortionLen,tail); } return a; }
Copies the elements from our element array into the specified array, in order (from first to last element in the deque). It is assumed that the array is large enough to hold all elements in the deque.
public DeleteSubscriptionsResponse DeleteSubscriptions(RequestHeader RequestHeader,UnsignedInteger... SubscriptionIds) throws ServiceFaultException, ServiceResultException { DeleteSubscriptionsRequest req=new DeleteSubscriptionsRequest(RequestHeader,SubscriptionIds); return (DeleteSubscriptionsResponse)channel.serviceRequest(req); }
Synchronous DeleteSubscriptions service request.
@Override public void mouseExited(MouseEvent e){ }
Invoked when the mouse exits a component
public Object runSafely(Catbert.FastStack stack) throws Exception { MediaNode node=getMediaNode(stack); return node == null ? null : node.getFinalDescendants(); }
Returns the data set that represents all the children under the specified MediaNode if that data set has already been realized.
public CollectRequestedItemsAction(String itemName,String quest,String questionForMore,String alreadyBrought,ChatAction completionAction,ConversationStates stateAfterCompletion){ this.itemName=checkNotNull(itemName); this.questSlot=checkNotNull(quest); this.questionForMore=checkNotNull(questionForMore); this.alreadyBrought=checkNotNull(alreadyBrought); this.toExecuteOnCompletion=checkNotNull(completionAction); this.stateAfterCompletion=checkNotNull(stateAfterCompletion); }
create a new CollectRequestedItemsAction
public SnackbarBuilder appendMessage(@StringRes int messageResId){ return appendMessage(context.getString(messageResId)); }
Add some text to append to the message shown on the Snackbar.
public WFActivity(AMenu menu){ super(); log.config(""); try { dynInit(0); jbInit(); } catch ( Exception e) { log.log(Level.SEVERE,"",e); } m_menu=menu; }
WF Activity
public static String replace(String inString,String oldPattern,String newPattern){ if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) { return inString; } StringBuilder sb=new StringBuilder(); int pos=0; int index=inString.indexOf(oldPattern); int patLen=oldPattern.length(); while (index >= 0) { sb.append(inString.substring(pos,index)); sb.append(newPattern); pos=index + patLen; index=inString.indexOf(oldPattern,pos); } sb.append(inString.substring(pos)); return sb.toString(); }
Replace all occurences of a substring within a string with another string.
public T putCache(String key,T value){ return cache.put(key,value); }
associates a key with a value in the cache hashmap.
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
private void sendDebugReportToAuthor(){ String theLine; String theTrace=""; try { BufferedReader theReader=new BufferedReader(new InputStreamReader(mAct.openFileInput(EXCEPTION_REPORT_FILENAME))); while ((theLine=theReader.readLine()) != null) { theTrace+=theLine + "\n"; } if (sendDebugReportToAuthor(theTrace)) { mAct.deleteFile(EXCEPTION_REPORT_FILENAME); } } catch ( IOException eIo) { } }
Read in saved debug report and send to email app.
public static void updateNumberOfScreens(boolean isAdding){ if (isAdding) { totalNumberScreens++; numberScreensOnBackStack++; Crashlytics.setInt(NUMBER_OF_SCREENS,totalNumberScreens); Crashlytics.setInt(NUMBER_OF_SCREENS_ON_BACK_STACK,numberScreensOnBackStack); } else { numberScreensOnBackStack--; Crashlytics.setInt(NUMBER_OF_SCREENS_ON_BACK_STACK,numberScreensOnBackStack); } }
Updates the total screens showed and the screens on back stack
protected void clearOutEvents(){ }
This method resets the outgoing events.
protected boolean removeSubtree(E comparable){ if (comparable == null) return false; if (this.root == null) return false; BinarySearchTreeNode<E> node=this.root; while (node != null) { int diff=comparable.compareTo(node.comparable); if (diff < 0) { node=node.left; } else if (diff > 0) { node=node.right; } else { if (node.comparable.equals(comparable)) { if (node.isLeftChild()) { node.parent.left=null; } else { node.parent.right=null; } this.size-=this.size(node); if (this.selfBalancing) this.balanceTree(node.parent); return true; } else { return false; } } } return false; }
Removes the node containing the given value and the corresponding subtree from this tree.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:33.778 -0500",hash_original_method="B45A9D19151CAED15569D78F83AD2095",hash_generated_method="643ADB5C95A2E9CDD4F158DFE1BAB0C5") public void clearPassword(){ this.password=null; }
Clear the password field.
private void refreshProject(final List<EditorPartPresenter> openedEditors){ projectExplorer.reloadChildren(); for ( EditorPartPresenter partPresenter : openedEditors) { final VirtualFile file=partPresenter.getEditorInput().getFile(); eventBus.fireEvent(new FileContentUpdateEvent(file.getPath())); } }
Refresh project.
public LayerDrawable(@NonNull Drawable[] layers){ this(layers,null); }
Creates a new layer drawable with the list of specified layers.
public static Date executeTimestampQuery(String sql) throws AdeException { return executeTimestampQuery(sql,AdeInternal.getDefaultConnection(),true); }
Executes a given query, that is expected to return a Timestamp result. Expects exactly one Timestamp result. Uses the default connection.
public void addField(XTIFFField field){ fieldIndex.put(new Integer(field.tag),field); }
Add an existing TIFF field to this directory.
public static TypeReference newTryCatchReference(int tryCatchBlockIndex){ return new TypeReference((EXCEPTION_PARAMETER << 24) | (tryCatchBlockIndex << 8)); }
Returns a reference to the type of the exception declared in a 'catch' clause of a method.
public static String toHexString(byte[] byteArray){ if (byteArray != null && byteArray.length != 0) { StringBuilder builder=new StringBuilder(byteArray.length * 3); for (int i=0; i < byteArray.length; i++) { builder.append(String.format("%02X",0xFF & byteArray[i])); if (i < byteArray.length - 1) { builder.append(' '); } } return builder.toString(); } else { return "--"; } }
Takes a byte array and returns it HEX representation.
public void addTotalStartedThreadCount(long totalStartedThreadCount){ this.totalTotalStartedThreadCount+=totalStartedThreadCount; }
increase the total number of started threads by the given value.
public boolean isField(){ return testAllFlags(IS_FIELD); }
Query whether this member is a field.
private void initialize(){ this.setLayout(new CardLayout()); this.setName(Constant.messages.getString("session.general")); this.add(getPanelSession(),getPanelSession().getName()); }
This method initializes this
public static Set<String> assertValidCipherSuites(Set<String> expected,String[] cipherSuites){ assertNotNull(cipherSuites); assertTrue(cipherSuites.length != 0); Set remainingCipherSuites=new HashSet<String>(expected); Set unknownCipherSuites=new HashSet<String>(); for ( String cipherSuite : cipherSuites) { boolean removed=remainingCipherSuites.remove(cipherSuite); if (!removed) { unknownCipherSuites.add(cipherSuite); } } assertEquals("Unknown cipher suites",Collections.EMPTY_SET,unknownCipherSuites); return remainingCipherSuites; }
Asserts that the cipher suites array is non-null and that it all of its contents are cipher suites known to this implementation. As a convenience, returns any unenabled cipher suites in a test for those that want to verify separately that all cipher suites were included.
@Override public void onCommit(List<? extends IndexCommit> list) throws IOException { List<IndexCommitWrapper> wrapperList=wrap(list); deletionPolicy.onCommit(wrapperList); updateCommitPoints(wrapperList); cleanReserves(); }
Internal use for Lucene... do not explicitly call.
private Diff generateFullRevision(final Revision revision) throws UnsupportedEncodingException { Diff diff=new Diff(); RevisionCodecData codecData=new RevisionCodecData(); part=new DiffPart(DiffAction.FULL_REVISION_UNCOMPRESSED); text=revision.getRevisionText(); revCurrent=text.toCharArray(); part.setText(text); codecData.checkBlocksizeL(text.getBytes(WIKIPEDIA_ENCODING).length); diff.add(part); diff.setCodecData(codecData); return diff; }
Generates a FullRevision.
void addEntry(int hash,K key,V value,int bucketIndex){ createEntry(hash,key,value,bucketIndex); Entry<K,V> eldest=header.after; if (removeEldestEntry(eldest)) { removeEntryForKey(eldest.key); } else { if (size >= threshold) resize(2 * table.length); } }
This override alters behavior of superclass put method. It causes newly allocated entry to get inserted at the end of the linked list and removes the eldest entry if appropriate.
public synchronized void retireJob(ReplicationJob job){ ReplicationJob removedJob=idToReplicationJob.remove(job.getId()); if (removedJob == null) { throw new RuntimeException("Couldn't find id: " + job.getId() + " in the registry!"); } if (removedJob != job) { throw new RuntimeException("Replication jobs with the same ID " + "are not equal: %s and %s"); } if (retiredJobs.size() + 1 > MAX_RETIRED_JOBS) { retiredJobs.remove(0); } retiredJobs.add(removedJob); }
Remove this job from the main internal data structures to another retired job datastructure.
public optgroup addElement(String element){ addElementToRegistry(element); return (this); }
Adds an Element to the element.
protected String checkProduction(final Territory to,final Collection<Unit> units,final PlayerID player){ final List<Territory> producers=getAllProducers(to,player,units); if (producers.isEmpty()) { return "No factory in or adjacent to " + to.getName(); } Collections.sort(producers,getBestProducerComparator(to,units,player)); if (!getCanAllUnitsWithRequiresUnitsBePlacedCorrectly(units,to)) { return "Cannot place more units which require units, than production capacity of territories with the required units"; } final int maxUnitsToBePlaced=getMaxUnitsToBePlaced(units,to,player,true); if ((maxUnitsToBePlaced != -1) && (maxUnitsToBePlaced < units.size())) { return "Cannot place " + units.size() + " more units in "+ to.getName(); } return null; }
Test whether or not the territory has the factory resources to support the placement. AlreadyProduced maps territory->units already produced this turn by that territory.
public GamlDefinition createGamlDefinition(){ GamlDefinitionImpl gamlDefinition=new GamlDefinitionImpl(); return gamlDefinition; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static int hash(int hash,float item){ return hash * prime + Float.floatToIntBits(item); }
Add a float value to a given hash.
public boolean disableStatePersistence(){ for ( ClusterBlock clusterBlock : global) { if (clusterBlock.disableStatePersistence()) { return true; } } return false; }
Returns <tt>true</tt> if one of the global blocks as its disable state persistence flag set.
public void resolve(TemplateVariable variable,TemplateContext context){ String type=variable.getType(); TemplateVariableResolver resolver=(TemplateVariableResolver)fResolvers.get(type); if (resolver == null) resolver=new TemplateVariableResolver(type,""); resolver.resolve(variable,context); }
Resolves a single variable in a context. Resolving is delegated to the registered resolver.
private void updateServerSettingsFile(){ Map<String,String> propertiesMap=currentSettings.propertiesMap(); if (propertiesMap.isEmpty()) { return; } File oldFile=new File(NEO4J_CONF); try { debug("Changing server properties file (for next start): " + oldFile.getCanonicalPath()); for ( Map.Entry<String,String> property : propertiesMap.entrySet()) { String name=property.getKey(); Object value=property.getValue(); debug("%s=%s",name,value); } updateProperties(oldFile,propertiesMap,currentSettings.excludes()); } catch ( Exception e) { throw new RuntimeException(e); } }
Write updated neo4j settings into neo4j-server.properties for use by the next start
public boolean hasSecondChanged(WatchFaceTime otherTime){ return second != otherTime.second; }
Determine if the second value has changed.
static GrantorInfo checkLockGrantorInfo(String serviceName,InternalDistributedSystem system){ GrantorInfo gi=GrantorRequestProcessor.peekGrantor(serviceName,system); if (logger.isTraceEnabled(LogMarker.DLS)) { logger.trace(LogMarker.DLS,"[checkLockGrantorId] returning {}",gi); } return gi; }
Provide way to peek at current lock grantor id when dls does not exist
@Override public boolean eIsSet(int featureID){ switch (featureID) { case N4JSPackage.FUNCTION_EXPRESSION__ANNOTATION_LIST: return annotationList != null; case N4JSPackage.FUNCTION_EXPRESSION__TYPE_VARS: return typeVars != null && !typeVars.isEmpty(); case N4JSPackage.FUNCTION_EXPRESSION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static Extent chunkAlign(Extent bytes,boolean down){ return alignWord(bytes.toWord(),VMLayoutConstants.LOG_BYTES_IN_CHUNK,down).toExtent(); }
Align an extent to a space chunk
public WrappedSyntaxView(Element elem){ super(elem,Y_AXIS); s=new Segment(); drawSeg=new Segment(); tempRect=new Rectangle(); }
Creates a new WrappedSyntaxView. Lines will be wrapped on character boundaries.
public boolean isDirectory(){ return getName().endsWith("/"); }
Is this entry a directory?
public static Script createOpReturnScript(byte[] data){ checkArgument(data.length <= 80); return new ScriptBuilder().op(OP_RETURN).data(data).build(); }
Creates a script of the form OP_RETURN [data]. This feature allows you to attach a small piece of data (like a hash of something stored elsewhere) to a zero valued output which can never be spent and thus does not pollute the ledger.
protected ElementParser(AltFormat altFormat,Class<T> resultType){ super(altFormat,resultType); }
Constructs a new ElementParser instance for parsing content in a a particular representation to produce results of a specified type.
@Override public Enumeration<String> enumerateRequests(){ Vector<String> newVector=new Vector<String>(0); if (m_executorPool != null && (m_executorPool.getQueue().size() > 0 || m_executorPool.getActiveCount() > 0)) { newVector.addElement("Stop"); } if ((m_executorPool == null || (m_executorPool.getQueue().size() == 0 && m_executorPool.getActiveCount() == 0)) && m_Classifier != null) { newVector.addElement("Save model"); } if (m_executorPool == null || (m_executorPool.getQueue().size() == 0 && m_executorPool.getActiveCount() == 0)) { newVector.addElement("Load model"); } return newVector.elements(); }
Return an enumeration of requests that can be made by the user
public static byte[] encodeBase64(byte[] binaryData){ return encodeBase64(binaryData,false); }
Encodes binary data using the base64 algorithm but does not chunk the output.
public static IStatus validateMethodName(String name,String sourceLevel,String complianceLevel){ return validateIdentifier(name,sourceLevel,complianceLevel); }
Validate the given method name for the given source and compliance levels. The special names "&lt;init&gt;" and "&lt;clinit&gt;" are not valid. <p> The syntax for a method name is defined by Identifier of MethodDeclarator (JLS2 8.4). For example "println".
public void writeExif(Bitmap bmap,OutputStream exifOutStream) throws IOException { if (bmap == null || exifOutStream == null) { throw new IllegalArgumentException(NULL_ARGUMENT_STRING); } OutputStream s=getExifWriterStream(exifOutStream); bmap.compress(Bitmap.CompressFormat.JPEG,90,s); s.flush(); }
Writes the tags from this ExifInterface object into a jpeg compressed bitmap, removing prior exif tags.
public void onDestroy(){ }
The final call you receive before your activity is destroyed.
public LogisticGrowthModel(Parameter N0Parameter,Parameter growthRateParameter,Parameter shapeParameter,double alpha,Type units,boolean usingGrowthRate){ this(LogisticGrowthModelParser.LOGISTIC_GROWTH_MODEL,N0Parameter,growthRateParameter,shapeParameter,alpha,units,usingGrowthRate); }
Construct demographic model with default settings
private void heapifyDown(double cur,long val){ final int stop=size >>> 1; int twopos=0; while (twopos < stop) { int bestchild=(twopos << 1) + 1; double best=twoheap[bestchild]; final int right=bestchild + 1; if (right < size && best < twoheap[right]) { bestchild=right; best=twoheap[right]; } if (cur >= best) { break; } twoheap[twopos]=best; twovals[twopos]=twovals[bestchild]; twopos=bestchild; } twoheap[twopos]=cur; twovals[twopos]=val; }
Invoke heapify-down for the root object.
public static String encodeValue(Value value){ if (value instanceof BNode) { return "_:" + ((BNode)value).getID(); } return NTriplesUtil.toNTriplesString(value); }
Encodes a value in a canonical serialized string format, for use in a URL query parameter.
public FlatBufferBuilder forceDefaults(boolean forceDefaults){ this.force_defaults=forceDefaults; return this; }
In order to save space, fields that are set to their default value don't get serialized into the buffer. Forcing defaults provides a way to manually disable this optimization.
private String createQueryString(){ StringBuffer retval=new StringBuffer(RecipeUtil.RECIPE_ITEMTYPE_QUERY); if (queryClean != null) { retval.append(queryClean); } appendAttributeCondition(retval,"main ingredient",mainIngredient,true); appendAttributeCondition(retval,"cuisine",cuisine,false); if (cookingTime != null) { Collection<String> cookingTimes=new ArrayList<String>(); cookingTimes.add("0.." + cookingTime + " min"); cookingTimes.add("0.." + cookingTime + " minutes"); appendAttributeCondition(retval,"cooking time",cookingTimes,false); } return retval.toString(); }
Creates a full text query out of the values of the query, mainIngredient, cuisine and cookingTime.
public DateTimeFormatterBuilder appendYearOfEra(int minDigits,int maxDigits){ return appendDecimal(DateTimeFieldType.yearOfEra(),minDigits,maxDigits); }
Instructs the printer to emit a numeric yearOfEra field.
public boolean containsHeader(String name){ for (int i=0; i < headers.size(); i++) { Header header=(Header)headers.get(i); if (header.getName().equalsIgnoreCase(name)) { return true; } } return false; }
Tests if headers with the given name are contained within this group. <p>Header name comparison is case insensitive.
public MaterialEditText icon(int resId){ mInputIconId=resId; mIcon.setImageResource(mInputIconId); mIcon.setVisibility(VISIBLE); mIcon.setAlpha(0f); mEditText.setPadding(DimensUtils.dp2px(mContext,40),mEditText.getPaddingTop(),mEditText.getPaddingRight(),mEditText.getPaddingBottom()); return this; }
Set the Icon for the EditText
public void removeRelated(String relationName) throws GenericEntityException { this.getDelegator().removeRelated(relationName,this); }
Remove the named Related Entity for the GenericValue from the persistent store
public double normInf(){ double f=0; for (int i=0; i < m; i++) { double s=0; for (int j=0; j < n; j++) { s+=Math.abs(A[i][j]); } f=Math.max(f,s); } return f; }
Infinity norm
@Override public ArrayList<String> reportDenseFeatures(int index){ denseFeatureIndex=index; ArrayList<String> names=new ArrayList<>(); for (int i=0; i < phrase_weights.length; i++) names.add(String.format("tm_%s_%d",owner,i)); return names; }
Just register a single weight, tm_OWNER, and use that to set its precomputed cost
public Component findDropTargetAt(int x,int y){ int count=getComponentCount(); for (int i=count - 1; i >= 0; i--) { Component cmp=getComponentAt(i); if (cmp.contains(x,y)) { if (cmp.isDropTarget()) { return cmp; } if (cmp instanceof Container) { Component component=((Container)cmp).findDropTargetAt(x,y); if (component != null) { return component; } } } } return null; }
Recursively searches the container hierarchy for a drop target
static void moveToForeignTarget(Path source,Path target,CopyOption... options) throws IOException { copyToForeignTarget(source,target,convertMoveToCopyOptions(options)); Files.delete(source); }
Simple move implements as copy+delete for use when source and target are associated with different providers
public static String canonicalizePath(String path,boolean discardRelativePrefix){ int segmentStart=0; int deletableSegments=0; for (int i=0; i <= path.length(); ) { int nextSegmentStart; if (i == path.length()) { nextSegmentStart=i; } else if (path.charAt(i) == '/') { nextSegmentStart=i + 1; } else { i++; continue; } if (i == segmentStart + 1 && path.regionMatches(segmentStart,".",0,1)) { path=path.substring(0,segmentStart) + path.substring(nextSegmentStart); i=segmentStart; } else if (i == segmentStart + 2 && path.regionMatches(segmentStart,"..",0,2)) { if (deletableSegments > 0 || discardRelativePrefix) { deletableSegments--; int prevSegmentStart=path.lastIndexOf('/',segmentStart - 2) + 1; path=path.substring(0,prevSegmentStart) + path.substring(nextSegmentStart); i=segmentStart=prevSegmentStart; } else { i++; segmentStart=i; } } else { if (i > 0) { deletableSegments++; } i++; segmentStart=i; } } return path; }
Returns the path will relative path segments like ".." and "." resolved. The returned path will not necessarily start with a "/" character. This handles ".." and "." segments at both the beginning and end of the path.
@Before public void beforTest() throws Exception { validateAssumption(); CreateQueueRequest createQueueRequest=new CreateQueueRequest().withQueueName(getCurrentQueueName()); currentQueueUrl=sqs.createQueue(createQueueRequest).getQueueUrl(); }
create a queue we can use for testing
Calendar toCalendar(String value,String pattern,Locale locale){ Calendar calendar=null; try { DateFormat format=(locale == null) ? new SimpleDateFormat(pattern) : new SimpleDateFormat(pattern,locale); format.setLenient(false); format.parse(value); calendar=format.getCalendar(); } catch ( Exception e) { fail("Error creating Calendar value ='" + value + ", pattern='"+ pattern+ "' "+ e.toString()); } return calendar; }
Parse a String value to a Calendar
public Builder withZkChroot(String zkChroot){ this.zkChroot=zkChroot; return this; }
Provides a ZooKeeper chroot for the builder to use when creating clients.
public boolean isProcessing(){ Object oo=get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Process Now.
public InvalidDnDOperationException(){ super(dft_msg); }
Create a default Exception
private static void weakHashLength32WithSeeds(byte[] bytes,int offset,long seedA,long seedB,long[] output){ long part1=load64(bytes,offset); long part2=load64(bytes,offset + 8); long part3=load64(bytes,offset + 16); long part4=load64(bytes,offset + 24); seedA+=part1; seedB=rotateRight(seedB + seedA + part4,21); long c=seedA; seedA+=part2; seedA+=part3; seedB+=rotateRight(seedA,44); output[0]=seedA + part4; output[1]=seedB + c; }
Computes intermediate hash of 32 bytes of byte array from the given offset. Results are returned in the output array because when we last measured, this was 12% faster than allocating new arrays every time.
public boolean intersects(S2Loop b){ if (!bound.intersects(b.getRectBound())) { return false; } if (b.getRectBound().lng().getLength() > bound.lng().getLength()) { return b.intersects(this); } if (contains(b.vertex(0)) && findVertex(b.vertex(0)) < 0) { return true; } if (checkEdgeCrossings(b,new S2EdgeUtil.WedgeIntersects()) < 0) { return true; } if (b.getRectBound().contains(bound)) { if (b.contains(vertex(0)) && b.findVertex(vertex(0)) < 0) { return true; } } return false; }
Return true if the region contained by this loop intersects the region contained by the given other loop.
public void testGridMultiPolygonsHolesRoundTrip() throws SQLException { GridGenerator grid=new GridGenerator(); grid.setGeometryFactory(geometryFactory); grid.setBoundingBox(new Envelope(0,10,0,10)); grid.setNumberColumns(10); grid.setNumberRows(10); MultiPolygon[] pt=new MultiPolygon[100]; STRUCT[] st=new STRUCT[100]; PolygonGenerator pgc=new PolygonGenerator(); pgc.setGeometryFactory(geometryFactory); pgc.setGenerationAlgorithm(PolygonGenerator.BOX); pgc.setNumberPoints(10); pgc.setNumberHoles(4); MultiGenerator pg=new MultiGenerator(pgc); pg.setBoundingBox(new Envelope(0,10,0,10)); pg.setNumberGeometries(3); pg.setGeometryFactory(geometryFactory); OraWriter ow=new OraWriter(); int i=0; while (grid.canCreate() && i < 100) { pg.setBoundingBox(grid.createEnv()); pt[i]=(MultiPolygon)pg.create(); st[i]=ow.write(pt[i],getConnection()); i++; } OraReader or=new OraReader(); i=0; while (i < 100 && pt[i] != null) { MultiPolygon pt2=(MultiPolygon)or.read(st[i]); assertTrue("The input MultiPolygon is not the same as the output MultiPolygon",pt[i].equals(pt2)); i++; } }
Round Trip test for a 100 non overlapping MultiPolygon
public String nextString(char quote) throws JSONException { char c; StringBuilder sb=new StringBuilder(); for (; ; ) { c=this.next(); switch (c) { case 0: case '\n': case '\r': throw this.syntaxError("Unterminated string"); case '\\': c=this.next(); switch (c) { case 'b': sb.append('\b'); break; case 't': sb.append('\t'); break; case 'n': sb.append('\n'); break; case 'f': sb.append('\f'); break; case 'r': sb.append('\r'); break; case 'u': sb.append((char)Integer.parseInt(this.next(4),16)); break; case '"': case '\'': case '\\': case '/': sb.append(c); break; default : throw this.syntaxError("Illegal escape."); } break; default : if (c == quote) { return sb.toString(); } sb.append(c); } } }
Return the characters up to the next close quote character. Backslash processing is done. The formal JSON format does not allow strings in single quotes, but an implementation is allowed to accept them.
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if (graph == null) { throw new NullPointerException(); } if (nodes == null) { throw new NullPointerException(); } if (parameters == null) { throw new NullPointerException(); } if (variableNodes == null) { throw new NullPointerException(); } if (paramComparisons == null) { throw new NullPointerException(); } if (tIndex < 0) { throw new IllegalStateException("TIndex out of range: " + tIndex); } if (mIndex < 0) { throw new IllegalStateException("MIndex out of range: " + mIndex); } if (bIndex < 0) { throw new IllegalStateException("BIndex out of range: " + bIndex); } }
Adds semantic checks to the default deserialization method. This method must have the standard signature for a readObject method, and the body of the method must begin with "s.defaultReadObject();". Other than that, any semantic checks can be specified and do not need to stay the same from version to version. A readObject method of this form may be added to any class, even if Tetrad sessions were previously saved out using a version of the class that didn't include it. (That's what the "s.defaultReadObject();" is for. See J. Bloch, Effective Java, for help.
private void encryptBlock(byte[] src,int srcIndex,byte[] dst,int dstIndex){ int xl=BytesTo32bits(src,srcIndex); int xr=BytesTo32bits(src,srcIndex + 4); xl^=P[0]; for (int i=1; i < ROUNDS; i+=2) { xr^=F(xl) ^ P[i]; xl^=F(xr) ^ P[i + 1]; } xr^=P[ROUNDS + 1]; Bits32ToBytes(xr,dst,dstIndex); Bits32ToBytes(xl,dst,dstIndex + 4); }
Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:53.872 -0400",hash_original_method="C366AABFB464B05ADB50C836A40C4BAE",hash_generated_method="5A0462484410C7D0FF9FB0F000ABDD57") @DSSafe(DSCat.SAFE_LIST) @Deprecated public static IOFileFilter andFileFilter(IOFileFilter filter1,IOFileFilter filter2){ return new AndFileFilter(filter1,filter2); }
Returns a filter that ANDs the two specified filters.
public final Key unwrap(byte[] wrappedKey,String wrappedKeyAlgorithm,int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException { if (mode != UNWRAP_MODE) { throw new IllegalStateException(); } return spiImpl.engineUnwrap(wrappedKey,wrappedKeyAlgorithm,wrappedKeyType); }
Unwraps a key using this cipher instance.
public void release(){ synchronized (LoginManager.class) { if (refCount == 0) throw new IllegalStateException("release called on LoginManager with refCount == 0"); else if (refCount == 1) { CACHED_INSTANCES.remove(loginType); login.shutdown(); } --refCount; } }
Decrease the reference count for this instance and release resources if it reaches 0.
public DependencySortedWrapper(final Element element,final int sortOrder){ super(element,sortOrder); }
Instantiates a new child element sorted wrapper with a dependency element.
public static ProgressDialog createActionLoading(Context context){ ProgressDialog dialog=new ProgressDialog(context); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.setMessage(context.getString(R.string.loading)); return dialog; }
Constructing progress dialog for action loading
public void write(org.apache.thrift.protocol.TProtocol oprot,Message struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.receivers != null) { oprot.writeFieldBegin(RECEIVERS_FIELD_DESC); oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING,struct.receivers.size())); for ( String _iter10 : struct.receivers) { oprot.writeString(_iter10); } oprot.writeListEnd(); oprot.writeFieldEnd(); } if (struct.sender != null) { oprot.writeFieldBegin(SENDER_FIELD_DESC); oprot.writeString(struct.sender); oprot.writeFieldEnd(); } if (struct.subject != null) { if (struct.isSetSubject()) { oprot.writeFieldBegin(SUBJECT_FIELD_DESC); oprot.writeString(struct.subject); oprot.writeFieldEnd(); } } if (struct.messageType != null) { if (struct.isSetMessageType()) { oprot.writeFieldBegin(MESSAGE_TYPE_FIELD_DESC); oprot.writeString(struct.messageType); oprot.writeFieldEnd(); } } if (struct.extendAttrs != null) { if (struct.isSetExtendAttrs()) { oprot.writeFieldBegin(EXTEND_ATTRS_FIELD_DESC); oprot.writeString(struct.extendAttrs); oprot.writeFieldEnd(); } } if (struct.attachments != null) { if (struct.isSetAttachments()) { oprot.writeFieldBegin(ATTACHMENTS_FIELD_DESC); oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,struct.attachments.size())); for ( Attachment _iter11 : struct.attachments) { _iter11.write(oprot); } oprot.writeListEnd(); oprot.writeFieldEnd(); } } if (struct.params != null) { if (struct.isSetParams()) { oprot.writeFieldBegin(PARAMS_FIELD_DESC); oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING,org.apache.thrift.protocol.TType.STRING,struct.params.size())); for ( Map.Entry<String,String> _iter12 : struct.params.entrySet()) { oprot.writeString(_iter12.getKey()); oprot.writeString(_iter12.getValue()); } oprot.writeMapEnd(); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
Description: <br>
@Override public boolean equals(Object obj){ if (obj == this) { return true; } if (!(obj instanceof YIntervalRenderer)) { return false; } YIntervalRenderer that=(YIntervalRenderer)obj; if (!ObjectUtilities.equal(this.additionalItemLabelGenerator,that.additionalItemLabelGenerator)) { return false; } return super.equals(obj); }
Tests this renderer for equality with an arbitrary object.
public Object clone(){ return new StateInfo(this); }
Creates and returns a copy of this StateInfo.
public void addColumn(Column column){ if (!allTableColumns.contains(column)) { allTableColumns.add(column); } }
Adds a columns to the table.
public static void main(String[] args){ ClassCache cache=new ClassCache(); Enumeration<String> packages=cache.packages(); while (packages.hasMoreElements()) { String key=packages.nextElement(); System.out.println(key + ": " + cache.getClassnames(key).size()); } }
For testing only.
public void save(Context context){ if (_id == null) { _id=CPOrm.insert(context,this); } else CPOrm.update(context,this); }
Checks if this record has an id, if the id is present this record will be updated, if it is null, it will be inserted instead, and the inserted id assigned to this one.
protected int findWrapPos(String text,int width,int startPos){ int pos=-1; if (((pos=text.indexOf('\n',startPos)) != -1 && pos <= width) || ((pos=text.indexOf('\t',startPos)) != -1 && pos <= width)) { return pos + 1; } else if (startPos + width >= text.length()) { return -1; } pos=startPos + width; char c; while ((pos >= startPos) && ((c=text.charAt(pos)) != ' ') && (c != '\n')&& (c != '\r')) { --pos; } if (pos > startPos) { return pos; } pos=startPos + width; while ((pos <= text.length()) && ((c=text.charAt(pos)) != ' ') && (c != '\n')&& (c != '\r')) { ++pos; } return (pos == text.length()) ? (-1) : pos; }
Finds the next text wrap position after <code>startPos</code> for the text in <code>text</code> with the column width <code>width</code>. The wrap point is the last postion before startPos+width having a whitespace character (space, \n, \r).
public void testGetThenReset(){ DoubleAccumulator ai=new DoubleAccumulator(null,0.0); ai.accumulate(2.0); assertEquals(2.0,ai.get()); assertEquals(2.0,ai.getThenReset()); assertEquals(0.0,ai.get()); }
getThenReset() returns current value; subsequent get() returns zero
protected int findNext(int from){ if (from < -1) return -1; final int to=this.allHeaders.size() - 1; boolean found=false; while (!found && (from < to)) { from++; found=filterHeader(from); } return found ? from : -1; }
Determines the index of the next header.
private String generateMessageId(LinuxSyslogLineParser lineParser,IThresholdSetter thresholdSetter) throws AdeException { if (thresholdSetter == null) { thresholdSetter=new TextClusteringComponentModel.SimpleThresholdSetter(); } final TextClusteringModel model=m_textClusteringComponentModel.getTextClusteringModel(lineParser.m_component,thresholdSetter); return model.getComponentName() + "_" + model.getOrAddCluster(lineParser.m_text,lineParser.m_msgTime).getClusterId(); }
Generates message id based on the component's clustering model.
public SmoothOverScroller(Context context,Interpolator interpolator,float bounceCoefficientX,float bounceCoefficientY){ this(context,interpolator,true); }
Creates an OverScroller with flywheel enabled.