code
stringlengths
10
174k
nl
stringlengths
3
129k
public static boolean isStatusInformational(int status){ return (status >= 100 && status < 200); }
Returns whether the status is informational (i.e. 1xx).
public static void waitForCompletion(Future<?>[] futures){ int size=futures.length; try { for (int j=0; j < size; j++) { futures[j].get(); } } catch ( ExecutionException ex) { ex.printStackTrace(); } catch ( InterruptedException e) { e.printStackTrace(); } }
Waits for all threads to complete computation.
public String toString(){ return getSelector() + " + " + getSiblingSelector(); }
Returns a representation of the selector.
public static DirectedGraph<Integer,DefaultEdge> loadGraph(String location) throws IOException, ClassNotFoundException { File file=new File(location); if (!file.canWrite()) { throw new IOException("Cannot read from file " + location); } return GraphSerialization.loadGraph(file); }
Deserializes a SerializableDirectedGraph object that is stored in the given<br> location. This method returns the DirectedGraph object, that is wrapped in <br> the SerializableDirectedGraph.
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
public Editor edit() throws IOException { return DiskLruCache.this.edit(key,sequenceNumber); }
Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress.
public LocalTime(int hourOfDay,int minuteOfHour,int secondOfMinute){ this(hourOfDay,minuteOfHour,secondOfMinute,0,ISOChronology.getInstanceUTC()); }
Constructs an instance set to the specified time using <code>ISOChronology</code>.
public final void clear(){ for ( TTEntry ent : table) { ent.type=TTEntry.T_EMPTY; } }
Clear the transposition table.
@DebugLog private void assignColorToPlayer(@NonNull String color,@NonNull PlayerColorChoices player,String reason){ PlayerResult playerResult=new PlayerResult(player.name,player.type,color,reason); results.results.add(playerResult); Timber.i("Assigned %s",playerResult); colorsAvailable.remove(color); playersNeedingColor.remove(player); for ( PlayerColorChoices playerColorChoices : playersNeedingColor) { playerColorChoices.removeChoice(color); } }
Assign a color to a player, and remove both from the list of remaining colors and players. This can't be called from a for each loop without ending the iteration.
public static void filterDataModel(BookFilter filter){ List<Book> booksCopy=new LinkedList<Book>(DataModel.getListOfBooks()); for ( Book book : booksCopy) { if (!filter.didBookPassThroughFilter(book)) { for ( Tag tag : book.getTags()) { List<Book> books=DataModel.getMapOfBooksByTag().get(tag); if (Helper.isNotNullOrEmpty(books)) books.remove(book); if (Helper.isNullOrEmpty(books)) { DataModel.getMapOfBooksByTag().remove(tag); DataModel.getListOfTags().remove(tag); } } DataModel.getMapOfTagsByBookId().remove(book.getId()); Series serie=book.getSeries(); List<Book> booksInSerie=DataModel.getMapOfBooksBySeries().get(serie); if (Helper.isNotNullOrEmpty(booksInSerie)) booksInSerie.remove(book); if (Helper.isNullOrEmpty(booksInSerie)) { DataModel.getMapOfBooksBySeries().remove(serie); DataModel.getListOfSeries().remove(serie); } DataModel.getMapOfSeriesByBookId().remove(book.getId()); for ( Author author : book.getAuthors()) { List<Book> booksByAuthor=DataModel.getMapOfBooksByAuthor().get(author); if (Helper.isNotNullOrEmpty(booksByAuthor)) booksByAuthor.remove(book); if (Helper.isNullOrEmpty(booksByAuthor)) { DataModel.getMapOfBooksByAuthor().remove(author); DataModel.getListOfAuthors().remove(author); } } DataModel.getMapOfAuthorsByBookId().remove(book.getId()); BookRating rating=book.getRating(); List<Book> booksInRating=DataModel.getMapOfBooksByRating().get(rating); if (Helper.isNotNullOrEmpty(booksInRating)) booksInRating.remove(book); if (Helper.isNullOrEmpty(booksInRating)) { DataModel.getMapOfBooksByRating().remove(rating); } Publisher publisher=book.getPublisher(); List<Book> booksByPublisher=DataModel.getMapOfBooksByPublisher().get(publisher); if (Helper.isNotNullOrEmpty(booksByPublisher)) booksByPublisher.remove(book); if (Helper.isNullOrEmpty(booksByPublisher)) { DataModel.getMapOfBooksByPublisher().remove(publisher); DataModel.getListOfPublishers().remove(publisher); } DataModel.getListOfBooks().remove(book); DataModel.getMapOfBooks().remove(book.getId()); DataModel.getMapOfCommentsByBookId().remove(book.getId()); DataModel.getMapOfEBookFilesByBookId().remove(book.getId()); } } LinkedList<Tag> tagList=new LinkedList<Tag>(DataModel.getListOfTags()); for ( Tag tag : tagList) { List<Book> books=DataModel.getMapOfBooksByTag().get(tag); if (Helper.isNullOrEmpty(books)) { DataModel.getMapOfBooksByTag().remove(tag); DataModel.getListOfTags().remove(tag); } } LinkedList<Series> seriesList=new LinkedList<Series>(DataModel.getListOfSeries()); for ( Series serie : seriesList) { List<Book> booksInSerie=DataModel.getMapOfBooksBySeries().get(serie); if (Helper.isNullOrEmpty(booksInSerie)) { DataModel.getMapOfBooksBySeries().remove(serie); DataModel.getListOfSeries().remove(serie); } } LinkedList<Author> authorList=new LinkedList<Author>(DataModel.getListOfAuthors()); for ( Author author : authorList) { List<Book> booksByAuthor=DataModel.getMapOfBooksByAuthor().get(author); if (Helper.isNullOrEmpty(booksByAuthor)) { DataModel.getMapOfBooksByAuthor().remove(author); DataModel.getListOfAuthors().remove(author); } } }
Apply the specified filter to the current data model
public boolean isStreaming(){ return false; }
Tells that this entity is not streaming.
public LabeledOMSpline(float latPoint,float lonPoint,int[] xypoints,int cMode){ super(latPoint,lonPoint,xypoints,cMode); }
Create an x/y LabeledOMSpline at an offset from lat/lon.
public void fireTableRowsUpdated(int firstRow,int lastRow){ fireTableChanged(new TableModelEvent(this,firstRow,lastRow,TableModelEvent.ALL_COLUMNS,TableModelEvent.UPDATE)); }
Notifies all listeners that rows in the range <code>[firstRow, lastRow]</code>, inclusive, have been updated.
public UpdateManager(BridgeContext ctx,GraphicsNode gn,Document doc){ bridgeContext=ctx; bridgeContext.setUpdateManager(this); document=doc; updateRunnableQueue=RunnableQueue.createRunnableQueue(); runHandler=createRunHandler(); updateRunnableQueue.setRunHandler(runHandler); graphicsNode=gn; scriptingEnvironment=initializeScriptingEnvironment(bridgeContext); secondaryBridgeContexts=(BridgeContext[])ctx.getChildContexts().clone(); secondaryScriptingEnvironments=new ScriptingEnvironment[secondaryBridgeContexts.length]; for (int i=0; i < secondaryBridgeContexts.length; i++) { BridgeContext resCtx=secondaryBridgeContexts[i]; if (!((SVGOMDocument)resCtx.getDocument()).isSVG12()) { continue; } resCtx.setUpdateManager(this); ScriptingEnvironment se=initializeScriptingEnvironment(resCtx); secondaryScriptingEnvironments[i]=se; } minRepaintTime=MIN_REPAINT_TIME; }
Creates a new update manager.
public static byte[] downloadBitmapToMemory(Context context,String urlString,int maxBytes){ HttpURLConnection urlConnection=null; ByteArrayOutputStream out=null; InputStream in=null; try { final URL url=new URL(urlString); urlConnection=(HttpURLConnection)url.openConnection(); if (urlConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { return null; } in=new BufferedInputStream(urlConnection.getInputStream(),IO_BUFFER_SIZE_BYTES); out=new ByteArrayOutputStream(IO_BUFFER_SIZE_BYTES); final byte[] buffer=new byte[128]; int total=0; int bytesRead; while ((bytesRead=in.read(buffer)) != -1) { total+=bytesRead; if (total > maxBytes) { return null; } out.write(buffer,0,bytesRead); } return out.toByteArray(); } catch ( final IOException e) { Log.e(TAG,"Error in downloadBitmapToMemory - " + e); } finally { if (urlConnection != null) { urlConnection.disconnect(); } try { if (out != null) { out.close(); } if (in != null) { in.close(); } } catch ( final IOException e) { Log.e(TAG,"Error in downloadBitmapToMemory - " + e); } } return null; }
Download a bitmap from a URL, write it to a disk and return the File pointer. This implementation uses a simple disk cache.
public LoggingFraction consoleHandler(Level level,String formatter){ consoleHandler(new ConsoleHandler(CONSOLE).level(level).namedFormatter(formatter)); return this; }
Add a ConsoleHandler to the list of handlers for this logger.
public static double[] meansOfRows(double[][] input){ double[] theMeans=new double[input.length]; for (int i=0; i < input.length; i++) { theMeans[i]=mean(input[i]); } return theMeans; }
Return an array of the means of each row in the 2D input matrix
private Token toASIToken(ILeafNode leaf){ if (leaf.isHidden()) { return newSemicolonToken(leaf); } else { if (!leafNodes.hasNext()) { int tokenType=tokenTypeMapper.getInternalTokenType(leaf); int semicolonTokenType=tokenTypeMapper.getInternalTokenType(semicolon); if (tokenType == semicolonTokenType) { return new CommonToken(semicolonTokenType,leaf.getText()); } if (leaf.getTotalEndOffset() == endOffset) { leafNodes=Iterators.emptyIterator(); return new CommonToken(tokenType,leaf.getText()); } next=new CommonToken(semicolonTokenType,leaf.getText()); return new CommonToken(tokenType,leaf.getText()); } else if (leaf.getGrammarElement() == rightCurlyInBlock || leaf.getGrammarElement() == rightCurlyInArrowExpression) { int tokenType=tokenTypeMapper.getInternalTokenType(leaf); next=new CommonToken(tokenType); return new CommonToken(tokenTypeMapper.getInternalTokenType(semicolon),leaf.getText()); } else { return newSemicolonToken(leaf); } } }
Produces either one or two tokens from the given leaf which represents a location where the production parser inserted a semicolon.
public void respondPrivateMessage(String response){ getUser().send().message(response); }
Respond with a PM directly to the user
public static void checkArgument(boolean expression,Object errorMessage){ if (!expression) { throw new IllegalArgumentException(String.valueOf(errorMessage)); } }
Ensures the truth of an expression involving one or more parameters to the calling method.
public void prepend(CharSequence s){ StringBuffer newText=new StringBuffer(); newText.append(s); newText.append(text); text=newText; }
Add a string to the start of the first line of the buffer.
public RC5ParameterSpec(int version,int rounds,int wordSize){ this.version=version; this.rounds=rounds; this.wordSize=wordSize; this.iv=null; }
Creates a new <code>RC5ParameterSpec</code> instance with the specified version, round count an word size (in bits).
private void updateTickLabelForLogScale(int length){ double min=scale.getRange().getLower(); double max=scale.getRange().getUpper(); if (min <= 0 || max <= 0) throw new IllegalArgumentException("the range for log scale must be in positive range"); boolean minBigger=max < min; int digitMin=(int)Math.ceil(Math.log10(min)); int digitMax=(int)Math.ceil(Math.log10(max)); final BigDecimal MIN=new BigDecimal(new Double(min).toString()); BigDecimal tickStep=pow(10,digitMin - 1); BigDecimal firstPosition; if (MIN.remainder(tickStep).doubleValue() <= 0) { firstPosition=MIN.subtract(MIN.remainder(tickStep)); } else { if (minBigger) firstPosition=MIN.subtract(MIN.remainder(tickStep)); else firstPosition=MIN.subtract(MIN.remainder(tickStep)).add(tickStep); } boolean minDateAdded=false; if (MIN.compareTo(firstPosition) == (minBigger ? 1 : -1)) { tickLabelValues.add(min); if (scale.isDateEnabled()) { Date date=new Date((long)MIN.doubleValue()); tickLabels.add(scale.format(date,true)); minDateAdded=true; } else { tickLabels.add(scale.format(MIN.doubleValue())); } tickLabelPositions.add(scale.getMargin()); } for (int i=digitMin; minBigger ? i >= digitMax : i <= digitMax; i+=minBigger ? -1 : 1) { if (Math.abs(digitMax - digitMin) > 20) { BigDecimal v=pow(10,i); if (v.doubleValue() > max) break; if (scale.isDateEnabled()) { Date date=new Date((long)v.doubleValue()); tickLabels.add(scale.format(date,i == digitMin && !minDateAdded)); } else { tickLabels.add(scale.format(v.doubleValue())); } tickLabelValues.add(v.doubleValue()); int tickLabelPosition=(int)((Math.log10(v.doubleValue()) - Math.log10(min)) / (Math.log10(max) - Math.log10(min)) * length) + scale.getMargin(); tickLabelPositions.add(tickLabelPosition); } else { for (BigDecimal j=firstPosition; minBigger ? j.doubleValue() >= pow(10,i - 1).doubleValue() : j.doubleValue() <= pow(10,i).doubleValue(); j=minBigger ? j.subtract(tickStep) : j.add(tickStep)) { if (minBigger ? j.doubleValue() < max : j.doubleValue() > max) { break; } if (scale.isDateEnabled()) { Date date=new Date((long)j.doubleValue()); tickLabels.add(scale.format(date,j == firstPosition && !minDateAdded)); } else { tickLabels.add(scale.format(j.doubleValue())); } tickLabelValues.add(j.doubleValue()); int tickLabelPosition=(int)((Math.log10(j.doubleValue()) - Math.log10(min)) / (Math.log10(max) - Math.log10(min)) * length) + scale.getMargin(); tickLabelPositions.add(tickLabelPosition); } tickStep=minBigger ? tickStep.divide(pow(10,1)) : tickStep.multiply(pow(10,1)); firstPosition=minBigger ? pow(10,i - 1) : tickStep.add(pow(10,i)); } } if (minBigger ? max < tickLabelValues.get(tickLabelValues.size() - 1) : max > tickLabelValues.get(tickLabelValues.size() - 1)) { tickLabelValues.add(max); if (scale.isDateEnabled()) { Date date=new Date((long)max); tickLabels.add(scale.format(date,true)); } else { tickLabels.add(scale.format(max)); } tickLabelPositions.add(scale.getMargin() + length); } }
Updates tick label for log scale.
public boolean isLastInstructionInBasicBlock(){ return !basicBlock.isEmpty() && handle == basicBlock.getLastInstruction(); }
Return whether or not the Location is positioned at the last instruction in the basic block.
private PrincipalId authenticate(String tenantName,X509Certificate[] tlsCertChain) throws IDMLoginException, CertificateRevocationCheckException, InvalidArgumentException, IdmCertificateRevokedException, IDMException { TenantInformation info; try { info=findTenant(tenantName); } catch ( Exception e) { throw new IDMLoginException("Error in retrieve tenantInfo"); } if (tlsCertChain == null || tlsCertChain.length < 1) { logger.error("Certificate chain is empty or null"); throw new IDMLoginException("Certificate chain is empty or null"); } if (logger.isDebugEnabled()) { for (int i=0; i < tlsCertChain.length; i++) { logger.debug("Client Certificate [" + i + "] = "+ tlsCertChain[i].toString()); } } String subjectDn=tlsCertChain[0].getSubjectDN() != null ? tlsCertChain[0].getSubjectDN().toString() : ""; IIdmAuthStatRecorder recorder=PerformanceMonitorFactory.createIdmAuthStatRecorderInstance(tenantName,"CertificateAuthentication","IDM",0,IIdmAuthStat.ActivityKind.AUTHENTICATE,IIdmAuthStat.EventLevel.INFO,subjectDn); recorder.start(); AuthnPolicy aPolicy=info.getAuthnPolicy(); Validate.notNull(aPolicy,"AuthnPolicy can not be null."); Validate.isTrue(aPolicy.IsTLSClientCertAuthnEnabled(),"TLSClient authn is not enabled."); ClientCertPolicy certPolicy=aPolicy.getClientCertPolicy(); Validate.notNull(certPolicy,"Client Certificate Policy can not be null."); ValidateUtil.validateNotEmpty(tenantName,"Tenant name"); IdmClientCertificateValidator certValidator=new IdmClientCertificateValidator(certPolicy,tenantName); Map<String,String> authStatsExtension=new HashMap<String,String>(); recorder.add(authStatsExtension); String clusterID; try { clusterID=this.getClusterId(); } catch ( Exception e1) { throw new IDMException("Failed to retrieve PSC cluster ID."); } certValidator.validateCertificatePath(tlsCertChain[0],clusterID,authStatsExtension); long startTime=System.nanoTime(); String upn=certValidator.extractUPN(tlsCertChain[0]); IIdentityProvider provider=null; try { PrincipalId userPrincipal=getUserPrincipal(tenantName,upn); provider=info.findProviderADAsFallBack(userPrincipal.getDomain()); } catch ( Exception e) { throw new IDMException("Failed to retrieve details of identity provider with domain :" + subjectDn); } if (provider != null) { validateProviderAllowedAuthnTypes(DirectoryConfigStore.FLAG_AUTHN_TYPE_ALLOW_TLS_CERTIFICATE,provider.getName(),info); } String[] parts=upn.split("@"); PrincipalId principalID; if (parts.length == 2) { principalID=new PrincipalId(parts[0],parts[1]); try { if (!this.IsActive(tenantName,principalID)) { logger.error("The user is not found or inactive:" + principalID.getUPN()); throw new IDMLoginException("The user owning this certificate is not found or inactive. User UPN: " + principalID.getUPN()); } logger.info("Successfully validated subject of the client certificate : " + principalID.getUPN()); } catch ( Exception e) { logger.error("Failed to determine the status of principal with candicate UPN:" + principalID.getUPN()); throw new IDMLoginException("Unable to find user with UPN: " + principalID.getUPN()); } } else { logger.error(upn + " is in illegal UPN format"); throw new IDMLoginException("Illegal UPN format: " + upn); } authStatsExtension.put("SearchUserByCertificateUpn",String.format("%d Ms",TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime))); recorder.end(); return principalID; }
TLS Client Certificate (or smartcard) authentication. This function does the following Certificate path validation, revocation check Subject validation OID filtering
public static double[][][] expandNoiseArray(final double[][][] input){ double[][][] result=getNewCubeSizedArray(); int xSteps=X_SECTION_SIZE - 1; int ySteps=Y_SECTION_SIZE - 1; int zSteps=Z_SECTION_SIZE - 1; for (int noiseX=0; noiseX < X_SECTIONS - 1; noiseX++) { for (int noiseZ=0; noiseZ < Z_SECTIONS - 1; noiseZ++) { for (int noiseY=0; noiseY < Y_SECTIONS - 1; noiseY++) { double x0y0z0=input[noiseX][noiseY][noiseZ]; double x0y0z1=input[noiseX][noiseY][noiseZ + 1]; double x1y0z0=input[noiseX + 1][noiseY][noiseZ]; double x1y0z1=input[noiseX + 1][noiseY][noiseZ + 1]; double x0y1z0=input[noiseX][noiseY + 1][noiseZ]; double x0y1z1=input[noiseX][noiseY + 1][noiseZ + 1]; double x1y1z0=input[noiseX + 1][noiseY + 1][noiseZ]; double x1y1z1=input[noiseX + 1][noiseY + 1][noiseZ + 1]; for (int x=0; x < xSteps; x++) { int xRel=noiseX * xSteps + x; double xd=(double)x / xSteps; double xy0z0=lerp(xd,x0y0z0,x1y0z0); double xy0z1=lerp(xd,x0y0z1,x1y0z1); double xy1z0=lerp(xd,x0y1z0,x1y1z0); double xy1z1=lerp(xd,x0y1z1,x1y1z1); for (int z=0; z < zSteps; z++) { int zRel=noiseZ * zSteps + z; double zd=(double)z / zSteps; double xy0z=lerp(zd,xy0z0,xy0z1); double xy1z=lerp(zd,xy1z0,xy1z1); for (int y=0; y < ySteps; y++) { int yRel=noiseY * ySteps + y; double yd=(double)y / ySteps; double xyz=lerp(yd,xy0z,xy1z); result[xRel][yRel][zRel]=xyz; } } } } } } return result; }
expand the noise array to 16x16x16 by interpolating the values.
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"UQSUB16"); translateAll(environment,instruction,"UQSUB16",instructions); }
UQSUB16{<cond>} <Rd>, <Rn>, <Rm> Operation: if ConditionPassed(cond) then Rd[15:0] = UnsignedSat(Rn[15:0] - Rm[15:0], 16) Rd[31:16] = UnsignedSat(Rn[31:16] - Rm[31:16], 16)
public static String toStringExclude(Object object,final String excludeFieldName){ return toStringExclude(object,new String[]{excludeFieldName}); }
Builds a String for a toString method excluding the given field name.
public static boolean removeDirectory(String pathToDir){ return deleteRecursive(new File(pathToDir)); }
Remove directory and all its sub-resources with specified path
public Dimension minimumSize(int v){ FontMetrics fm=getFontMetrics(getFont()); initFontMetrics(); return new Dimension(20 + fm.stringWidth("0123456789abcde"),getItemHeight() * v + (2 * MARGIN)); }
return the minimumsize
String pullInSource(InputStream in,Charset encoding){ String script=""; BufferedReader f=null; try { StringBuilder sb=new StringBuilder(); Reader reader=null; if (encoding == null) reader=new InputStreamReader(in); else reader=new InputStreamReader(in,encoding); f=new BufferedReader(reader); String line; while ((line=f.readLine()) != null) { sb.append(line); sb.append('\n'); } script=sb.toString(); } catch ( IOException e) { e.printStackTrace(); } return script; }
Given an input stream containing source file contents, read in each line
@Override public void connect() throws IOException { File f=new File(filename); if (f.isDirectory()) { isDir=true; is=getDirectoryListing(f); } else { is=new BufferedInputStream(new FileInputStream(f)); long lengthAsLong=f.length(); length=lengthAsLong <= Integer.MAX_VALUE ? (int)lengthAsLong : Integer.MAX_VALUE; } connected=true; }
This methods will attempt to obtain the input stream of the file pointed by this <code>URL</code>. If the file is a directory, it will return that directory listing as an input stream.
public int falsePositives(int classindex){ int fp=0; for (int i=0; i < confusion[classindex].length; i++) { if (i != classindex) { fp+=confusion[classindex][i]; } } return fp; }
The false positives for the specified class.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:49.470 -0400",hash_original_method="00066F2A5261D560420BAE8B5DB685BE",hash_generated_method="0F0633676B8D14425F94FFB8C4B89BE8") private boolean isSilentStart(String value){ boolean result=false; for (int i=0; i < SILENT_START.length; i++) { if (value.startsWith(SILENT_START[i])) { result=true; break; } } return result; }
Determines whether or not the value starts with a silent letter. It will return <code>true</code> if the value starts with any of 'GN', 'KN', 'PN', 'WR' or 'PS'.
private void showFeedback(String message){ if (myHost != null) { myHost.showFeedback(message); } else { System.out.println(message); } }
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
public MPLSObject(sage.io.SageDataFile inStream) throws java.io.IOException { byte[] strHolder=new byte[4]; inStream.readFully(strHolder); String fileType=new String(strHolder,BluRayParser.BLURAY_CHARSET); if (!"MPLS".equals(fileType)) throw new java.io.IOException("Invalid BluRay structure: MPLS file is missing the MPLS header!"); inStream.readFully(strHolder); version=new String(strHolder,BluRayParser.BLURAY_CHARSET); int playlistOffset=inStream.readInt(); int markOffset=inStream.readInt(); int extensionOffset=inStream.readInt(); inStream.skipBytes(20); int appInfoLength=inStream.readInt(); inStream.skipBytes(1); playbackType=inStream.read(); inStream.skipBytes(2); inStream.skipBytes(8); inStream.skipBytes(2); inStream.seek(playlistOffset); inStream.skipBytes(6); int playlistLength=inStream.readUnsignedShort(); int numSubPaths=inStream.readUnsignedShort(); playlistItems=new PlaylistItem[playlistLength]; java.util.HashSet uniqueClips=new java.util.HashSet(); for (int i=0; i < playlistLength; i++) { playlistItems[i]=new PlaylistItem(inStream); totalDuration+=playlistItems[i].duration; if (uniqueClips.add(playlistItems[i].itemClips[0].clipName)) totalUniqueDuration+=playlistItems[i].duration; } inStream.seek(markOffset); inStream.skipBytes(4); int numMarks=inStream.readUnsignedShort(); playlistMarks=new PlaylistMark[numMarks]; for (int i=0; i < numMarks; i++) playlistMarks[i]=new PlaylistMark(inStream); }
Creates a new instance of MPLSObject
public final void yyreset(java.io.Reader reader) throws java.io.IOException { zzBuffer=s.array; zzStartRead=s.offset; zzEndRead=zzStartRead + s.count - 1; zzCurrentPos=zzMarkedPos=s.offset; zzLexicalState=YYINITIAL; zzReader=reader; zzAtEOF=false; }
Resets the scanner to read from a new input stream. Does not close the old reader. All internal variables are reset, the old input stream <b>cannot</b> be reused (internal buffer is discarded and lost). Lexical state is set to <tt>YY_INITIAL</tt>.
@Override public boolean lookAt(PLRotation rotation){ return (mIsNotLocked ? this.internalLookAt(null,rotation.pitch,rotation.yaw,false,true,false) : false); }
lookat methods
public BreadcrumbItem(final Breadcrumb parent,final int style){ super(parent,checkStyle(style)); parent.addItem(this); this.parentBreadcrumb=parent; this.textColor=parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); this.textColorSelected=parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); this.enabled=true; if ((style & SWT.LEFT) != 0) { this.alignment=SWT.LEFT; } if ((style & SWT.CENTER) != 0) { this.alignment=SWT.CENTER; } if ((style & SWT.RIGHT) != 0) { this.alignment=SWT.RIGHT; } this.selectionListeners=new ArrayList<SelectionListener>(); this.width=this.height=-1; }
Constructs a new instance of this class given its parent (which must be a <code>Breadcrumb</code>) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>
public FileDescriptor(){ }
Constructs a new invalid FileDescriptor.
public TDoubleObjectHashMap(int initialCapacity,float loadFactor,TDoubleHashingStrategy strategy){ super(initialCapacity,loadFactor); _hashingStrategy=strategy; }
Creates a new <code>TDoubleObjectHashMap</code> instance with a prime value at or near the specified capacity and load factor.
public void addImageView(CubeImageView imageView){ if (null == imageView) { return; } if (null == mFirstImageViewHolder) { mFirstImageViewHolder=new ImageViewHolder(imageView); return; } ImageViewHolder holder=mFirstImageViewHolder; for (; ; holder=holder.mNext) { if (holder.contains(imageView)) { return; } if (holder.mNext == null) { break; } } ImageViewHolder newHolder=new ImageViewHolder(imageView); newHolder.mPrev=holder; holder.mNext=newHolder; }
Bind ImageView with ImageTask
public static void checkLocation(int location,String label){ if (location < 0) { throw new RuntimeException("Unable to locate '" + label + "' in program"); } }
Checks to see if the location we obtained is valid. GLES returns -1 if a label could not be found, but does not set the GL error. <p> Throws a RuntimeException if the location is invalid.
@Override public int read() throws java.io.IOException { if (position < 0) { if (encode) { byte[] b3=new byte[3]; int numBinaryBytes=0; for (int i=0; i < 3; i++) { try { int b=in.read(); if (b >= 0) { b3[i]=(byte)b; numBinaryBytes++; } } catch ( java.io.IOException e) { if (i == 0) { throw e; } } } if (numBinaryBytes > 0) { Base64.encode3to4(b3,0,numBinaryBytes,buffer,0,options); position=0; numSigBytes=4; } else { return -1; } } else { byte[] b4=new byte[4]; int i=0; for (i=0; i < 4; i++) { int b=0; do { b=in.read(); } while (b >= 0 && decodabet[b & 0x7f] <= Base64.WHITE_SPACE_ENC); if (b < 0) { break; } b4[i]=(byte)b; } if (i == 4) { numSigBytes=Base64.decode4to3(b4,0,buffer,0,options); position=0; } else if (i == 0) { return -1; } else { throw new java.io.IOException("Improperly padded Base64 input."); } } } if (position >= 0) { if (position >= numSigBytes) { return -1; } if (encode && breakLines && lineLength >= Base64.MAX_LINE_LENGTH) { lineLength=0; return '\n'; } else { lineLength++; int b=buffer[position++]; if (position >= bufferLength) { position=-1; } return b & 0xFF; } } else { throw new java.io.IOException("Error in Base64 code reading stream."); } }
Reads enough of the input stream to convert to/from Base64 and returns the next byte.
public MethExecutorResult executeMethodOnObject(Object obj,String methodName,Object[] args){ String name=obj.getClass().getName() + "." + methodName+ (args != null ? " with " + args.length + " args" : "")+ " on object: "+ obj; long start=start(name); MethExecutorResult result=MethExecutor.executeObject(obj,methodName,args); logDelta(name,start,result); return result; }
Executes a given instance method on a given object with the given arguments.
private void logError(Text url,Throwable t){ if (LOG.isInfoEnabled()) { LOG.info("Conversion of " + url + " failed with: "+ StringUtils.stringifyException(t)); } }
<p>Logs any error that occurs during conversion.</p>
public void testDivideRemainderIsZero(){ String a="8311389578904553209874735431110"; int aScale=-15; String b="237468273682987234567849583746"; int bScale=20; String c="3.5000000000000000000000000000000E+36"; int resScale=-5; BigDecimal aNumber=new BigDecimal(new BigInteger(a),aScale); BigDecimal bNumber=new BigDecimal(new BigInteger(b),bScale); BigDecimal result=aNumber.divide(bNumber,resScale,BigDecimal.ROUND_CEILING); assertEquals("incorrect value",c,result.toString()); assertEquals("incorrect scale",resScale,result.scale()); }
Divide: remainder is zero
public static String toString(LocalDateTime data,String modelo){ return data == null ? "" : data.format(formatter(modelo)); }
Converte LocalDateTime para String indicando o formato da toString
private void paintCloseEnabled(Graphics2D g,JComponent c,int width,int height){ paintClose(g,c,width,height,enabled); }
Paint the background enabled state.
public void append(Printable painter,PageFormat page,int numPages){ BookPage bookPage=new BookPage(painter,page); int pageIndex=mPages.size(); int newSize=pageIndex + numPages; mPages.setSize(newSize); for (int i=pageIndex; i < newSize; i++) { mPages.setElementAt(bookPage,i); } }
Appends <code>numPages</code> pages to the end of this <code>Book</code>. Each of the pages is associated with <code>page</code>.
void close(){ myContentManager.removeAllContents(true); myToolWindowManager.unregisterToolWindow(myWindowName); }
Close window
protected static boolean isLandingPage(HttpServletRequest httpRequest){ return httpRequest.getServletPath().startsWith(BaseBean.MARKETPLACE_START_SITE); }
Returns true if the request targets the landing page of the market place
protected final boolean _matchToken(String matchStr,int i) throws IOException, JsonParseException { final int len=matchStr.length(); do { if (_inputPtr >= _inputEnd) { if (!loadMore()) { _reportInvalidEOFInValue(); } } if (_inputBuffer[_inputPtr] != matchStr.charAt(i)) { _reportInvalidToken(matchStr.substring(0,i),"'null', 'true', 'false' or NaN"); } ++_inputPtr; } while (++i < len); if (_inputPtr >= _inputEnd) { if (!loadMore()) { return true; } } char c=_inputBuffer[_inputPtr]; if (Character.isJavaIdentifierPart(c)) { ++_inputPtr; _reportInvalidToken(matchStr.substring(0,i),"'null', 'true', 'false' or NaN"); } return true; }
Helper method for checking whether input matches expected token
@RequestMapping(value=STORAGE_POLICIES_URI_PREFIX,method=RequestMethod.POST,consumes={"application/xml","application/json"}) @Secured(SecurityFunctions.FN_STORAGE_POLICIES_POST) public StoragePolicy createStoragePolicy(@RequestBody StoragePolicyCreateRequest request){ return storagePolicyService.createStoragePolicy(request); }
Creates a new storage policy. <p>Requires WRITE permission on namespace and READ permission on filter namespace</p>
public boolean isString(){ return value instanceof String; }
Check whether this primitive contains a String value.
public UtilizationModelPlanetLabInMemory(String inputPath,double schedulingInterval) throws NumberFormatException, IOException { data=new double[289]; setSchedulingInterval(schedulingInterval); BufferedReader input=new BufferedReader(new FileReader(inputPath)); int n=data.length; for (int i=0; i < n - 1; i++) { data[i]=Integer.valueOf(input.readLine()) / 100.0; } data[n - 1]=data[n - 2]; input.close(); }
Instantiates a new PlanetLab resource utilization model from a trace file.
public GridByteArrayList(byte[] data,int size){ assert data != null; assert size > 0; this.data=data; this.size=size; }
Wraps existing array into byte array list.
public JToolBar createJToolBar(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException { JToolBar result=new JToolBar(); List buttons=getStringList(name); Iterator it=buttons.iterator(); while (it.hasNext()) { String s=(String)it.next(); if (s.equals(SEPARATOR)) { result.add(new JToolbarSeparator()); } else { result.add(createJButton(s)); } } return result; }
Creates a tool bar
private void removeAllNodes(@Nullable Object key){ for (Iterator<V> i=new ValueForKeyIterator(key); i.hasNext(); ) { i.next(); i.remove(); } }
Removes all nodes for the specified key.
@Bean public static DataSourceInitializer dataSourceInitializer(){ ResourceDatabasePopulator resourceDatabasePopulator=new ResourceDatabasePopulator(); resourceDatabasePopulator.addScript(new ClassPathResource("alterJpaTablesAndInsertReferenceData.sql")); DataSourceInitializer dataSourceInitializer=new DataSourceInitializer(); dataSourceInitializer.setDataSource(herdDataSource()); dataSourceInitializer.setDatabasePopulator(resourceDatabasePopulator); return dataSourceInitializer; }
This is a data source initializer which is used to make changes to the auto-created schema based on JPA annotations and to insert reference data. This bean is an InitializingBean which means it will automatically get invoked when the Spring test context creates all its beans. This approach will work for making changes to the auto-created schema which got created based on other DAO beans having been created.
public void createBuffers(){ boolean supportsUIntBuffers=RajawaliRenderer.supportsUIntBuffers; if (mVertices != null) { mVertices.compact().position(0); createBuffer(mVertexBufferInfo,BufferType.FLOAT_BUFFER,mVertices,GLES20.GL_ARRAY_BUFFER); } if (mNormals != null) { mNormals.compact().position(0); createBuffer(mNormalBufferInfo,BufferType.FLOAT_BUFFER,mNormals,GLES20.GL_ARRAY_BUFFER); } if (mTextureCoords != null) { mTextureCoords.compact().position(0); createBuffer(mTexCoordBufferInfo,BufferType.FLOAT_BUFFER,mTextureCoords,GLES20.GL_ARRAY_BUFFER); } if (mColors != null) { mColors.compact().position(0); createBuffer(mColorBufferInfo,BufferType.FLOAT_BUFFER,mColors,GLES20.GL_ARRAY_BUFFER); } if (mIndicesInt != null && !mOnlyShortBufferSupported && supportsUIntBuffers) { mIndicesInt.compact().position(0); createBuffer(mIndexBufferInfo,BufferType.INT_BUFFER,mIndicesInt,GLES20.GL_ELEMENT_ARRAY_BUFFER); } if (mOnlyShortBufferSupported || !supportsUIntBuffers) { mOnlyShortBufferSupported=true; if (mIndicesShort == null && mIndicesInt != null) { mIndicesInt.position(0); mIndicesShort=ByteBuffer.allocateDirect(mNumIndices * SHORT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asShortBuffer(); try { for (int i=0; i < mNumIndices; ++i) { mIndicesShort.put((short)mIndicesInt.get(i)); } } catch ( BufferOverflowException e) { RajLog.e("Buffer overflow. Unfortunately your device doesn't supported int type index buffers. The mesh is too big."); throw (e); } mIndicesInt.clear(); mIndicesInt.limit(); mIndicesInt=null; } if (mIndicesShort != null) { mIndicesShort.compact().position(0); createBuffer(mIndexBufferInfo,BufferType.SHORT_BUFFER,mIndicesShort,GLES20.GL_ELEMENT_ARRAY_BUFFER); } } GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER,0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER,0); mHaveCreatedBuffers=true; }
Creates the actual Buffer objects.
private ServerPod[] buildServers(int serverCount){ ArrayList<ServerPod> serversPod=new ArrayList<>(); for (int i=0; i < serverCount; i++) { if (i < _serverList.size()) { serversPod.add(_serverList.get(i)); } else { serversPod.add(new ServerPod(i)); } } ServerPod[] serverArray=new ServerPod[serverCount]; for (int i=0; i < serverCount; i++) { serverArray[i]=serversPod.get(i); } return serverArray; }
Create cluster pods using the configuration as a hint. Both the cluster and cluster_hub pods use this.
public boolean remove(URI uri,HttpCookie ck){ if (ck == null) { throw new NullPointerException("cookie is null"); } boolean modified=false; lock.lock(); try { modified=cookieJar.remove(ck); } finally { lock.unlock(); } return modified; }
Remove a cookie from store
public static Document parseSAMLConfig(String samlConfigDoc) throws IOException, SAXException { assert samlConfigDoc != null; DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(false); DocumentBuilder builder; try { builder=dbf.newDocumentBuilder(); } catch ( ParserConfigurationException e) { throw new IllegalStateException(e); } ByteArrayInputStream strIn=new ByteArrayInputStream(samlConfigDoc.getBytes()); return builder.parse(strIn); }
Parse SAML configuration value passed as argument to DOM document.
public static void assertTrue(boolean value,String errorMessage){ if (verbose) { log("assertTrue(" + value + ", "+ errorMessage+ ")"); } assertBool(value,errorMessage); }
Asserts that the given expression evaluates to true
public boolean hasDays(){ return super.hasAttribute(DAYS); }
Returns whether it has the number of days before the start time.
protected void stripIgnorableText(){ if (rootElement.getFirstChild() == null) { return; } Node firstChild=rootElement.getFirstChild(); if (isIgnorableTextNode(firstChild)) { rootElement.removeChild(firstChild); if (rootElement.getFirstChild() == null) { return; } } Node lastChild=rootElement.getLastChild(); if (isIgnorableTextNode(lastChild)) { rootElement.removeChild(lastChild); } }
Strip ignorable whitespace nodes from the root.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 15:01:24.484 -0400",hash_original_method="FE4B8D7BDC2BC5EA73BFE2D5582C2DF7",hash_generated_method="8E163135FFCE65EC07B847F759C17E8E") public boolean isMarked(){ return pair.mark; }
Returns the current value of the mark.
public void write(OutputNode node,Object source) throws Exception { Collection list=(Collection)source; for ( Object item : list) { if (item != null) { Class expect=entry.getType(); Class actual=item.getClass(); if (!expect.isAssignableFrom(actual)) { throw new PersistenceException("Entry %s does not match %s for %s",actual,entry,type); } root.write(node,item,expect,name); } } }
This <code>write</code> method will write the specified object to the given XML element as as list entries. Each entry within the given collection must be assignable from the annotated type specified within the <code>ElementList</code> annotation. Each entry is serialized as a root element, that is, its <code>Root</code> annotation is used to extract the name.
public static TestSuite suite() throws Exception { Class testClass=ClassLoader.getSystemClassLoader().loadClass("org.w3c.domts.level3.core.alltests"); Constructor testConstructor=testClass.getConstructor(new Class[]{DOMTestDocumentBuilderFactory.class}); DOMTestDocumentBuilderFactory factory=new BatikTestDocumentBuilderFactory(new DocumentBuilderSetting[0]); Object test=testConstructor.newInstance(new Object[]{factory}); return new JUnitTestSuiteAdapter((DOMTestSuite)test); }
Factory method for suite.
public static long[] unknown_N_compute_B_and_K(double epsilon,double delta,int quantiles){ return unknown_N_compute_B_and_K_raw(epsilon,delta,quantiles); }
Computes the number of buffers and number of values per buffer such that quantiles can be determined with an approximation error no more than epsilon with a certain probability.
public static String reflectionToString(Object object,ToStringStyle style){ return ReflectionToStringBuilder.toString(object,style); }
<p>Uses <code>ReflectionToStringBuilder</code> to generate a <code>toString</code> for the specified object.</p>
public DrawerBuilder withTranslucentStatusBarShadow(Boolean translucentStatusBarShadow){ this.mTranslucentStatusBarShadow=translucentStatusBarShadow; return this; }
Sets if the MaterialDrawer should add the translucent shadow overlay under the statusBar to get the same effect as the toolbar with a colored statusBar
@DELETE @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @Path("/{snapshot_id}") @CheckPermission(roles={Role.SYSTEM_MONITOR,Role.TENANT_ADMIN},acls={ACL.ANY}) public Response deleteSnapshot(@PathParam("tenant_id") String openstack_tenant_id,@PathParam("snapshot_id") String snapshot_id){ _log.info("Delete Snapshot: id = {}",snapshot_id); BlockSnapshot snap=findSnapshot(snapshot_id,openstack_tenant_id); if (snap == null) { _log.error("Not Found : Invalid volume snapshot id"); return CinderApiUtils.createErrorResponse(404,"Not Found : Invalid volume snapshot id"); } else if (snap.hasConsistencyGroup()) { _log.error("Not Found : Snapshot belongs to a consistency group"); return CinderApiUtils.createErrorResponse(400,"Invalid snapshot: Snapshot belongs to consistency group"); } URI snapshotURI=snap.getId(); String task=UUID.randomUUID().toString(); TaskList response=new TaskList(); ArgValidator.checkReference(BlockSnapshot.class,snapshotURI,checkForDelete(snap)); if (snap.getInactive()) { Operation op=new Operation(); op.ready("The snapshot has already been deleted"); op.setResourceType(ResourceOperationTypeEnum.DELETE_VOLUME_SNAPSHOT); _dbClient.createTaskOpStatus(BlockSnapshot.class,snap.getId(),task,op); response.getTaskList().add(toTask(snap,task,op)); return Response.status(202).build(); } StorageSystem device=_dbClient.queryObject(StorageSystem.class,snap.getStorageController()); List<BlockSnapshot> snapshots=new ArrayList<BlockSnapshot>(); final URI cgId=snap.getConsistencyGroup(); if (!NullColumnValueGetter.isNullURI(cgId)) { URIQueryResultList results=new URIQueryResultList(); _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getBlockSnapshotsBySnapsetLabel(snap.getSnapsetLabel()),results); while (results.iterator().hasNext()) { URI uri=results.iterator().next(); _log.info("BlockSnapshot being deactivated: " + uri); BlockSnapshot snapshot=_dbClient.queryObject(BlockSnapshot.class,uri); if (snapshot != null) { snapshots.add(snapshot); } } } else { snapshots.add(snap); } for ( BlockSnapshot snapshot : snapshots) { Operation snapOp=_dbClient.createTaskOpStatus(BlockSnapshot.class,snapshot.getId(),task,ResourceOperationTypeEnum.DELETE_VOLUME_SNAPSHOT); response.getTaskList().add(toTask(snapshot,task,snapOp)); } Volume volume=_permissionsHelper.getObjectById(snap.getParent(),Volume.class); BlockServiceApi blockServiceApiImpl=BlockService.getBlockServiceImpl(volume,_dbClient); blockServiceApiImpl.deleteSnapshot(snap,snapshots,task,VolumeDeleteTypeEnum.FULL.name()); StringMap extensions=snap.getExtensions(); if (extensions == null) { extensions=new StringMap(); } for ( TaskResourceRep rep : response.getTaskList()) { extensions.put("taskid",rep.getId().toString()); break; } snap.setExtensions(extensions); _dbClient.updateObject(snap); auditOp(OperationTypeEnum.DELETE_VOLUME_SNAPSHOT,true,AuditLogManager.AUDITOP_BEGIN,snapshot_id,snap.getLabel(),snap.getParent().getName(),device.getId().toString()); return Response.status(202).build(); }
Delete a specific snapshot
@Since(CommonParams.VERSION_1) @DELETE @Path(CommonParams.PATH_ID) @Override public Response deleteItem(@Context Request request,@InjectParam TriggerParameters params) throws WebApplicationException { return delete(request,triggerBackend.deleteItem(),params); }
Deletes the trigger definition with the given id.
public DecodeReturn(String _data){ data=_data; pos=0; }
Use this to make a new DecodeReturn starting at position 0
public static ServerSocketBar create(int port,int listenBacklog) throws IOException { return create(null,port,listenBacklog,true); }
Creates the SSL ServerSocket.
private void fixedLongToBytes(long n,byte[] buf,int off){ buf[off + 0]=(byte)(n & 0xff); buf[off + 1]=(byte)((n >> 8) & 0xff); buf[off + 2]=(byte)((n >> 16) & 0xff); buf[off + 3]=(byte)((n >> 24) & 0xff); buf[off + 4]=(byte)((n >> 32) & 0xff); buf[off + 5]=(byte)((n >> 40) & 0xff); buf[off + 6]=(byte)((n >> 48) & 0xff); buf[off + 7]=(byte)((n >> 56) & 0xff); }
Convert a long into little-endian bytes in buf starting at off and going until off+7.
public boolean matchesFirst(){ return super.get().getValue() == 0; }
checks if we already returned to the method that marked the first call.
public static void main(final String[] args){ System.out.println(TITLE + " " + VERSION); }
prints the version string
public Builder noCache(){ this.noCache=true; return this; }
Don't accept an unvalidated cached response.
private boolean parseQuantifier(PsiBuilder builder){ final PsiBuilder.Marker marker=builder.mark(); if (builder.getTokenType() == RegExpTT.LBRACE) { builder.advanceLexer(); boolean minOmitted=false; if (builder.getTokenType() == RegExpTT.COMMA && myCapabilities.contains(RegExpCapability.OMIT_NUMBERS_IN_QUANTIFIERS)) { minOmitted=true; builder.advanceLexer(); } else if (builder.getTokenType() != RegExpTT.NUMBER && myCapabilities.contains(RegExpCapability.DANGLING_METACHARACTERS)) { marker.done(RegExpTT.CHARACTER); return true; } else { checkMatches(builder,RegExpTT.NUMBER,"Number expected"); } if (builder.getTokenType() == RegExpTT.RBRACE) { builder.advanceLexer(); parseQuantifierType(builder); marker.done(RegExpElementTypes.QUANTIFIER); } else { if (!minOmitted) { checkMatches(builder,RegExpTT.COMMA,"',' expected"); } if (builder.getTokenType() == RegExpTT.RBRACE) { builder.advanceLexer(); parseQuantifierType(builder); marker.done(RegExpElementTypes.QUANTIFIER); } else if (builder.getTokenType() == RegExpTT.NUMBER) { builder.advanceLexer(); checkMatches(builder,RegExpTT.RBRACE,"'}' expected"); parseQuantifierType(builder); marker.done(RegExpElementTypes.QUANTIFIER); } else { builder.error("'}' or number expected"); marker.done(RegExpElementTypes.QUANTIFIER); return true; } } } else if (RegExpTT.QUANTIFIERS.contains(builder.getTokenType())) { builder.advanceLexer(); parseQuantifierType(builder); marker.done(RegExpElementTypes.QUANTIFIER); } else { marker.drop(); return false; } return true; }
QUANTIFIER ::= Q TYPE | "" Q ::= "{" BOUND "}" | "*" | "?" | "+" BOUND ::= NUM | NUM "," | NUM "," NUM TYPE ::= "?" | "+" | ""
public MAttributeInstance(Properties ctx,ResultSet rs,String trxName){ super(ctx,rs,trxName); }
Load Cosntructor
public JSONWriter value(double d) throws JSONException { return this.value(new Double(d)); }
Append a double value.
public void startAutoScroll(int delayTimeInMills){ isAutoScroll=true; sendScrollMessage(delayTimeInMills); }
start auto scroll
public static ModuleSpec parse(String moduleSpec,Option... options){ int sep=moduleSpec.indexOf("/"); String name=sep != -1 ? moduleSpec.substring(0,sep) : moduleSpec; name=name.trim(); String version=sep != -1 && sep < moduleSpec.length() - 1 ? moduleSpec.substring(sep + 1) : ""; version=version.trim(); if (name.equals(DEFAULT_MODULE.name)) { if (contains(options,Option.DEFAULT_MODULE_PROHIBITED)) { throw new IllegalArgumentException(CommonMessages.msg("modspec.default.prohibited")); } if (version.equals(DEFAULT_MODULE.version)) { return DEFAULT_MODULE; } throw new IllegalArgumentException(CommonMessages.msg("modspec.default.no.version")); } if (version.isEmpty() && contains(options,Option.VERSION_REQUIRED)) { throw new IllegalArgumentException(CommonMessages.msg("modspec.version.required",moduleSpec)); } else if ((!version.isEmpty() || sep != -1) && contains(options,Option.VERSION_PROHIBITED)) { throw new IllegalArgumentException(CommonMessages.msg("modspec.version.prohibited",moduleSpec)); } ModuleSpec spec=new ModuleSpec(name,version); return spec; }
Parse a module spec according to the given version option.
private Process createProcess(final File sourceFile,final File destFile) throws IOException { notNull(sourceFile); final String[] commandLine=getCommandLine(sourceFile.getPath(),destFile.getPath()); LOG.debug("CommandLine arguments: {}",Arrays.asList(commandLine)); final Process process=new ProcessBuilder(commandLine).redirectErrorStream(true).start(); final StreamGobbler errorGobbler=new StreamGobbler(process.getErrorStream(),"ERROR"); final StreamGobbler outputGobbler=new StreamGobbler(process.getInputStream(),"OUTPUT"); errorGobbler.start(); outputGobbler.start(); return process; }
Creates process responsible for running tsc shell command by reading the file content from the sourceFilePath
public void beginAdding(GL10 gl){ checkState(STATE_INITIALIZED,STATE_ADDING); mLabels.clear(); mU=0; mV=0; mLineHeight=0; Bitmap.Config config=mFullColor ? Bitmap.Config.ARGB_4444 : Bitmap.Config.ALPHA_8; mBitmap=Bitmap.createBitmap(mStrikeWidth,mStrikeHeight,config); mCanvas=new Canvas(mBitmap); mBitmap.eraseColor(0); }
Call before adding labels. Clears out any existing labels.
public boolean equals(Object o){ if (o instanceof Action) return isEquiv((Action)o); else return false; }
Test for equality to another object. This action equals another object if the other object is an equivalent action.
public void removeIndex(String indexName) throws Exception { try { Collection<Index> idxs=qs.getIndexes(); if (!idxs.isEmpty()) { Iterator<Index> idx=idxs.iterator(); while (idx.hasNext()) { Index index=idx.next(); if (index.getName().equals(indexName)) { qs.removeIndex(index); } return; } } } catch ( Exception e) { throw new Exception(e.getMessage()); } }
remove a given index
private void drawDiamond(Canvas canvas,Paint paint,float[] path,float x,float y){ path[0]=x; path[1]=y - size; path[2]=x - size; path[3]=y; path[4]=x; path[5]=y + size; path[6]=x + size; path[7]=y; drawPath(canvas,path,paint,true); }
The graphical representation of a diamond point shape.
public void onMessagesRead(Peer peer,long fromDate){ if (fromDate < getLastReadDate(peer)) { return; } getNotifications().clear(); pendingStorage.setMessagesCount(0); pendingStorage.setDialogsCount(0); allPendingNotifications.clear(); saveStorage(); updateNotification(); setLastReadDate(peer,fromDate); }
Processing event about messages read
public void doSaveAs(){ saveAs(); }
doSaveAs() -
public CursorPosition(IndexSegmentTupleCursor<E> cursor,ILeafCursor<ImmutableLeaf> leafCursor,int index,byte[] key){ super(cursor,leafCursor,index,key); }
Create position on the specified key, or on the successor of the specified key if that key is not found in the index.
private void enlarge(final int size){ int length1=2 * data.length; int length2=length + size; byte[] newData=new byte[length1 > length2 ? length1 : length2]; System.arraycopy(data,0,newData,0,length); data=newData; }
Enlarge this byte vector so that it can receive n more bytes.
public RaceGUI(String appName){ UIManager.put("swing.boldMetal",Boolean.FALSE); JFrame f=new JFrame(appName); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); track=new TrackView(); f.add(track,BorderLayout.CENTER); controlPanel=new RaceControlPanel(); f.add(controlPanel,BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Creates a new instance of RaceGUI
public static double logpdf(double val,double loc,double scale,double shape1,double shape2){ final double c=cdf(val,loc,scale,shape1,shape2); val=(val - loc) / scale; if (shape1 != 0.) { val=1 - shape1 * val; if (val < 1e-15) { return Double.NEGATIVE_INFINITY; } val=(1. - 1. / shape1) * Math.log(val); } return -val - Math.log(scale) + Math.log(c) * (1. - shape2); }
Probability density function.
public IndexSchema create(String resourceName,SolrConfig config){ SolrResourceLoader loader=config.getResourceLoader(); InputStream schemaInputStream=null; if (null == resourceName) { resourceName=IndexSchema.DEFAULT_SCHEMA_FILE; } try { schemaInputStream=loader.openSchema(resourceName); } catch ( Exception e) { final String msg="Error loading schema resource " + resourceName; log.error(msg,e); throw new SolrException(ErrorCode.SERVER_ERROR,msg,e); } InputSource inputSource=new InputSource(schemaInputStream); inputSource.setSystemId(SystemIdResolver.createSystemIdFromResourceName(resourceName)); IndexSchema schema=new IndexSchema(config,resourceName,inputSource); return schema; }
Returns an index schema created from a local resource
private GridData gridDataForLbl(){ GridData gridData=new GridData(); gridData.horizontalIndent=5; gridData.verticalIndent=10; return gridData; }
Method creates grid data for label field.
public static boolean isXioVolume(String nativeGuid){ return nativeGuid.contains("XTREMIO"); }
Determines if the volume is an xtremio volume