code
stringlengths
10
174k
nl
stringlengths
3
129k
private int countCharsStart(char ch){ int count=0; for (int i=0; i < this.value.length(); i++) { final char c=this.value.charAt(i); if (c == ' ') { continue; } if (c == ch) { count++; } else { break; } } return count; }
Counts the amount of 'ch' at the start of this line ignoring spaces.
private static void hybrid6_cx(float in[][],float out[][][],int outOffset,final float filter[][][],int len){ final int N=8; float temp[][]=new float[8][2]; int inOffset=0; for (int i=0; i < len; i++, inOffset++) { PSDSP.hybrid_analysis(temp,0,in,inOffset,filter,0,1,N); out[outOffset + 0][i][0]=temp[6][0]; out[outOffset + 0][i][1]=temp[6][1]; out[outOffset + 1][i][0]=temp[7][0]; out[outOffset + 1][i][1]=temp[7][1]; out[outOffset + 2][i][0]=temp[0][0]; out[outOffset + 2][i][1]=temp[0][1]; out[outOffset + 3][i][0]=temp[1][0]; out[outOffset + 3][i][1]=temp[1][1]; out[outOffset + 4][i][0]=temp[2][0] + temp[5][0]; out[outOffset + 4][i][1]=temp[2][1] + temp[5][1]; out[outOffset + 5][i][0]=temp[3][0] + temp[4][0]; out[outOffset + 5][i][1]=temp[3][1] + temp[4][1]; } }
Split one subband into 6 subsubbands with a complex filter
public ServerBuilder defaultRequestTimeoutMillis(long defaultRequestTimeoutMillis){ validateDefaultRequestTimeoutMillis(defaultRequestTimeoutMillis); this.defaultRequestTimeoutMillis=defaultRequestTimeoutMillis; return this; }
Sets the default timeout of a request in milliseconds.
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){ switch (featureID) { case TypeRefsPackage.WILDCARD__DECLARED_UPPER_BOUND: return basicSetDeclaredUpperBound(null,msgs); case TypeRefsPackage.WILDCARD__DECLARED_LOWER_BOUND: return basicSetDeclaredLowerBound(null,msgs); } return super.eInverseRemove(otherEnd,featureID,msgs); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public boolean skipChar(int c) throws IOException { if (fCurrentEntity.position == fCurrentEntity.count) { load(0,true); } int cc=fCurrentEntity.ch[fCurrentEntity.position]; if (cc == c) { fCurrentEntity.position++; if (c == '\n') { fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber=1; } else { fCurrentEntity.columnNumber++; } return true; } else if (c == '\n' && cc == '\r' && fCurrentEntity.isExternal()) { if (fCurrentEntity.position == fCurrentEntity.count) { fCurrentEntity.ch[0]=(char)cc; load(1,false); } fCurrentEntity.position++; if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') { fCurrentEntity.position++; } fCurrentEntity.lineNumber++; fCurrentEntity.columnNumber=1; return true; } return false; }
Skips a character appearing immediately on the input. <p> <strong>Note:</strong> The character is consumed only if it matches the specified character.
@Override public final double classProb(int classIndex,Instance instance,int theSubset) throws Exception { if (theSubset <= -1) { double[] weights=weights(instance); if (weights == null) { return m_distribution.prob(classIndex); } else { double prob=0; for (int i=0; i < weights.length; i++) { prob+=weights[i] * m_distribution.prob(classIndex,i); } return prob; } } else { if (Utils.gr(m_distribution.perBag(theSubset),0)) { return m_distribution.prob(classIndex,theSubset); } else { return m_distribution.prob(classIndex); } } }
Gets class probability for instance.
public void runTest() throws Throwable { Document doc; NodeList elementList; Node testEmployee; NamedNodeMap attributes; Attr domesticAttr; boolean specified; doc=(Document)load("staff",false); elementList=doc.getElementsByTagName("address"); testEmployee=elementList.item(0); attributes=testEmployee.getAttributes(); domesticAttr=(Attr)attributes.getNamedItem("domestic"); specified=domesticAttr.getSpecified(); assertTrue("domesticSpecified",specified); }
Runs the test case.
public LinkedHashMapPro(int initialCapacity,float loadFactor){ super(initialCapacity,loadFactor); accessOrder=false; }
Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance with the specified initial capacity and load factor.
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public void testCase19(){ byte aBytes[]={0}; byte bBytes[]={120,34,78,-23,-111,45,127,23,45,-3}; byte rBytes[]={120,34,78,-23,-111,45,127,23,45,-3}; int aSign=0; int bSign=-1; BigInteger aNumber=new BigInteger(aSign,aBytes); BigInteger bNumber=new BigInteger(bSign,bBytes); BigInteger result=aNumber.subtract(bNumber); byte resBytes[]=new byte[rBytes.length]; resBytes=result.toByteArray(); for (int i=0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(1,result.signum()); }
Subtract a number from zero. The number is negative.
public int doEndTag() throws JspException { return EVAL_PAGE; }
End Tag
protected void handleChildElementRemoved(Element e){ CompositeGraphicsNode gn=(CompositeGraphicsNode)node; if (selectedChild == e) { gn.remove(0); disposeTree(selectedChild); selectedChild=null; GraphicsNode refNode=null; GVTBuilder builder=ctx.getGVTBuilder(); for (Node n=e.getNextSibling(); n != null; n=n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { Element ref=(Element)n; if (n instanceof SVGTests && SVGUtilities.matchUserAgent(ref,ctx.getUserAgent())) { refNode=builder.build(ctx,ref); selectedChild=ref; break; } } } if (refNode != null) { gn.add(refNode); } } }
Responds to the removal of a child element by re-evaluating the test attributes.
private PKCS1VectorGenerator(){ }
No instantiation needed, only one static method used
public ResultMatrixSignificance(int cols,int rows){ super(cols,rows); }
initializes the matrix with the given dimensions.
public void createExternalForeignKeys(Database database,Table table,StringBuilder ddl){ if (!databaseInfo.isForeignKeysEmbedded()) { for (int idx=0; idx < table.getForeignKeyCount(); idx++) { writeExternalForeignKeyCreateStmt(database,table,table.getForeignKey(idx),ddl); } } }
Creates external foreign key creation statements if necessary.
@Override protected EClass eStaticClass(){ return TypesPackage.Literals.ANNOTATABLE_ELEMENT; }
<!-- begin-user-doc --> <!-- end-user-doc -->
@Override public boolean equals(Object obj){ if (obj == this) { return true; } if (!(obj instanceof OHLCDataItem)) { return false; } OHLCDataItem that=(OHLCDataItem)obj; if (!this.date.equals(that.date)) { return false; } if (!this.high.equals(that.high)) { return false; } if (!this.low.equals(that.low)) { return false; } if (!this.open.equals(that.open)) { return false; } if (!this.close.equals(that.close)) { return false; } return true; }
Checks this instance for equality with an arbitrary object.
public final Bag elements(){ Bag bag=new Bag(); Object[][][] field=this.field; Object[][] fieldx=null; Object[] fieldxy=null; final int width=this.width; final int height=this.height; final int length=this.length; for (int x=0; x < width; x++) { fieldx=field[x]; for (int y=0; y < height; y++) { fieldxy=fieldx[y]; for (int z=0; z < length; z++) { if (fieldxy[z] != null) bag.add(fieldxy[z]); } } } return bag; }
Returns in a Bag all stored objects (including duplicates but not null values). You are free to modify the Bag.
public static char lowSurrogate(int c){ return (char)(((c - 0x00010000) & 0x3FF) + 0xDC00); }
Returns the low surrogate of a supplemental character
public float slotChurn(){ final BigDecimal slotsAllocated=new BigDecimal(m_slotAllocations); final BigDecimal slotsReserved=new BigDecimal(m_totalSlots); if (slotsReserved.signum() == 0) return 0f; return slotsAllocated.divide(slotsReserved,2,RoundingMode.HALF_UP).floatValue(); }
SlotsChurn: A measure of how frequently slots of this size are re-allocated provided by slotsAllocated/slotsReserved. This metric is higher when there are more allocations made against a given #of slots reserved.
public boolean heartbeat() throws Exception { return heartBeater.ping(); }
Ping the server. Returns: True if the server is live. Otherwise either return False or throw an exception to indicate a failed heartbeat
public Set<UUID> nodeIds(){ return ids; }
Gets set of node IDs this predicate is based on. Note that for performance reasons this methods return the internal set that <b>should not</b> be modified by the caller.
public void ensureUpToDate(){ final String METHOD_NAME="insureUpToDate()"; getOwner().methodBegin(getClass(),METHOD_NAME); try { pause(); for ( Entity entity : getGame().getEntitiesVector()) { if (getDone().get()) { return; } if (!isEntityOnMap(entity)) { continue; } if (((!getPathEnumerator().getLastKnownLocations().containsKey(entity.getId())) || (!getPathEnumerator().getLastKnownLocations().get(entity.getId()).equals(CoordFacingCombo.createCoordFacingCombo(entity))))) { dirtifyUnit(entity.getId()); } } while (!getDirtyUnits().isEmpty()) { if (getDone().get()) { return; } Integer entityId=getDirtyUnits().pollFirst(); Entity entity=getGame().getEntity(entityId); if (entity != null) { getOwner().log(getClass(),METHOD_NAME,"recalculating paths for " + entity.getDisplayName()); getPathEnumerator().recalculateMovesFor(entity); getOwner().log(getClass(),METHOD_NAME,"finished recalculating paths for " + entity.getDisplayName()); } } } finally { getOwner().methodEnd(getClass(),METHOD_NAME); } }
Makes sure pathEnumerator has up to date information about other units locations call this right before making a move. automatically pauses.
public boolean isLongField(){ return (m_vo.DisplayLength >= MAXDISPLAY_LENGTH / 2); }
Is this a long (string/text) field (over 60/2=30 characters)
public List<SourceRecord> recordsForTopic(String topicName){ return recordsByTopic.get(topicName); }
Get the records on the given topic.
public void shouldCompleteWhenMaxDurationExceeded() throws Throwable { when(service.connect()).thenReturn(false); RetryPolicy retryPolicy=new RetryPolicy().retryWhen(false).withMaxDuration(100,TimeUnit.MILLISECONDS); assertEquals(Failsafe.with(retryPolicy).onFailure(null).get(null),Boolean.FALSE); verify(service).connect(); }
Asserts that an execution is failed when the max duration is exceeded.
private static List<Command> loadRewrites(String str){ assert str != null; List<Command> commands=new ArrayList<>(); for ( String line : str.split("\n")) { addLine(commands,line); } return commands; }
Loads the rewrites from tab-separated values.
public static Object invoke(Object o,String methodName,Class<?>[] paramClasses,Object[] paramValues){ Method m; Object result; result=null; try { m=o.getClass().getMethod(methodName,paramClasses); result=m.invoke(o,paramValues); } catch ( Exception e) { e.printStackTrace(); result=null; } return result; }
executes the specified method and returns the result, if any.
public static void main(final String[] args) throws Exception { if (args.length != 1) { System.err.println(String.format("Usage: %s <project-name>",ListResources.class.getSimpleName())); return; } String project=args[0]; String projectResource="projects/" + project; Monitoring monitoringService=authenticate(); ListResources example=new ListResources(monitoringService,projectResource); example.listMonitoredResourceDescriptors(); example.listMetricDescriptors(); example.listTimeseries(); }
Query the Google Cloud Monitoring API using a service account and print the result to the console.
public int loadInt(Offset offset){ return this.plus(offset).loadInt(); }
Loads an int from the memory location pointed to by the current instance.
public boolean isModified(){ return _isDigestModified; }
Returns true if the underlying resource has changed.
public ExpressionParserBuilder withModule(ExpressionParserModule module){ addModule(module); return this; }
Adds the given module that supplies functions and constant values.
public JSONArray optJSONArray(int index){ Object o=this.opt(index); return o instanceof JSONArray ? (JSONArray)o : null; }
Get the optional JSONArray associated with an index.
final public void yybegin(int newState){ yy_lexical_state=newState; }
Enters a new lexical state
public void hide(){ LinearLayout.LayoutParams lp=(LinearLayout.LayoutParams)mContentView.getLayoutParams(); lp.height=0; mContentView.setLayoutParams(lp); }
hide footer when disable pull load more
public static void copyFromResource(@NotNull VirtualFile file,@NonNls @NotNull String resourceUrl) throws IOException { InputStream out=VfsUtil.class.getResourceAsStream(resourceUrl); if (out == null) { throw new FileNotFoundException(resourceUrl); } try { byte[] bytes=FileUtil.adaptiveLoadBytes(out); file.setBinaryContent(bytes); } finally { out.close(); } }
Copies content of resource to the given file
public synchronized void write(int b){ if (closed) { return; } super.write(b); }
Writes the specified byte to this output stream.
public void handleServerCommand(String type,String[] params,Server server,Conversation conversation,IRCService service){ if (params.length > 1) { service.getConnection(server.getId()).sendRawLineViaQueue(type.toUpperCase() + " " + BaseHandler.mergeParams(params)); } else { service.getConnection(server.getId()).sendRawLineViaQueue(type.toUpperCase()); } }
Handle a server command
protected void engineReset(){ messageLength=0; buffer[BYTES_OFFSET]=0; buffer[HASH_OFFSET]=H0; buffer[HASH_OFFSET + 1]=H1; buffer[HASH_OFFSET + 2]=H2; buffer[HASH_OFFSET + 3]=H3; buffer[HASH_OFFSET + 4]=H4; }
Resets the engine. <BR> The method overrides "engineReset()" in class MessageDigestSpi. <BR>
private static boolean checkAttributeCharacters(String chars) throws CharConversionException { boolean escape=false; for (int i=0; i < chars.length(); i++) { char ch=chars.charAt(i); if (ch <= 93) { switch (ch) { case 0x9: case 0xA: case 0xD: continue; case '\'': case '"': case '<': case '&': escape=true; continue; default : if (ch < 0x20) { throw new CharConversionException("Invalid XML character &#" + ((int)ch) + ";."); } } } } return escape == false; }
Check if all passed characters match XML expression [2].
public int size(){ return al.size(); }
Returns the number of elements in this set.
@TargetApi(21) public void onChannelGuideSelected(int channelId,String channelTitle){ selectedChannelId=channelId; selectedChannelTitle=channelTitle; PVRChannelEPGListFragment pvrEPGFragment=PVRChannelEPGListFragment.newInstance(channelId); FragmentTransaction fragTrans=getSupportFragmentManager().beginTransaction(); if (Utils.isLollipopOrLater()) { pvrEPGFragment.setEnterTransition(TransitionInflater.from(this).inflateTransition(R.transition.media_details)); pvrEPGFragment.setReturnTransition(null); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter,0,R.anim.fragment_list_popenter,0); } fragTrans.replace(R.id.fragment_container,pvrEPGFragment).addToBackStack(null).commit(); setupActionBar(selectedChannelGroupTitle,selectedChannelTitle); }
Callback from list fragment when the channel guide should be displayed. Setup action bar and repolace list fragment
private static Map<String,List<String>> uninstallLibraries() throws Exception { Map<String,List<String>> uninstalledLibs=new HashMap<String,List<String>>(); File uninstallLibDir=getLibraryUninstallDir(); String[] uninstallLibNames; if (uninstallLibDir.exists()) { uninstallLibNames=uninstallLibDir.list(); for ( String uninstallLibName : uninstallLibNames) { String[] components=uninstallLibName.split("\\."); String dataverse=components[0]; String libName=components[1]; uninstallLibrary(dataverse,libName); new File(uninstallLibDir,uninstallLibName).delete(); List<String> uinstalledLibsInDv=uninstalledLibs.get(dataverse); if (uinstalledLibsInDv == null) { uinstalledLibsInDv=new ArrayList<String>(); uninstalledLibs.put(dataverse,uinstalledLibsInDv); } uinstalledLibsInDv.add(libName); } } return uninstalledLibs; }
un-install libraries.
public boolean isEmpty(){ return filter.isEmpty() && query.isEmpty() && sort.isEmpty(); }
Returns if this search doesn't specify any filter, query or sort.
public KeyValPair<K,V> cloneKeyValPair(KeyValPair<K,V> kv){ return kv; }
By default an immutable object is assumed. Override if V is mutable
private void action_treeAdd(ListItem item){ log.info("Item=" + item); if (item != null) { centerTree.nodeChanged(true,item.id,item.name,item.description,item.isSummary,item.imageIndicator); addNode(item); } }
Action: Add Node to Tree
public void installDefaults(AbstractButton b){ super.installDefaults(b); b.setOpaque(false); }
Install Defaults
public String generateChangeAutoTieringPolicy(Workflow workflow,String wfGroupId,String waitFor,URI storageURI,List<URI> volumeURIs,URI newVpoolURI,URI oldVpoolURI) throws ControllerException { DiscoveredSystemObject storageSystem=getStorageSystem(_dbClient,storageURI); Workflow.Method method=ExportWorkflowEntryPoints.changeAutoTieringPolicyMethod(storageURI,volumeURIs,newVpoolURI,false); Workflow.Method rollback=ExportWorkflowEntryPoints.changeAutoTieringPolicyMethod(storageURI,volumeURIs,oldVpoolURI,true); return newWorkflowStep(workflow,wfGroupId,String.format("Updating Auto-tiering Policy on storage array %s (%s, args) for volumes %s",storageSystem.getNativeGuid(),storageURI,Joiner.on("\t").join(volumeURIs)),storageSystem,method,rollback,waitFor); }
Generate a Workflow Step to change the Auto-tiering policy for the volumes in a specific Export Mask.
protected static DBFField createField(DataInput in) throws IOException { DBFField field=new DBFField(); byte t_byte=in.readByte(); if (t_byte == (byte)0x0d) { return null; } in.readFully(field.fieldName,1,10); field.fieldName[0]=t_byte; for (int i=0; i < field.fieldName.length; i++) { if (field.fieldName[i] == (byte)0) { field.nameNullIndex=i; break; } } field.dataType=DBFField.DBFDataType.getTypeBySymbol(in.readByte()); field.reserv1=Utils.readLittleEndianInt(in); field.fieldLength=in.readUnsignedByte(); field.decimalCount=in.readByte(); field.reserv2=Utils.readLittleEndianShort(in); field.workAreaId=in.readByte(); field.reserv2=Utils.readLittleEndianShort(in); field.setFieldsFlag=in.readByte(); in.readFully(field.reserv4); field.indexFieldFlag=in.readByte(); return field; }
Creates a DBFField object from the data read from the given DataInputStream. The data in the DataInputStream object is supposed to be organised correctly and the stream "pointer" is supposed to be positioned properly.
public static boolean looksLikeAURI(String val){ return val.startsWith("url(") && val.endsWith(")"); }
Description of the Method
private void returnData(Object ret){ if (myHost != null) { myHost.returnData(ret); } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
public static AS_PathEntity translateAStarPathtoPathEntity(ArrayList<AStarNode> input){ AS_PathPoint[] points=new AS_PathPoint[input.size()]; AStarNode reading; int i=0; int size=input.size(); while (size > 0) { reading=input.get(size - 1); points[i]=new AS_PathPoint(reading.x,reading.y,reading.z); points[i].setIndex(i); points[i].setTotalPathDistance(i); points[i].setDistanceToNext(1F); points[i].setDistanceToTarget(size); if (i > 0) { points[i].setPrevious(points[i - 1]); } input.remove(size - 1); size--; i++; } return new AS_PathEntity(points); }
Converts an ArrayList of AStarNodes into an MC style PathEntity
@Override public void executeScriptFiles(List<String> scriptFilePaths){ for ( String scriptFilePath : scriptFilePaths) { File scriptFile=new File(scriptFilePath); if (scriptFile.isAbsolute() && !scriptFile.exists()) { getLogger().warn(String.format("Script file %s doesn't exists.",scriptFilePath),this.getClass().getName()); } else { JvmLauncher java=createJvmLauncher(false); addCliArguments(java); setProperties(java); java.addAppArguments("--file=" + scriptFile); int result=java.execute(); if (result != 0) { throw new ContainerException("Failure when invoking CLI script," + " java returned " + result); } } } }
Executes CLI scripts.
private static String[] nameParameters(Type[] types){ String[] names=new String[types.length]; for (int i=0; i < names.length; i++) { names[i]="$param_" + generateNameFromType(types[i]) + "_"+ (i + 1); } return names; }
Generates an array of names for parameters corresponding to the given array of types for the parameters. Each name in the returned array is guaranteed to be unique. A representation of the type of a parameter is included in its corresponding parameter name to enhance the readability of the generated code.
@Override public boolean isCellEditable(int row,int col){ if (col == 1) return true; else return false; }
All cells besides the ones in the second column ("Session name") are not editable.
public static String text(CharSequence text){ return encode(text,TEXT,LEN); }
Encodes a string to HTML-safe text. The following characters are replaced: <ul> <li><code>&amp;</code> with <code>&amp;amp;</code></li> <li><code>&lt;</code> with <code>&amp;lt;</code></li> <li><code>&gt;</code> with <code>&amp;gt;</code></li> <li><code>\u00A0</code> with <code>&nbsp;</code></li> </ul>
public java_cup.runtime.Symbol do_action(int act_num,java_cup.runtime.lr_parser parser,java.util.Stack stack,int top) throws java.lang.Exception { return action_obj.CUP$LexParse$do_action(act_num,parser,stack,top); }
Invoke a user supplied parse action.
public JBoss5xRuntimeConfiguration(){ setProperty(GeneralPropertySet.HOSTNAME,"localhost"); setProperty(GeneralPropertySet.RMI_PORT,"1099"); setProperty(JBossPropertySet.CONFIGURATION,"default"); setProperty(JBossPropertySet.PROFILE,"default"); setProperty(JBossPropertySet.CLUSTERED,"false"); }
Set the default values for various port numbers.
public static XMPMeta createXMPMeta(){ return XMPMetaFactory.create(); }
Creates a new XMPMeta.
public void testGenerateCertificates() throws Exception { CertificateFactory[] certFs=initCertFs(); assertNotNull("CertificateFactory objects were not created",certFs); Certificate cert=certFs[0].generateCertificate(new ByteArrayInputStream(TestUtils.getEncodedX509Certificate())); for (int i=0; i < certFs.length; i++) { Collection<? extends Certificate> col=null; col=certFs[i].generateCertificates(new ByteArrayInputStream(TestUtils.getEncodedX509Certificate())); Iterator<? extends Certificate> it=col.iterator(); assertEquals("Incorrect Collection size",col.size(),1); assertEquals("Incorrect Certificate in Collection",cert,it.next()); } }
Test for <code>generateCertificates(InputStream inStream)</code> method Assertion: returns Collection which consists of 1 Certificate
public static void mergeResources(RamlResource existing,RamlResource resource,boolean addActions){ Map<String,RamlResource> existingChildResources=existing.getResources(); Map<String,RamlResource> newChildResources=resource.getResources(); for ( String newChildKey : newChildResources.keySet()) { if (!existingChildResources.containsKey(newChildKey)) { existing.addResource(newChildKey,newChildResources.get(newChildKey)); } else { mergeResources(existingChildResources.get(newChildKey),newChildResources.get(newChildKey),addActions); } } if (addActions) { existing.addActions(resource.getActions()); } }
Tree merging algorithm, if a resource already exists it will not overwrite and add all children to the existing resource
public void initializeMainMenu(){ MainMenu.initialize(viewport); }
After Assets are loaded
private int keyColumnStart(){ int offset=0; for (int i=0; i < _columns.length; i++) { if (offset == _keyStart) { return i; } offset+=_columns[i].length(); } throw new IllegalStateException(); }
First key column index.
public static <T>String join(Iterable<T> items){ return SPACE_JOINER.join(items); }
Returns a string containing the string representation of the given items, delimited by a single space character.
protected final void fireVetoableChange(String propertyName,Object oldValue,Object newValue) throws PropertyVetoException { VetoableChangeSupport aVetoSupport=this.vetoSupport; if (aVetoSupport == null) { return; } aVetoSupport.fireVetoableChange(propertyName,oldValue,newValue); }
Support for reporting changes for constrained Object properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.
void registerTarget(VMID vmid,Target target){ synchronized (leaseTable) { LeaseInfo info=leaseTable.get(vmid); if (info == null) { target.vmidDead(vmid); } else { info.notifySet.add(target); } } }
Register interest in receiving a callback when this VMID becomes inaccessible.
public GeneralAttribute customSet(String set){ this.targetAttribute.set=set; return this; }
Name of the custom method used to set this variable.
public void writeMainKml(final KmlType kml){ writeKml("main.kml",kml); }
Writes the specified KML-object as the main kml into the file. The main kml is the one Google Earth reads when the file is opened. It should contain NetworkLinks to the other KMLs stored in the same file.
public Variable[] findArraysInCurrentScope(){ List<Variable> arrays=new ArrayList<Variable>(); for (ListIterator<Variable> iterator=fLocalVariables.listIterator(fLocalVariables.size()); iterator.hasPrevious(); ) { Variable localVariable=iterator.previous(); if (localVariable.isArray()) arrays.add(localVariable); } for (ListIterator<Variable> iterator=fFields.listIterator(fFields.size()); iterator.hasPrevious(); ) { Variable field=iterator.previous(); if (field.isArray()) arrays.add(field); } return arrays.toArray(new Variable[arrays.size()]); }
Returns all arrays, visible in the current context's scope, in the order that they appear.
public TernaryTreeNode(){ }
Creates a new empty node
public MTask(Properties ctx,ResultSet rs,String trxName){ super(ctx,rs,trxName); }
Load Cosntructor
public static <T>boolean contains(T[] array,T value){ return indexOf(array,value) != -1; }
Checks that value is present as at least one of the elements of the array.
public static _Fields findByThriftId(int fieldId){ switch (fieldId) { case 1: return HEADER; case 2: return COUNT; default : return null; } }
Find the _Fields constant that matches fieldId, or null if its not found.
public double pdf(int k){ if (k < 0 || k >= cdf.length - 1) return 0.0; return cdf[k - 1] - cdf[k]; }
Returns the probability distribution function.
public int fwordCount(){ return this.dataLength() / FontData.DataSize.FWORD.size(); }
Get the number of FWORDs in the data.
@ZeppelinApi public void runAll(InterpreterContext context){ for ( InterpreterContextRunner r : context.getRunners()) { if (r.getParagraphId().equals(context.getParagraphId())) { continue; } r.run(); } }
Run all paragraphs. except this.
private URL createSearchURL(URL url) throws MalformedURLException { if (url == null) { return url; } String protocol=url.getProtocol(); if (isDirectory(url) || protocol.equals("jar")) { return url; } if (factory == null) { return new URL("jar","",-1,url.toString() + "!/"); } return new URL("jar","",-1,url.toString() + "!/",factory.createURLStreamHandler("jar")); }
Returns an URL that will be checked if it contains the class or resource. If the file component of the URL is not a directory, a Jar URL will be created.
public void addImportedFiles(File xmlFile){ if (xmlFile.exists()) { importedFiles.add(xmlFile); } else { importedFiles.add(new File("resources/" + xmlFile)); } }
Adds the given XML files to the list of imported source files
@SuppressWarnings("deprecation") public static JSONNode read(Reader reader) throws Exception { SymbolFactory sf; Parser parser; sf=new DefaultSymbolFactory(); parser=new Parser(new Scanner(reader,sf),sf); parser.parse(); return parser.getResult(); }
Reads the JSON object from the given reader.
public static Test suite(){ return new TestSuite(C45Test.class); }
returns a test suite
public boolean isRangeCrosshairLockedOnData(){ return this.rangeCrosshairLockedOnData; }
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.
@Override public boolean isFactoryForType(Object object){ if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!-- end-user-doc -->
public QueryBuilder tags(Optional<Map<String,String>> tags){ checkNotNull(tags,"tags must not be null"); this.tags=pickOptional(this.tags,tags); return this; }
Specify a set of tags that has to match.
public CtClass makeClass(ClassFile classfile,boolean ifNotFrozen) throws RuntimeException { compress(); CtClass clazz=new CtClassType(classfile,this); clazz.checkModify(); String classname=clazz.getName(); if (ifNotFrozen) checkNotFrozen(classname); cacheCtClass(classname,clazz,true); return clazz; }
Creates a new class (or interface) from the given class file. If there already exists a class with the same name, the new class overwrites that previous class. <p>This method is used for creating a <code>CtClass</code> object directly from a class file. The qualified class name is obtained from the class file; you do not have to explicitly give the name.
public static Impp yahoo(String handle){ return new Impp(YAHOO,handle); }
Creates an IMPP property that contains a Yahoo! Messenger handle.
public void insertRow() throws SQLException { crsInternal.insertRow(); }
Inserts the contents of this <code>JoinRowSetImpl</code> object's insert row into this rowset immediately following the current row. If the current row is the position after the last row or before the first row, the new row will be inserted at the end of the rowset. This method also notifies listeners registered with this rowset that the row has changed. <P> The cursor must be on the insert row when this method is called.
public ObjectFactory(){ }
Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.aggregator
public GuacamoleSecurityException(String message,Throwable cause){ super(message,cause); }
Creates a new GuacamoleSecurityException with the given message and cause.
@Override public XYItemRendererState initialise(Graphics2D g2,Rectangle2D dataArea,XYPlot plot,XYDataset data,PlotRenderingInfo info){ double dpi=72; State state=new State(info); state.seriesPath=new GeneralPath(); state.intervalPath=new GeneralPath(); state.dX=72.0 / dpi; return state; }
Initialises the renderer. <P> This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses.
public void testEmbeddedBooleanScorer() throws Exception { Directory dir=newDirectory(); RandomIndexWriter w=new RandomIndexWriter(random(),dir); Document doc=new Document(); doc.add(newTextField("field","doctors are people who prescribe medicines of which they know little, to cure diseases of which they know less, in human beings of whom they know nothing",Field.Store.NO)); w.addDocument(doc); IndexReader r=w.getReader(); w.close(); IndexSearcher s=new IndexSearcher(r); BooleanQuery.Builder q1=new BooleanQuery.Builder(); q1.add(new TermQuery(new Term("field","little")),BooleanClause.Occur.SHOULD); q1.add(new TermQuery(new Term("field","diseases")),BooleanClause.Occur.SHOULD); BooleanQuery.Builder q2=new BooleanQuery.Builder(); q2.add(q1.build(),BooleanClause.Occur.SHOULD); q2.add(new CrazyMustUseBulkScorerQuery(),BooleanClause.Occur.SHOULD); assertEquals(1,s.search(q2.build(),10).totalHits); r.close(); dir.close(); }
Make sure BooleanScorer can embed another BooleanScorer.
public Field forceSource(boolean forceSource){ this.forceSource=forceSource; return this; }
Forces the highlighting to highlight this field based on the source even if this field is stored separately.
public static void drawToolbarButton(Graphics g,AbstractButton b){ if (!b.isEnabled()) { return; } if (b.getModel().isSelected() && b.isRolloverEnabled() || b.getModel().isPressed() && b.getModel().isArmed() && b.isRolloverEnabled()) { if (b.isContentAreaFilled()) { drawButton(b,g,createShapeForButton(b)); } if (b.isBorderPainted()) { drawButtonBorder(b,g,createBorderShapeForButton(b)); } } else if (b.getModel().isRollover() && b.isRolloverEnabled()) { if (b.isBorderPainted()) { drawButtonBorder(b,g,createBorderShapeForButton(b)); } } }
Drasw a button in a toolbar.
public void test_checkClientTrusted_03() throws Exception { X509TrustManagerImpl xtm=new X509TrustManagerImpl(); X509Certificate[] xcert=setX509Certificate(); xtm.checkClientTrusted(xcert,"SSL"); }
javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[] chain, String authType)
public synchronized boolean stop(){ if (!mStarted) { return true; } boolean success=true; success&=getConfigurationService().stop(); success&=getHttpClientService().stop(); success&=getHistoryService().stop(); success&=getStorageService().stop(); success&=getContactService().stop(); success&=getSipService().stop(); success&=getSoundService().stop(); success&=getNetworkService().stop(); if (!success) { Log.e(TAG,"Failed to stop services"); } NgnApplication.getContext().stopService(new Intent(NgnApplication.getContext(),getNativeServiceClass())); if (mNotifManager != null) { mNotifManager.cancelAll(); } mStarted=false; return success; }
Stops the engine. This function will stop all underlying services (SIP, XCAP, MSRP, History, ...).
private void validateBusinessObjectDataDdlRequest(BusinessObjectDataDdlRequest request){ Assert.notNull(request,"A business object data DDL request must be specified."); Assert.hasText(request.getNamespace(),"A namespace must be specified."); request.setNamespace(request.getNamespace().trim()); Assert.hasText(request.getBusinessObjectDefinitionName(),"A business object definition name must be specified."); request.setBusinessObjectDefinitionName(request.getBusinessObjectDefinitionName().trim()); Assert.hasText(request.getBusinessObjectFormatUsage(),"A business object format usage must be specified."); request.setBusinessObjectFormatUsage(request.getBusinessObjectFormatUsage().trim()); Assert.hasText(request.getBusinessObjectFormatFileType(),"A business object format file type must be specified."); request.setBusinessObjectFormatFileType(request.getBusinessObjectFormatFileType().trim()); businessObjectDataHelper.validatePartitionValueFilters(request.getPartitionValueFilters(),request.getPartitionValueFilter(),false); Assert.isTrue(request.getStorageNames() == null || request.getStorageName() == null,"A list of storage names and a standalone storage name cannot be both specified."); if (request.getStorageName() != null) { Assert.hasText(request.getStorageName(),"A storage name must be specified."); request.setStorageName(request.getStorageName().trim()); } if (!CollectionUtils.isEmpty(request.getStorageNames())) { for (int i=0; i < request.getStorageNames().size(); i++) { Assert.hasText(request.getStorageNames().get(i),"A storage name must be specified."); request.getStorageNames().set(i,request.getStorageNames().get(i).trim()); } } Assert.notNull(request.getOutputFormat(),"An output format must be specified."); Assert.hasText(request.getTableName(),"A table name must be specified."); request.setTableName(request.getTableName().trim()); if (StringUtils.isNotBlank(request.getCustomDdlName())) { request.setCustomDdlName(request.getCustomDdlName().trim()); } }
Validates the business object data DDL request. This method also trims appropriate request parameters.
private boolean isFbTextureNeeded(){ if (useShaderDepthTest && shaderContext.getDepthTestEnable() != 0) { return true; } if (useShaderStencilTest && shaderContext.getStencilTestEnable() != 0) { return true; } if (useShaderBlendTest && shaderContext.getBlendTestEnable() != 0) { return true; } if (useShaderColorMask && shaderContext.getColorMaskEnable() != 0) { return true; } return false; }
Check if the fragment shader requires the frame buffer texture (fbTex sampler) to be updated with the current screen content. A copy of the current screen content to the frame buffer texture can be avoided if this method returns "false". The execution of such a copy is quite expensive and should be avoided as much as possible. We need to copy the current screen to the FrameBuffer texture only when one of the following applies: - the STENCIL_TEST flag is enabled - the BLEND_TEST flag is enabled - the Color mask is enabled
public static byte[] hmac_sha1(byte[] keyBytes,byte[] text) throws NoSuchAlgorithmException, InvalidKeyException { Mac hmacSha1; try { hmacSha1=Mac.getInstance("HmacSHA1"); } catch ( final NoSuchAlgorithmException nsae) { hmacSha1=Mac.getInstance("HMAC-SHA-1"); } final SecretKeySpec macKey=new SecretKeySpec(keyBytes,"RAW"); hmacSha1.init(macKey); return hmacSha1.doFinal(text); }
This method uses the JCE to provide the HMAC-SHA-1 algorithm. HMAC computes a Hashed Message Authentication Code and in this case SHA1 is the hash algorithm used.
@Override public Operation error(Class<? extends DataObject> clazz,URI id,String opId,ServiceCoded serviceCoded){ Operation updateOperation=new Operation(); updateOperation.error(serviceCoded); return updateTaskStatus(clazz,id,opId,updateOperation); }
Convenience method for setting operation status to error for given object
protected int calcMaxValue(Object propertyName,int value){ int maxValue=getParentIntProperty(propertyName); if (value > maxValue) { if (miParent != null) { miParent.putClientProperty(propertyName,value); } return value; } else { return maxValue; } }
Calculates and returns maximal value through specified parent component client property.
public void unblock(){ lock.writeLock().unlock(); }
Makes possible for activities entering busy state again.