code
stringlengths
10
174k
nl
stringlengths
3
129k
private void parseNodeString(String nodeLine){ StringTokenizer tokenizer=new StringTokenizer(nodeLine); int parameters=3; if (nodeLine.contains("Edges:")) { state=PARSE_EDGES; return; } if (!tokenizer.hasMoreElements()) { return; } int nodeID=0; String nodeLabel=""; int xPos=0; int yPos=0; for (int actualParam=0; tokenizer.hasMoreElements() && actualParam < parameters; actualParam++) { String token=tokenizer.nextToken(); switch (actualParam) { case 0: nodeID=Integer.valueOf(token); nodeLabel=Integer.toString(nodeID); break; case 1: xPos=Integer.valueOf(token); break; case 2: yPos=Integer.valueOf(token); break; } } TopologicalNode topoNode=new TopologicalNode(nodeID,nodeLabel,xPos,yPos); graph.addNode(topoNode); }
Parses nodes inside a line from the BRITE file.
public boolean isBackupRunData(){ return backupRunData; }
Gets the value of the backupRunData property.
public Duration plus(long amount){ return withDurationAdded(amount,1); }
Returns a new duration with this length plus that specified. This instance is immutable and is not altered. <p> If the addition is zero, this instance is returned.
private StringBuffer format(BigDecimal number,StringBuffer result,FieldDelegate delegate){ if (multiplier != 1) { number=number.multiply(getBigDecimalMultiplier()); } boolean isNegative=number.signum() == -1; if (isNegative) { number=number.negate(); } synchronized (digitList) { int maxIntDigits=getMaximumIntegerDigits(); int minIntDigits=getMinimumIntegerDigits(); int maxFraDigits=getMaximumFractionDigits(); int minFraDigits=getMinimumFractionDigits(); int maximumDigits=maxIntDigits + maxFraDigits; digitList.set(isNegative,number,useExponentialNotation ? ((maximumDigits < 0) ? Integer.MAX_VALUE : maximumDigits) : maxFraDigits,!useExponentialNotation); return subformat(result,delegate,isNegative,false,maxIntDigits,minIntDigits,maxFraDigits,minFraDigits); } }
Formats a BigDecimal to produce a string.
public static String readValueFromFile(File file,String key) throws IOException { String value=null; if (file.exists()) { Properties prop=new Properties(); FileReader reader=new FileReader(file); prop.load(reader); reader.close(); value=prop.getProperty(key); log.info("The value of property with key({}) is: {}",key,value); return value; } log.info("File({}) doesn't exist",file.getAbsoluteFile()); return null; }
Get the value of property with specific key
public short readShort() throws EOFException { if (iv_bytesinbuffer < 2) { throw new EOFException(); } iv_curptr+=2; iv_bytesinbuffer-=2; return MoreMath.BuildShort(iv_buffer,iv_curptr - 2,true); }
Reads and returns a short
private static <Item extends Comparable>Queue<Item> mergeSortedQueues(Queue<Item> q1,Queue<Item> q2){ return null; }
Returns a new queue that contains the items in q1 and q2 in sorted order. This method should take time linear in the total number of items in q1 and q2. After running this method, q1 and q2 will be empty, and all of their items will be in the returned queue.
public static void processReplyContent(MultipartBody multipartBody,ReplyingOptions replyingOptions){ if (replyingOptions.getReplyTo() != 0) multipartBody.field("reply_to_message_id",String.valueOf(replyingOptions.getReplyTo()),"application/json; charset=utf8;"); if (replyingOptions.getReplyMarkup() != null) { switch (replyingOptions.getReplyMarkup().getType()) { case FORCE_REPLY: multipartBody.field("reply_markup",TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(),ForceReply.class),"application/json; charset=utf8;"); break; case KEYBOARD_HIDE: multipartBody.field("reply_markup",TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(),ReplyKeyboardHide.class),"application/json; charset=utf8;"); break; case KEYBOARD_MARKUP: multipartBody.field("reply_markup",TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(),ReplyKeyboardMarkup.class),"application/json; charset=utf8;"); break; case INLINE_KEYBOARD_MARKUP: multipartBody.field("reply_markup",TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(),InlineKeyboardMarkup.class),"application/json; charset=utf8;"); break; } } }
This does generic processing of ReplyingOptions objects when sending a request to the API
public List<String> listTypes() throws AtlasServiceException { final JSONObject jsonObject=callAPI(API.LIST_TYPES,null); return extractResults(jsonObject,AtlasClient.RESULTS,new ExtractOperation<String,String>()); }
Returns all type names in the system
private static Size clampSize(Size original,double maxArea,Size maxSize){ if (original.getWidth() * original.getHeight() < maxArea && original.getWidth() < maxSize.getWidth() && original.getHeight() < maxSize.getHeight()) { return original; } double ratio=Math.min(Math.sqrt(maxArea / original.area()),1.0f); int width=(int)Math.round(original.width() * ratio); int height=(int)Math.round(original.height() * ratio); if (width > maxSize.width() || height > maxSize.height()) { return computeFitWithinSize(original,maxSize); } return new Size(width,height); }
Given a size, compute a value such that it will downscale the original size to fit within the maxSize bounding box and to be less than the provided area. This will never upscale sizes.
@POST @Path("/internal/switchoverprecheck") @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) public SiteErrorResponse switchoverPrecheck(){ log.info("Precheck for switchover internally"); SiteErrorResponse response=new SiteErrorResponse(); try { precheckForSwitchoverForLocalStandby(); } catch ( InternalServerErrorException e) { log.warn("Failed to precheck switchover",e); response.setErrorMessage(e.getMessage()); response.setServiceCode(e.getServiceCode().ordinal()); return response; } catch ( Exception e) { log.error("Failed to precheck switchover",e); response.setErrorMessage(e.getMessage()); return response; } return response; }
This is internal API to do precheck for switchover
private void removeVolumesFromPhantomStorageGroup(StorageSystem storage,WBEMClient client,URI exportMaskURI,List<URI> volumeURIList,String childGroupName,boolean forceFlag) throws Exception { CloseableIterator<CIMObjectPath> volumePathItr=null; try { Map<StorageGroupPolicyLimitsParam,List<URI>> policyVolumeMap=_helper.groupVolumesBasedOnFastPolicy(storage,volumeURIList); for ( StorageGroupPolicyLimitsParam storageGroupPolicyLimitsParam : policyVolumeMap.keySet()) { if (!_helper.isFastPolicy(storageGroupPolicyLimitsParam.getAutoTierPolicyName())) { continue; } _log.info("Checking if volumes are associated with phantom storage groups with policy name: " + storageGroupPolicyLimitsParam); List<String> storageGroupNames=_helper.findPhantomStorageGroupAssociatedWithFastPolicy(storage,storageGroupPolicyLimitsParam); if (storageGroupNames != null) { for ( String storageGroupName : storageGroupNames) { List<URI> volumesToRemove=new ArrayList<URI>(); List<Volume> volumes=_dbClient.queryObject(Volume.class,policyVolumeMap.get(storageGroupPolicyLimitsParam)); volumePathItr=_helper.getAssociatorNames(storage,_cimPath.getStorageGroupObjectPath(storageGroupName,storage),null,SmisConstants.CIM_STORAGE_VOLUME,null,null); while (volumePathItr.hasNext()) { CIMObjectPath volumePath=volumePathItr.next(); for ( Volume volume : volumes) { if (volume.getNativeGuid().equalsIgnoreCase(_helper.getVolumeNativeGuid(volumePath))) { _log.info("Found volume " + volume.getLabel() + " is in phantom storage group "+ storageGroupName); volumesToRemove.add(volume.getId()); } } } List<URI> inMoreViewsVolumes=new ArrayList<URI>(); for ( URI volumeToRemove : volumesToRemove) { if (_helper.isPhantomVolumeInMultipleMaskingViews(storage,volumeToRemove,childGroupName)) { Volume volume=_dbClient.queryObject(Volume.class,volumeToRemove); _log.info("Volume " + volume.getLabel() + " is in other masking views, so we will not remove it from storage group "+ storageGroupName); inMoreViewsVolumes.add(volume.getId()); } } volumesToRemove.removeAll(inMoreViewsVolumes); if (!volumesToRemove.isEmpty()) { _log.info(String.format("Going to remove volumes %s from phantom storage group %s",Joiner.on("\t").join(volumesToRemove),storageGroupName)); Map<String,List<URI>> phantomGroupVolumeMap=_helper.groupVolumesBasedOnExistingGroups(storage,storageGroupName,volumesToRemove); if (phantomGroupVolumeMap != null && phantomGroupVolumeMap.get(storageGroupName) != null && phantomGroupVolumeMap.get(storageGroupName).size() == volumesToRemove.size() && !_helper.isStorageGroupSizeGreaterThanGivenVolumes(storageGroupName,storage,volumesToRemove.size())) { _log.info("Storage Group has no more than {} volumes",volumesToRemove.size()); URI blockURI=volumesToRemove.get(0); BlockObject blockObj=BlockObject.fetch(_dbClient,blockURI); CIMObjectPath maskingGroupPath=_cimPath.getMaskingGroupPath(storage,storageGroupName,SmisCommandHelper.MASKING_GROUP_TYPE.SE_DeviceMaskingGroup); String foundPolicyName=ControllerUtils.getAutoTieringPolicyName(blockObj.getId(),_dbClient); if (_helper.isFastPolicy(foundPolicyName) && storageGroupPolicyLimitsParam.getAutoTierPolicyName().equalsIgnoreCase(foundPolicyName)) { _log.info("Storage Group {} contains only 1 volume, so this group will be disassociated from FAST because group can not be deleted if associated with FAST",storageGroupName); _helper.removeVolumeGroupFromPolicyAndLimitsAssociation(client,storage,maskingGroupPath); } } String task=UUID.randomUUID().toString(); ExportMaskVolumeToStorageGroupCompleter completer=new ExportMaskVolumeToStorageGroupCompleter(null,exportMaskURI,task); List<URI> volumesInSG=_helper.findVolumesInStorageGroup(storage,storageGroupName,volumesToRemove); List<CIMObjectPath> volumePaths=new ArrayList<CIMObjectPath>(); if (volumesInSG != null && !volumesInSG.isEmpty()) { CIMArgument[] inArgs=_helper.getRemoveVolumesFromMaskingGroupInputArguments(storage,storageGroupName,volumesInSG,forceFlag); CIMArgument[] outArgs=new CIMArgument[5]; _helper.invokeMethodSynchronously(storage,_cimPath.getControllerConfigSvcPath(storage),"RemoveMembers",inArgs,outArgs,new SmisMaskingViewRemoveVolumeJob(null,storage.getId(),volumePaths,null,storageGroupName,_cimPath,completer)); } } } } } } finally { if (volumePathItr != null) { volumePathItr.close(); } } }
Removes the volumes from any phantom storage group. Determine if the volumes are associated with any phantom storage groups. If so, we need to remove volumes from those storage groups and potentially remove them.
public int addScatterPlot(String name,Color color,double[][] XY){ return ((Plot2DCanvas)plotCanvas).addScatterPlot(name,color,XY); }
Adds a scatter plot (each data point is plotted as a single dot marker) to the current plot panel.
public static List<Intersection> intersectTriStrip(final Line line,FloatBuffer vertices,IntBuffer indices){ if (line == null) { String msg=Logging.getMessage("nullValue.LineIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (vertices == null || indices == null) { String msg=Logging.getMessage("nullValue.BufferIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } List<Intersection> intersections=null; for (int n=indices.position(); n < indices.limit() - 2; n++) { Intersection intersection; int i=indices.get(n) * 3; int j=indices.get(n + 1) * 3; int k=indices.get(n + 2) * 3; intersection=intersect(line,vertices.get(i),vertices.get(i + 1),vertices.get(i + 2),vertices.get(j),vertices.get(j + 1),vertices.get(j + 2),vertices.get(k),vertices.get(k + 1),vertices.get(k + 2)); if (intersection != null) { if (intersections == null) intersections=new ArrayList<Intersection>(); intersections.add(intersection); } } return intersections; }
Compute the intersections of a line with a triangle strip.
public void destroy(){ super.destroy(); }
Destruction of the servlet. <br>
public void openOptionsMenu(){ mWindow.openPanel(Window.FEATURE_OPTIONS_PANEL,null); }
Programmatically opens the options menu. If the options menu is already open, this method does nothing.
public void drawSelector(View content,Canvas canvas,float openPercent){ if (!mSelectorEnabled) return; if (mSelectorDrawable != null && mSelectedView != null) { String tag=(String)mSelectedView.getTag(selectedViewId); if (tag.equals(TAG + "SelectedView")) { canvas.save(); int left, right, offset; offset=(int)(mSelectorDrawable.getWidth() * openPercent); if (mMode == SlidingMenu.LEFT) { right=content.getLeft(); left=right - offset; canvas.clipRect(left,0,right,getHeight()); canvas.drawBitmap(mSelectorDrawable,left,getSelectorTop(),null); } else if (mMode == SlidingMenu.RIGHT) { left=content.getRight(); right=left + offset; canvas.clipRect(left,0,right,getHeight()); canvas.drawBitmap(mSelectorDrawable,right - mSelectorDrawable.getWidth(),getSelectorTop(),null); } canvas.restore(); } } }
Draw selector.
public boolean checkParity(){ int len=getNumDataElements(); int chksum=0xff; int loop; if (getOpCode() == 0xD3 && len > 6) { int sum=0xFF; for (loop=0; loop < 5; loop++) { sum=sum ^ getElement(loop); } if (getElement(5) != sum) { return false; } sum=0xFF; for (loop=6; loop < len - 1; loop++) { sum=sum ^ getElement(loop); } if (getElement(len - 1) != sum) { return false; } return true; } for (loop=0; loop < len - 1; loop++) { chksum^=getElement(loop); } return (chksum == getElement(len - 1)); }
check whether the message has a valid parity
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; }
Execute the function. The function must return a valid object.
private void notifyDataSetChanged(){ addDebugText("notifyDataSetChanged"); adapter.notifyDataSetChanged(); }
Notifies the list view adapter the data has changed and refreshes the list view
private SystemPropertiesProxy(){ }
This class cannot be instantiated
public synchronized boolean hasChapterWeek(){ try { final Query query=new Query().addSort(Keys.OBJECT_ID,SortDirection.DESCENDING).setCurrentPageNum(1).setPageSize(1); query.setFilter(new PropertyFilter(Article.ARTICLE_TYPE,FilterOperator.EQUAL,Article.ARTICLE_TYPE_C_JOURNAL_CHAPTER)); final JSONObject result=articleRepository.get(query); final List<JSONObject> journals=CollectionUtils.<JSONObject>jsonArrayToList(result.optJSONArray(Keys.RESULTS)); if (journals.isEmpty()) { return false; } final JSONObject maybeToday=journals.get(0); final long created=maybeToday.optLong(Article.ARTICLE_CREATE_TIME); return Times.isSameWeek(new Date(created),new Date()); } catch ( final RepositoryException e) { LOGGER.log(Level.ERROR,"Check chapter generated failed",e); return false; } }
Chapter generated this week?
public RetentionPolicy retention(){ return retention; }
Returns the retention policy for this annotation type.
public ContentLengthOutputStream(final SessionOutputBuffer out,long contentLength){ super(); if (out == null) { throw new IllegalArgumentException("Session output buffer may not be null"); } if (contentLength < 0) { throw new IllegalArgumentException("Content length may not be negative"); } this.out=out; this.contentLength=contentLength; }
Creates a new length limited stream
public String minLogLikelihoodImprovementIteratingTipText(){ return "The minimum improvement in log likelihood required to " + "perform another iteration of the E and M steps"; }
Returns the tip text for this property
public void startInternalActivity(Intent intent,boolean requireBackStack){ isNextActionInternal=true; if (requireBackStack) addRequirementsToIntent(intent); activity.startActivity(intent); }
Starts a new activity within the application
@Override protected void blendModeImpl(){ if (blendMode != lastBlendMode) { flush(); } pgl.enable(PGL.BLEND); if (blendMode == REPLACE) { if (blendEqSupported) { pgl.blendEquation(PGL.FUNC_ADD); } pgl.blendFunc(PGL.ONE,PGL.ZERO); } else if (blendMode == BLEND) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_ADD,PGL.FUNC_ADD); } pgl.blendFuncSeparate(PGL.SRC_ALPHA,PGL.ONE_MINUS_SRC_ALPHA,PGL.ONE,PGL.ONE); } else if (blendMode == ADD) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_ADD,PGL.FUNC_ADD); } pgl.blendFuncSeparate(PGL.SRC_ALPHA,PGL.ONE,PGL.ONE,PGL.ONE); } else if (blendMode == SUBTRACT) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_REVERSE_SUBTRACT,PGL.FUNC_ADD); pgl.blendFuncSeparate(PGL.SRC_ALPHA,PGL.ONE,PGL.ONE,PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR,"SUBTRACT"); } } else if (blendMode == LIGHTEST) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_MAX,PGL.FUNC_ADD); pgl.blendFuncSeparate(PGL.ONE,PGL.ONE,PGL.ONE,PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR,"LIGHTEST"); } } else if (blendMode == DARKEST) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_MIN,PGL.FUNC_ADD); pgl.blendFuncSeparate(PGL.ONE,PGL.ONE,PGL.ONE,PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR,"DARKEST"); } } else if (blendMode == EXCLUSION) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_ADD,PGL.FUNC_ADD); } pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR,PGL.ONE_MINUS_SRC_COLOR,PGL.ONE,PGL.ONE); } else if (blendMode == MULTIPLY) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_ADD,PGL.FUNC_ADD); } pgl.blendFuncSeparate(PGL.ZERO,PGL.SRC_COLOR,PGL.ONE,PGL.ONE); } else if (blendMode == SCREEN) { if (blendEqSupported) { pgl.blendEquationSeparate(PGL.FUNC_ADD,PGL.FUNC_ADD); } pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR,PGL.ONE,PGL.ONE,PGL.ONE); } else if (blendMode == DIFFERENCE) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"DIFFERENCE"); } else if (blendMode == OVERLAY) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"OVERLAY"); } else if (blendMode == HARD_LIGHT) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"HARD_LIGHT"); } else if (blendMode == SOFT_LIGHT) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"SOFT_LIGHT"); } else if (blendMode == DODGE) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"DODGE"); } else if (blendMode == BURN) { PGraphics.showWarning(BLEND_RENDERER_ERROR,"BURN"); } lastBlendMode=blendMode; }
Allows to set custom blend modes for the entire scene, using openGL. Reference article about blending modes: http://www.pegtop.net/delphi/articles/blendmodes/ DIFFERENCE, HARD_LIGHT, SOFT_LIGHT, OVERLAY, DODGE, BURN modes cannot be implemented in fixed-function pipeline because they require conditional blending and non-linear blending equations.
public static float dp(Context context,float dp){ return applyDimension(COMPLEX_UNIT_DIP,dp,context.getResources().getDisplayMetrics()); }
Util method to convert a DP value in pixels
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:54.222 -0400",hash_original_method="0850C4F50DF9074FD1264564BB99F7E9",hash_generated_method="A520A96F7749BBC59CBB734AA3915CEC") public static boolean contentEquals(Reader input1,Reader input2) throws IOException { input1=toBufferedReader(input1); input2=toBufferedReader(input2); int ch=input1.read(); while (EOF != ch) { int ch2=input2.read(); if (ch != ch2) { return false; } ch=input1.read(); } int ch2=input2.read(); return ch2 == EOF; }
Compare the contents of two Readers to determine if they are equal or not. <p> This method buffers the input internally using <code>BufferedReader</code> if they are not already buffered.
public boolean is_set_property(){ return this.property != null; }
Returns true if field property is set (has been assigned a value) and false otherwise
public void processPacket(Packet packet){ if (pingMinDelta > 0) { long currentMillies=System.currentTimeMillis(); long delta=currentMillies - lastPingStamp; lastPingStamp=currentMillies; if (delta < pingMinDelta) { return; } } Pong pong=new Pong((Ping)packet); connection.sendPacket(pong); }
Sends a Pong for every Ping
@Override public void offsetWrite(ObjectReference src,Address slot,Offset value,Word metaDataA,Word metaDataB,int mode){ VM.barriers.offsetWrite(src,value,metaDataA,metaDataB,mode); }
Write an Offset. Take appropriate write barrier actions.
private static void swap(Object x[],int a,int b){ Object t=x[a]; x[a]=x[b]; x[b]=t; }
Swaps x[a] with x[b].
public void schedule(String serviceName,Map<String,? extends Object> context,long startTime,int frequency,int interval,int count) throws JobManagerException { schedule(serviceName,context,startTime,frequency,interval,count,0); }
Schedule a job to start at a specific time with specific recurrence info
public boolean isBPInstructionEnabled(){ return (bpStatus == BPINSTRUCTION_STATUS.ENABLED); }
Check if breakpoint instruction is enabled
static String path(String uri){ int i=uri.indexOf("://"); if (i == -1) { i=0; } else { i=uri.indexOf('/',i + 3); if (i == -1) { return "/"; } } int queryStart=uri.indexOf('?',i); if (queryStart == -1) { queryStart=uri.length(); } return uri.substring(i,queryStart); }
Extract the path out of the uri.
private void errAboutTextRun() throws SAXException { err("Source text is not in Unicode Normalization Form C."); alreadyComplainedAboutThisRun=true; }
Emits an error stating that the current text run or the source text is not in NFC.
public int size(){ return this.realTSindex.size(); }
Get the collection size in indexes.
public CDeleteBookmarkAction(final CCodeBookmarkManager manager,final int[] rows){ super(rows.length == 1 ? "Delete Bookmark" : "Delete Bookmarks"); m_manager=Preconditions.checkNotNull(manager,"IE01314: Bookmark manager argument can not be null"); m_rows=rows.clone(); }
Creates a new action object.
public Consist newConsist(String name){ Consist consist=getConsistByName(name); if (consist == null) { consist=new Consist(name); Integer oldSize=Integer.valueOf(_consistHashTable.size()); _consistHashTable.put(name,consist); setDirtyAndFirePropertyChange(CONSISTLISTLENGTH_CHANGED_PROPERTY,oldSize,Integer.valueOf(_consistHashTable.size())); } return consist; }
Creates a new consist if needed
private void validateText(InputNode node,Schema schema) throws Exception { Label label=schema.getText(); if (label != null) { validate(node,label); } }
This <code>validateText</code> method validates the text value from the XML element node specified. This will check the class schema to determine if a <code>Text</code> annotation was used. If one was specified then the text within the XML element input node is checked to determine if it is a valid entry.
@Override public void onClick(final DialogInterface dialog,final int which){ Visibility visibility=Visibility.PRIVATE; switch (visibilitySpinner.getSelectedItemPosition()) { case 0: visibility=Visibility.PRIVATE; break; case 1: visibility=Visibility.PUBLIC; break; case 2: visibility=Visibility.TRACKABLE; break; case 3: visibility=Visibility.IDENTIFIABLE; break; } caller.performTrackUpload(descriptionField.getText().toString(),tagsField.getText().toString(),visibility); }
note: the current code will only work if the string array in strings.xml is not changed
public static float byte315ToFloat(byte b){ if (b == 0) return 0.0f; int bits=(b & 0xff) << (24 - 3); bits+=(63 - 15) << 24; return Float.intBitsToFloat(bits); }
byteToFloat(b, mantissaBits=3, zeroExponent=15)
public static long invgrayC(long v){ v^=(v >>> 1); v^=(v >>> 2); v^=(v >>> 4); v^=(v >>> 8); v^=(v >>> 16); v^=(v >>> 32); return v; }
Compute the inverted gray code, v XOR (v >>> 1) XOR (v >>> 2) ...
public DagInPatternIterator(Graph pattern,IKnowledge knowledge,boolean allowArbitraryOrientations,boolean allowNewColliders){ if (knowledge == null) { this.knowledge=new Knowledge2(); } else { this.knowledge=knowledge; } this.allowNewColliders=allowNewColliders; assert knowledge != null; if (knowledge.isViolatedBy(pattern)) { throw new IllegalArgumentException("The pattern already violates that knowledge."); } HashMap<Graph,Set<Edge>> changedEdges=new HashMap<>(); changedEdges.put(pattern,new HashSet<Edge>()); decoratedGraphs.add(new DecoratedGraph(pattern,getKnowledge(),changedEdges,allowArbitraryOrientations)); this.colliders=GraphUtils.listColliderTriples(pattern); }
The given pattern must be a pattern. If it does not consist entirely of directed and undirected edges and if it is not acyclic, it is rejected.
public boolean addAliasByNumber(String aliasName,String number){ if (aliasName.contains("'")) return false; String contactName=ContactsManager.getContactNameOrNull(ctx,number); addOrUpdate(aliasName,number,contactName); return true; }
Adds an alias by a phone number if the alias contains an invalid character, false will be returned
@POST @Consumes("application/json") @ApiOperation(value="Add a stock item",notes="Add a valid stock item") public void addStock(@ApiParam(value="Stock object",required=true) Stock stock) throws DuplicateSymbolException { String symbol=stock.getSymbol(); if (stockQuotes.containsKey(symbol)) { throw new DuplicateSymbolException("Symbol " + symbol + " already exists"); } stockQuotes.put(symbol,stock); }
Add a new stock. curl -v -X POST -H "Content-Type:application/json" \ -d '{"symbol":"BAR","name": "Bar Inc.", \ "last":149.62,"low":150.78,"high":149.18, "createdByHost":"10.100.1.192"}' \ http://localhost:8080/stockquote
public TypeVariable typeVariable(Type type){ return typeVariable(ClassHierarchy.v().typeNode(type)); }
Get type variable for the given type.
private static void extractDirective(String key,byte[] value,String[] keyTable,byte[][] valueTable,List<byte[]> realmChoices,int realmIndex) throws SaslException { for (int i=0; i < keyTable.length; i++) { if (key.equalsIgnoreCase(keyTable[i])) { if (valueTable[i] == null) { valueTable[i]=value; if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE,"DIGEST11:Directive {0} = {1}",new Object[]{keyTable[i],new String(valueTable[i])}); } } else if (realmChoices != null && i == realmIndex) { if (realmChoices.isEmpty()) { realmChoices.add(valueTable[i]); } realmChoices.add(value); } else { throw new SaslException("DIGEST-MD5: peer sent more than one " + key + " directive: "+ new String(value)); } break; } } }
Processes directive/value pairs from the digest-challenge and fill out the challengeVal array.
public final boolean hasCategory(String category){ return mCategories != null && mCategories.contains(category); }
Is the given category included in the filter?
private long endTime(){ long endTime=System.currentTimeMillis(); Task<T> finishedTask=tasks.latestFinishedTask(); if (finishedTask != null && finishedTask.getEndTime() != null) { endTime=finishedTask.getEndTime().getTimeInMillis(); } return endTime; }
Gets the end time of the latest finished task or the current time if no tasks are yet finished.
private void endSection() throws SAXException { for (int i=0, len=currentSection.validators.size(); i < len; i++) { Validator validator=(Validator)currentSection.validators.elementAt(i); cleanupHandler(validator.getContentHandler()); releaseValidator((Schema)currentSection.schemas.elementAt(i),validator); currentSection.validators.setElementAt(null,i); } currentSection=currentSection.parent; }
End a section, its depth reached zero.
private void writeFlowModToSwitch(DatapathId dpid,OFFlowMod flowMod){ IOFSwitch ofSwitch=switchService.getSwitch(dpid); if (ofSwitch == null) { if (log.isDebugEnabled()) { log.debug("Not deleting key {} :: switch {} not connected",dpid.toString()); } return; } writeFlowModToSwitch(ofSwitch,flowMod); }
Writes an OFFlowMod to a switch. It checks to make sure the switch exists before it sends
public static String quoteIdentifier(String identifier,boolean isPedantic){ return quoteIdentifier(identifier,"`",isPedantic); }
Surrounds identifier with "`" and duplicates these symbols inside the identifier.
public static PropertyValuesHolder ofInt(String propertyName,int... values){ return new IntPropertyValuesHolder(propertyName,values); }
Constructs and returns a PropertyValuesHolder with a given property name and set of int values.
private static String maybeGetDevJarPath(IJavaProject project){ try { if (GWTProjectsRuntime.isGWTRuntimeProject(project)) { GwtSdk tempContribSDK=GWTProjectsRuntime.syntheziseContributorRuntime(); if (tempContribSDK.validate().isOK()) { return tempContribSDK.getDevJar().getAbsolutePath(); } else { return ""; } } GwtSdk sdk=GwtSdk.findSdkFor(project); if (sdk.usesGwtDevProject()) { File gwtDevJarFile=sdk.getDevJar(); return gwtDevJarFile.getAbsolutePath(); } } catch ( SdkException sdke) { GWTPluginLog.logError(sdke,"Unable to extract gwt dev jar argument from GWTProjectsRuntime"); } catch ( JavaModelException jme) { GWTPluginLog.logError(jme,"Unable to extract gwt dev jar argument from GWTProjectsRuntime"); } return ""; }
Returns the path to the gwt-dev-xxx.jar in the event that the launch configuration depends on a GWT Contributor Runtime. Otherwise, returns the empty string.
public static char binaryToHexDigit(final boolean[] src,final int srcPos){ if (src.length == 0) { throw new IllegalArgumentException("Cannot convert an empty array."); } if (src.length > srcPos + 3 && src[srcPos + 3]) { if (src.length > srcPos + 2 && src[srcPos + 2]) { if (src.length > srcPos + 1 && src[srcPos + 1]) { return src[srcPos] ? 'f' : 'e'; } return src[srcPos] ? 'd' : 'c'; } if (src.length > srcPos + 1 && src[srcPos + 1]) { return src[srcPos] ? 'b' : 'a'; } return src[srcPos] ? '9' : '8'; } if (src.length > srcPos + 2 && src[srcPos + 2]) { if (src.length > srcPos + 1 && src[srcPos + 1]) { return src[srcPos] ? '7' : '6'; } return src[srcPos] ? '5' : '4'; } if (src.length > srcPos + 1 && src[srcPos + 1]) { return src[srcPos] ? '3' : '2'; } return src[srcPos] ? '1' : '0'; }
<p> Converts binary (represented as boolean array) to a hexadecimal digit using the default (Lsb0) bit ordering. </p> <p> (1, 0, 0, 0) is converted as follow: '1' </p>
private static int compareVersion(String versionStr1,String versionStr2){ if (versionStr1 == null) { throw new MLContextException("First version argument to compareVersion() is null"); } if (versionStr2 == null) { throw new MLContextException("Second version argument to compareVersion() is null"); } Scanner scanner1=null; Scanner scanner2=null; try { scanner1=new Scanner(versionStr1); scanner2=new Scanner(versionStr2); scanner1.useDelimiter("\\."); scanner2.useDelimiter("\\."); while (scanner1.hasNextInt() && scanner2.hasNextInt()) { int version1=scanner1.nextInt(); int version2=scanner2.nextInt(); if (version1 < version2) { return -1; } else if (version1 > version2) { return 1; } } return scanner1.hasNextInt() ? 1 : 0; } finally { scanner1.close(); scanner2.close(); } }
Compare two version strings (ie, "1.4.0" and "1.4.1").
public static void swap(long[] array){ for (int i=0; i < array.length; i++) array[i]=swap(array[i]); }
Byte swap an array of longs. The result of the swapping is put back into the specified array.
@Override public void writeValueEOF(){ m_oId=null; m_jTaxID.setText(null); m_jSearchkey.setText(null); m_jName.setText(null); m_CategoryModel.setSelectedKey(null); m_jNotes.setText(null); txtMaxdebt.setText(null); txtDiscount.setText(null); txtCurdebt.setText(null); txtCurdate.setText(null); m_jVisible.setSelected(false); jcard.setText(null); txtFirstName.setText(null); txtLastName.setText(null); txtEmail.setText(null); txtPhone.setText(null); txtPhone2.setText(null); txtFax.setText(null); m_jImage.setImage(null); txtAddress.setText(null); txtAddress2.setText(null); txtPostal.setText(null); txtCity.setText(null); txtRegion.setText(null); txtCountry.setText(null); j_mDOB.setText(null); m_jTaxID.setEnabled(false); m_jSearchkey.setEnabled(false); m_jName.setEnabled(false); m_jCategory.setEnabled(false); m_jNotes.setEnabled(false); txtMaxdebt.setEnabled(false); txtDiscount.setEnabled(false); txtCurdebt.setEnabled(false); txtCurdate.setEnabled(false); m_jVisible.setEnabled(false); jcard.setEnabled(false); txtFirstName.setEnabled(false); txtLastName.setEnabled(false); txtEmail.setEnabled(false); txtPhone.setEnabled(false); txtPhone2.setEnabled(false); txtFax.setEnabled(false); m_jImage.setEnabled(false); txtAddress.setEnabled(false); txtAddress2.setEnabled(false); txtPostal.setEnabled(false); txtCity.setEnabled(false); txtRegion.setEnabled(false); txtCountry.setEnabled(false); jButton2.setEnabled(false); jButton3.setEnabled(false); jTable1.setEnabled(false); jTable1.setVisible(false); j_mDOB.setEnabled(false); }
Write EOF
public Iterator iterator(){ return options.iterator(); }
Returns an iterator over the Option members of CommandLine.
public static void save(Tree t,Parser parser,String fileName) throws IOException, PrintException { List<String> ruleNames=parser != null ? Arrays.asList(parser.getRuleNames()) : null; save(t,ruleNames,fileName); }
Save this tree in a postscript file
private int calculateInitialRotation(){ final File[] matchingFiles=getMatchingFiles(); if (null == matchingFiles || 0 == matchingFiles.length) { return 0; } final int[] rotations=calculateRotations(matchingFiles); int maxRotation=0; for (int i=0; i < rotations.length; i++) { final int rotation=rotations[i]; if (rotation > maxRotation) { maxRotation=rotation; } } if (m_maxRotations != maxRotation) { return maxRotation + 1; } long time=matchingFiles[0].lastModified(); int oldest=rotations[0]; for (int i=0; i < matchingFiles.length; i++) { final File file=matchingFiles[i]; final long lastModified=file.lastModified(); if (lastModified < time) { time=lastModified; oldest=rotations[i]; } } return oldest; }
Method that searches through files that match the pattern for resolving file and determine the last generation written to.
public MultipartFormContentType(){ this.boundary=createBoundary(); }
Constructs a multipart token
public static Calendar toCalendar(String datestring,String format){ Date d=parse(datestring,format); Calendar cal=Calendar.getInstance(); cal.setTimeInMillis(d.getTime()); return cal; }
Returns a calendar from a given string using the provided format.
public void onEvent(Event e){ if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) dispose(); else if (e.getTarget().getId().equals(ConfirmPanel.A_REFRESH) || e.getTarget().getId().equals(ConfirmPanel.A_OK)) refresh(); else if (e.getTarget().getId().equals(ConfirmPanel.A_ZOOM)) zoom(); }
Action Listener
public boolean contains(int x,int y){ return left < right && top < bottom && x >= left && x < right && y >= top && y < bottom; }
Returns true if (x,y) is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a x,y to be contained: left <= x < right and top <= y < bottom. An empty rectangle never contains any point.
protected void printlnIdentifier(String identifier,StringBuilder ddl){ println(getDelimitedIdentifier(identifier),ddl); }
Prints the given identifier followed by a newline. For most databases, this will be a delimited identifier.
public WindowBuilder layout(final AbstractLayout layout){ this.layout=layout; return this; }
Set the layout.
public int closestAxisPlane(){ double xmag=Math.abs(normal.getX()); double ymag=Math.abs(normal.getY()); double zmag=Math.abs(normal.getZ()); if (xmag > ymag) { if (xmag > zmag) return YZ_PLANE; else return XY_PLANE; } else if (zmag > ymag) { return XY_PLANE; } return XZ_PLANE; }
Computes the axis plane that this plane lies closest to. <p> Geometries lying in this plane undergo least distortion (and have maximum area) when projected to the closest axis plane. This provides optimal conditioning for computing a Point-in-Polygon test.
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
@Override public synchronized void close(){ if (closed) return; Code.wrapThrow(null); closed=true; }
Close the read-only SAIL connection.
private void createExplosion(float x,float y,float maxForce){ float force; Vector2 touch=new Vector2(x,y); for (int i=0; i < bodies.length; i++) { Body b=bodies[i]; Vector2 v=b.getPosition(); float dist=v.dst2(touch); if (dist == 0) force=maxForce; else force=MathUtils.clamp(maxForce / dist,0,maxForce); float angle=v.cpy().sub(touch).angle(); float xForce=force * MathUtils.cosDeg(angle); float yForce=force * MathUtils.sinDeg(angle); Vector3 touch3, v3, boundMin, boundMax, intersection; touch3=new Vector3(touch.x,touch.y,0); v3=new Vector3(v.x,v.y,0); boundMin=new Vector3(v.x - 1,v.y - 1,0); boundMax=new Vector3(v.x + 1,v.y + 1,0); intersection=Vector3.Zero; Intersector.intersectRayBounds(new Ray(touch3,v3),new BoundingBox(boundMin,boundMax),intersection); b.applyForce(new Vector2(xForce,yForce),new Vector2(intersection.x,intersection.y),true); } }
Creates an explosion that applies forces to the bodies relative to their position and the given x and y values.
public static boolean isAttachment(String contentDisposition){ return contentDisposition != null && contentDisposition.regionMatches(true,0,"attachment",0,10); }
Returns true if the download meant to be treated as an attachment.
public void startRecording(EncoderConfig config){ Log.d(TAG,"Encoder: startRecording()"); synchronized (mReadyFence) { if (mRunning) { Log.w(TAG,"Encoder thread already running"); return; } mRunning=true; new Thread(this,"TextureMovieEncoder").start(); while (!mReady) { try { mReadyFence.wait(); } catch ( InterruptedException ie) { } } } mHandler.sendMessage(mHandler.obtainMessage(MSG_START_RECORDING,config)); }
Tells the video recorder to start recording. (Call from non-encoder thread.) <p> Creates a new thread, which will create an encoder using the provided configuration. <p> Returns after the recorder thread has started and is ready to accept Messages. The encoder may not yet be fully configured.
private void reportError(String context,String fmt,Object... args){ String message=String.format(fmt,args); reasons.add(context + ": " + message); }
Report an error in the current context.
public SlidingWindows withOffset(Duration offset){ return new SlidingWindows(period,size,offset); }
Assigns timestamps into half-open intervals of the form [N * period + offset, N * period + offset + size).
public synchronized void playDead(){ if (!playingDead) { playingDead=true; logger.info("GroupMembershipService.playDead invoked for {}",this.address); services.getJoinLeave().playDead(); services.getHealthMonitor().playDead(); services.getMessenger().playDead(); } }
Test hook - don't answer "are you alive" requests
public static boolean isTestDir(String dirName){ return (!dirName.equals("script-tests") && !dirName.equals("resources") && !dirName.startsWith(".")); }
Checks if the directory may contain tests or contains just helper files.
public static java.util.Date parseDateTime(String date,String format,String locale,String timeZone){ SimpleDateFormat dateFormat=getDateFormat(format,locale,timeZone); try { synchronized (dateFormat) { return dateFormat.parse(date); } } catch ( Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1,e,date); } }
Parses a date using a format string.
private static int readBgzfBlock(InputStream fis,byte[] buf,BgzfBlock block) throws IOException { final int first=fis.read(); if (first == -1) { return -1; } int tot=1; tot+=readIOFully(fis,buf,11); block.mExtraLength=ByteArrayIOUtils.bytesToShortLittleEndian(buf,9); tot+=readIOFully(fis,buf,block.mExtraLength); if (block.mExtraLength < 6) { throw new IOException("Not a valid BGZF file"); } block.mBlockSize=ByteArrayIOUtils.bytesToShortLittleEndian(buf,4); tot+=readIOFully(fis,block.mData,block.mBlockSize - block.mExtraLength - 19); tot+=readIOFully(fis,buf,8); block.mCrc=ByteArrayIOUtils.bytesToIntLittleEndian(buf,0); block.mInputSize=ByteArrayIOUtils.bytesToIntLittleEndian(buf,4); assert tot == block.mBlockSize + 1 : "tot: " + tot + " blocksize: "+ block.mBlockSize; return tot; }
Reads a <code>BGZF</code> block
public boolean canUndo(){ return alive && hasBeenDone; }
Returns true if this edit is <code>alive</code> and <code>hasBeenDone</code> is <code>true</code>.
public static boolean isDefined(int codePoint){ return getType(codePoint) != Character.UNASSIGNED; }
Determines if a character (Unicode code point) is defined in Unicode. <p> A character is defined if at least one of the following is true: <ul> <li>It has an entry in the UnicodeData file. <li>It has a value in a range defined by the UnicodeData file. </ul>
private void createMediaPlayerIfNeeded(){ LogHelper.d(TAG,"createMediaPlayerIfNeeded. needed? ",(mMediaPlayer == null)); if (mMediaPlayer == null) { mMediaPlayer=new MediaPlayer(); mMediaPlayer.setWakeMode(mContext.getApplicationContext(),PowerManager.PARTIAL_WAKE_LOCK); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnErrorListener(this); mMediaPlayer.setOnSeekCompleteListener(this); } else { mMediaPlayer.reset(); } }
Makes sure the media player exists and has been reset. This will create the media player if needed, or reset the existing media player if one already exists.
public void close(){ client.close(); client=null; }
Close the zookeeper client.
@Override public boolean eIsSet(int featureID){ switch (featureID) { case N4JSPackage.ANNOTABLE_N4_MEMBER_DECLARATION__ANNOTATION_LIST: return annotationList != null; } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public ExtentTest fail(Throwable t){ log(Status.FAIL,t); return this; }
Logs an event with <code>Status.FAIL</code> and exception
private boolean checkMemberAccess(){ if (this.previousToken == TokenNameDOT && this.qualifier > -1 && this.expressionPtr == this.qualifier) { if (this.identifierLengthPtr > 1 && this.identifierLengthStack[this.identifierLengthPtr - 1] < 0) { return false; } pushCompletionOnMemberAccessOnExpressionStack(false); return true; } return false; }
Checks if the completion is on a member access (i.e. in an identifier following a dot). Returns whether we found a completion node.
protected static void check_unused(){ terminal term; non_terminal nt; for (Enumeration t=terminal.all(); t.hasMoreElements(); ) { term=(terminal)t.nextElement(); if (term == terminal.EOF) continue; if (term == terminal.error) continue; if (term.use_count() == 0) { emit.unused_term++; if (!emit.nowarn) { System.err.println("Warning: Terminal \"" + term.name() + "\" was declared but never used"); lexer.warning_count++; } } } for (Enumeration n=non_terminal.all(); n.hasMoreElements(); ) { nt=(non_terminal)n.nextElement(); if (nt.use_count() == 0) { emit.unused_term++; if (!emit.nowarn) { System.err.println("Warning: Non terminal \"" + nt.name() + "\" was declared but never used"); lexer.warning_count++; } } } }
Check for unused symbols. Unreduced productions get checked when tables are created.
public GridCacheBatchSwapEntry(KeyCacheObject key,int part,ByteBuffer valBytes,byte type,GridCacheVersion ver,long ttl,long expireTime,IgniteUuid keyClsLdrId,@Nullable IgniteUuid valClsLdrId){ super(valBytes,type,ver,ttl,expireTime,keyClsLdrId,valClsLdrId); this.key=key; this.part=part; }
Creates batch swap entry.
@Override public final String sourceExpression(int index,Instances data){ return m_c45S.sourceExpression(index,data); }
Returns a string containing java source code equivalent to the test made at this node. The instance being tested is called "i".
public static byte[] decode(String s,int options) throws java.io.IOException { if (s == null) { throw new NullPointerException("Input string was null."); } byte[] bytes; try { bytes=s.getBytes(PREFERRED_ENCODING); } catch ( java.io.UnsupportedEncodingException uee) { bytes=s.getBytes(); } bytes=decode(bytes,0,bytes.length,options); boolean dontGunzip=(options & DONT_GUNZIP) != 0; if ((bytes != null) && (bytes.length >= 4) && (!dontGunzip)) { int head=((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); if (java.util.zip.GZIPInputStream.GZIP_MAGIC == head) { java.io.ByteArrayInputStream bais=null; java.util.zip.GZIPInputStream gzis=null; java.io.ByteArrayOutputStream baos=null; byte[] buffer=new byte[2048]; int length=0; try { baos=new java.io.ByteArrayOutputStream(); bais=new java.io.ByteArrayInputStream(bytes); gzis=new java.util.zip.GZIPInputStream(bais); while ((length=gzis.read(buffer)) >= 0) { baos.write(buffer,0,length); } bytes=baos.toByteArray(); } catch ( java.io.IOException e) { e.printStackTrace(); } finally { try { baos.close(); } catch ( Exception e) { } try { gzis.close(); } catch ( Exception e) { } try { bais.close(); } catch ( Exception e) { } } } } return bytes; }
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
private void addVNXFileStorageSystemIntoCache(String storageSystemURI,DistributedQueueItemProcessedCallback callBack){ if (StringUtils.isNotEmpty(storageSystemURI)) { VNXFILE_CACHE.put(storageSystemURI,callBack); } }
Adds vnxFile's URI and callback instance into CACHE
static byte complement(final byte b){ if (b == 0) { return 0; } return (byte)(5 - b); }
Compute the complement of a nucleotide expressed as an underlying code.
final void updateHead(Node<E> h,Node<E> p){ if (h != p && casHead(h,p)) h.lazySetNext(h); }
Tries to CAS head to p. If successful, repoint old head to itself as sentinel for succ(), below.
private void verifyWebSocketKey(String key,String accept) throws NoSuchAlgorithmException, HandshakeFailedException { byte[] sha1Bytes=sha1(key + ACCEPT_SALT); String encodedSha1Bytes=Base64.encodeBytes(sha1Bytes).trim(); if (!encodedSha1Bytes.equals(encodedSha1Bytes)) { throw new HandshakeFailedException(); } }
Verifies that the Accept key provided is correctly built from the original key sent.
public AbstractItem(final int id,@Nullable final CharSequence title){ this.id=id; this.title=title; }
Creates a new item.
public void flush(){ updateQueue(); while (getQueueSize() > 0) { updateQueue(); try { Thread.sleep(10); } catch ( InterruptedException e) { throw new RuntimeException(e); } } }
Wait for all the files to be sent to host system.
protected String readLines(int startingLineNumber,String classpathResource){ try (InputStream stream=getClass().getClassLoader().getResourceAsStream(classpathResource)){ assertThat(stream).isNotNull(); StringBuilder sb=new StringBuilder(); AtomicInteger counter=new AtomicInteger(); IoUtil.readLines(stream,null); return sb.toString(); } catch ( IOException e) { fail("Unable to read '" + classpathResource + "'"); } assert false : "should never get here"; return null; }
Reads the lines starting with a given line number from the specified file on the classpath. Any lines preceding the given line number will be included as empty lines, meaning the line numbers will match the input file.
public static Predicate<Number> odd(){ return even().negate(); }
Create a new predicate returning true when the input number is odd.