code
stringlengths
10
174k
nl
stringlengths
3
129k
public static boolean isValid(){ return getInstance().isValid(); }
Returns true, if the global configuration is valid and can be used for security-critical tasks. Configuration is considered to be valid if all the files of all the instances are up-to-date (not expired).
public void plus(){ plus(ANIMATION_DURATION_MS); }
Transition to "+"
public static void evaluateGateONOFFRatio(Gate g){ double lowest_on_rpu=Double.MAX_VALUE; double highest_off_rpu=Double.MIN_VALUE; for (int i=0; i < g.get_logics().size(); ++i) { Double rpu=g.get_outrpus().get(i); if (g.get_logics().get(i) == 1) { if (lowest_on_rpu > rpu) { lowest_on_rpu=rpu; } } else if (g.get_logics().get(i) == 0) { if (highest_off_rpu < rpu) { highest_off_rpu=rpu; } } } g.get_scores().set_onoff_ratio(lowest_on_rpu / highest_off_rpu); }
find ON_lowest and OFF_highest as worst-case scenario
public String globalInfo(){ return "This is ARAM."; }
Returns a string describing this classifier
public static boolean isExpressionStatement(JCExpression tree){ switch (tree.getTag()) { case PREINC: case PREDEC: case POSTINC: case POSTDEC: case ASSIGN: case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: case SL_ASG: case SR_ASG: case USR_ASG: case PLUS_ASG: case MINUS_ASG: case MUL_ASG: case DIV_ASG: case MOD_ASG: case APPLY: case NEWCLASS: case ERRONEOUS: return true; default : return false; } }
Return true if the tree corresponds to an expression statement
public static Motion createLinearMotion(int sourceValue,int destinationValue,int duration){ Motion l=new Motion(sourceValue,destinationValue,duration); l.motionType=LINEAR; return l; }
Creates a linear motion starting from source value all the way to destination value
public void print(NumberFormat format,int width){ print(new PrintWriter(System.out,true),format,width); }
Print the matrix to stdout. Line the elements up in columns. Use the format object, and right justify within columns of width characters. Note that is the matrix is to be read back in, you probably will want to use a NumberFormat that is set to US Locale.
boolean isHandshakeFinished(){ return handshakeFinished; }
Checks if SSL handshake is finished.
@SuppressWarnings("unchecked") ReservoirItemsSketch<T> copy(){ final T[] dataCopy=Arrays.copyOf((T[])data_,currItemsAlloc_); return new ReservoirItemsSketch<>(reservoirSize_,encodedResSize_,currItemsAlloc_,itemsSeen_,rf_,dataCopy); }
Used during union operations to ensure we do not overwrite an existing reservoir. Creates a <en>shallow</en> copy of the reservoir.
public boolean queryDRSMigrationCapabilityForPerformance(String srcUniqueId,String dstUniqueId,String entityType) throws InvalidArgument, NotFound, InvalidSession, StorageFault { final String methodName="queryDRSMigrationCapabilityForPerformance(): "; log.info(methodName + "Entry with srcUniqueId[" + srcUniqueId+ "], dstUniqueId["+ dstUniqueId+ "], entityType["+ entityType+ "]"); sslUtil.checkHttpRequest(true,true); SOSManager sosManager=contextManager.getSOSManager(); boolean result=sosManager.queryDRSMigrationCapabilityForPerformance(srcUniqueId,dstUniqueId,entityType); log.info(methodName + "Exit returning [" + result+ "]"); return result; }
Returns true if DRS migration capability is supported; false otherwise
public static void startGooglePlayServicesRefresh(Context context){ try { context.startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://play.google.com/store/apps/details?id=com.google.android.gms"))); } catch ( Exception e) { e.printStackTrace(); } }
Starts Google Play Services in Play application.
public String toString(){ return Long.toString(getValue()); }
Obtains the string representation of this object.
@Override public SparseEdge createEdge(){ return new SparseEdge(); }
Creates and returns an orphaned SparseEdge.
public static Goal fromString(String text){ if (text != null) { for ( final Goal goal : Goal.values()) { if (text.equalsIgnoreCase(goal.goal)) { return goal; } } } return null; }
From string.
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"UMAAL"); translateAll(environment,instruction,"UMAAL",instructions); }
UMAAL{<cond>} <RdLo>, <RdHi>, <Rm>, <Rs> Operation: if ConditionPassed(cond) then result = Rm * Rs + RdLo + RdHi // Unsigned multiplication and additions RdLo = result[31:0] RdHi = result[63:32]
public void remove(String btxn){ synchronized (processors) { processors.remove(btxn); } }
This method removes the business transaction configuration.
public void testSoftSignInFailSilently() throws Exception { final HttpURLConnection logInConn=mock(HttpURLConnection.class); setupResponseCodeAndOutputStream(logInConn); MockWebCloudClient cloud=createWebCloudClient(logInConn); WebCloudNetworkClient networkClient=mock(WebCloudNetworkClient.class); cloud.setNetworkClient(networkClient); when(networkClient.initialize()).thenReturn(false); assertEquals(UNAUTHENTICATED,cloud.getSigninState()); cloud.initialize(); assertEquals(UNAUTHENTICATED,cloud.getSigninState()); assertEquals(0,cloud.urlsRequested.size()); }
soft sign-in should try to sign in with an existing session ID, then fail silently
private boolean isWatched(int index){ return hasWatches() ? watch[index] : false; }
Is the given word being watched ?
static public void forceCreationOfNewIndex(){ forceCreationOfNewIndex(false); }
Force creation of a new user index without incrementing version
public String readAll(){ if (!scanner.hasNextLine()) return ""; String result=scanner.useDelimiter(EVERYTHING_PATTERN).next(); scanner.useDelimiter(WHITESPACE_PATTERN); return result; }
Read and return the remainder of the input as a string.
public synchronized int read() throws IOException { int n=read(temp,0,1); if (n != 1) return -1; return temp[0] & 0xFF; }
Read a byte from the connection.
public ObjectFactory(){ }
Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: sernet.verinice.model.auth
@Override public void IFNULL(String className,String methName,int branchIndex,Object p){ env.topFrame().operandStack.pushNullRef(); IF_ACMPEQ(className,methName,branchIndex,p,null); }
http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2. doc6.html#ifnull
public boolean isSynchronous(){ return mode == DispatchMode.SYNCHRONOUS; }
Convenience method to check if the tracker is in synchronous mode.
public boolean verify(PublicKey pubKey,String provider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, SignatureException { Signature sig; try { if (provider == null) { sig=Signature.getInstance(getSignatureName(sigAlgId)); } else { sig=Signature.getInstance(getSignatureName(sigAlgId),provider); } } catch ( NoSuchAlgorithmException e) { if (oids.get(sigAlgId.getObjectId()) != null) { String signatureAlgorithm=(String)oids.get(sigAlgId.getObjectId()); if (provider == null) { sig=Signature.getInstance(signatureAlgorithm); } else { sig=Signature.getInstance(signatureAlgorithm,provider); } } else { throw e; } } setSignatureParameters(sig,sigAlgId.getParameters()); sig.initVerify(pubKey); try { sig.update(reqInfo.getEncoded(ASN1Encoding.DER)); } catch ( Exception e) { throw new SignatureException("exception encoding TBS cert request - " + e); } return sig.verify(sigBits.getBytes()); }
verify the request using the passed in public key and the provider..
@SuppressWarnings("rawtypes") public List<Vertex> findAllQuery(String query,Map parameters,int pageSize,int page){ return new ArrayList<Vertex>(); }
Return all vertices matching the query. Currently unable to process in memory.
public SQLiteTableBuilder(SQLiteDatabase database,String tableName){ if (database == null) { throw new IllegalArgumentException("Database cannot be null."); } else if (TextUtils.isEmpty(tableName)) { throw new IllegalArgumentException("Table name cannot be empty."); } else if (!tableName.matches(REGEX_SQL_IDENTIFIER)) { throw new IllegalArgumentException("Invalid table name."); } mDatabase=database; mStringBuilder=new StringBuilder(); mStringBuilder.append(CREATE_TABLE); mStringBuilder.append(tableName); mStringBuilder.append(OPEN_PAREN); }
Creates a new instance for creating a table with the given name in the specified database.
@Override protected void translateCore(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions){ final IOperandTreeNode registerOperand1=instruction.getOperands().get(0).getRootNode().getChildren().get(0); final IOperandTreeNode registerOperand2=instruction.getOperands().get(1).getRootNode().getChildren().get(0); final IOperandTreeNode immediateOperand1=instruction.getOperands().get(2).getRootNode().getChildren().get(0); final IOperandTreeNode immediateOperand2=instruction.getOperands().get(3).getRootNode().getChildren().get(0); final String sourceRegister=registerOperand2.getValue(); final String destinationRegister=registerOperand1.getValue(); final String tempVar1=environment.getNextVariableString(); final String tempVar2=environment.getNextVariableString(); final String tempVar3=environment.getNextVariableString(); final long oneMask=TranslationHelpers.generateOneMask(0,Integer.parseInt(immediateOperand2.getValue()),OperandSize.DWORD); final long zeroMask=TranslationHelpers.generateZeroMask(Integer.parseInt(immediateOperand1.getValue()),Integer.parseInt(immediateOperand2.getValue()),OperandSize.DWORD); final OperandSize dw=OperandSize.DWORD; long baseOffset=(instruction.getAddress().toLong() * 0x100) + instructions.size(); instructions.add(ReilHelpers.createAnd(baseOffset++,dw,sourceRegister,dw,String.valueOf(oneMask),dw,tempVar1)); instructions.add(ReilHelpers.createBsh(baseOffset++,dw,tempVar1,dw,immediateOperand1.getValue(),dw,tempVar2)); instructions.add(ReilHelpers.createAnd(baseOffset++,dw,destinationRegister,dw,String.valueOf(zeroMask),dw,tempVar3)); instructions.add(ReilHelpers.createOr(baseOffset++,dw,tempVar2,dw,tempVar3,dw,destinationRegister)); }
BFI{<c>}{<q><Rd>, <Rn>, #<lsb>, #<width> <lsb>+<width>-1 = msbit if ConditionPassed() then EncodingSpecificOperations(); if msbit >= lsbit then R[d]<msbit:lsbit> = R[n]<(msbit-lsbit):0>; // Other bits of R[d] are unchanged else UNPREDICTABLE;
public static boolean isFunctionalType(TypeSymbol type){ String name=type.getQualifiedName().toString(); return name.startsWith("java.util.function.") || name.equals(Runnable.class.getName()) || (type.isInterface() && (hasAnnotationType(type,FunctionalInterface.class.getName()) || hasAnonymousFunction(type))); }
Returns true if the given type symbol corresponds to a functional type (in the TypeScript way).
public static boolean mkdir(String dir){ if (!exists(dir)) { return (new File(dir)).mkdirs(); } else { return isDirectory(dir); } }
Create a directory, if it does not exist.
private JMenuItem addDemoToMenu(JMenu menu,Class<?> demoClass){ JMenuItem item=new JMenuItem(demoClass.getSimpleName()); JMenu subMenu=null; String packageName=demoClass.getPackage().getName(); Component[] menuComps=menu.getMenuComponents(); int i; for (i=0; i < menuComps.length; i++) { JMenu comp=(JMenu)menuComps[i]; if (comp.getText().equals(packageName)) subMenu=comp; else if (comp.getText().compareTo(packageName) > 0) break; } if (subMenu == null) { subMenu=new JMenu(packageName); menu.add(subMenu,i); } subMenu.add(item); return item; }
Adds a new demo (agent application or console application) to the specified menu.
protected void checkRowExists(String sql) throws Exception { Statement s=this.conn.createStatement(); ResultSet rs=s.executeQuery(sql); assertTrue("Row should exist",rs.next()); rs.close(); s.close(); }
Run the given query and assert that the result contains at least one row.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:38.153 -0500",hash_original_method="C51C4513003EDC9EA86A76A3037140C3",hash_generated_method="5B515AB13D4AEF801140CC12D011B3CB") public void reset(){ adnLikeFiles.clear(); mUsimPhoneBookManager.reset(); clearWaiters(); clearUserWriters(); }
Called from SIMRecords.onRadioNotAvailable and SIMRecords.handleSimRefresh.
public String toString(){ return this.getClass().getName() + "(" + alpha+ ","+ lambda+ ")"; }
Returns a String representation of the receiver.
private boolean _check_arguments(InstalledApp app,String request_source,String action){ if (app == null || request_source == null || action == null) { Log.v(MainActivity.TAG,"WebService was invoked with no targetApp and/or source argument!"); return false; } if (!action.equals(ACTION_DOWNLOAD_APK) && !action.equals(ACTION_VERSION_CHECK)) { return false; } if (ScheduledCheckService.SERVICE_SOURCE.equals(request_source) && _check_cancellation()) { return false; } return true; }
Checks whether the intent arguments are valid and whether the version check should proceed.
public void deleteAll(){ synchronized (this) { try { RefCounted<SolrIndexSearcher> holder=uhandler.core.openNewSearcher(true,true); holder.decref(); } catch ( Exception e) { SolrException.log(log,"Error opening realtime searcher for deleteByQuery",e); } if (map != null) map.clear(); if (prevMap != null) prevMap.clear(); if (prevMap2 != null) prevMap2.clear(); oldDeletes.clear(); deleteByQueries.clear(); } }
currently for testing only
@Override protected boolean isSupportedOperation(Operation operation){ String operationSupportedVer=operation.getSupportedVersion(); if (_keyMap.containsKey(Constants.VERSION) && null != operationSupportedVer) { String versionFromKeyMap=(String)_keyMap.get(Constants.VERSION); String[] versionFromContextFile=patternVerForContFile.split(operationSupportedVer); String[] versionProvided=patternVerProvided.split(versionFromKeyMap); return (versionFromContextFile[0].equals(versionProvided[0])); } return true; }
Returns true if the supportedVersion option is specified in Operation bean false in other cases.
public static ConstantNode forChar(char i,StructuredGraph graph){ return unique(graph,createPrimitive(JavaConstant.forInt(i))); }
Returns a node for a char constant.
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:30.564 -0500",hash_original_method="EB10FD63A8403F00F4E59BED9E510DF9",hash_generated_method="2C4F8F4C8B306CD83B3F5D269A2D4EFC") private static int secondaryHash(int h){ h^=(h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); }
Applies a supplemental hash function to a given hashCode, which defends against poor quality hash functions. This is critical because HashMap uses power-of-two length hash tables, that otherwise encounter collisions for hashCodes that do not differ in lower or upper bits.
private final UpdateReturnState enhancedHashInsert(long[] hashTable,long hash){ int arrayMask=(1 << lgArrLongs_) - 1; int stride=(2 * (int)((hash >> lgArrLongs_) & STRIDE_MASK)) + 1; int curProbe=(int)(hash & arrayMask); long curTableHash=hashTable[curProbe]; while ((curTableHash != hash) && (curTableHash != 0)) { if (curTableHash >= thetaLong_) { int rememberPos=curProbe; curProbe=(curProbe + stride) & arrayMask; curTableHash=hashTable[curProbe]; while ((curTableHash != hash) && (curTableHash != 0)) { curProbe=(curProbe + stride) & arrayMask; curTableHash=hashTable[curProbe]; } if (curTableHash == hash) { return RejectedDuplicate; } assert (curTableHash == 0); hashTable[rememberPos]=hash; thetaLong_=(long)(thetaLong_ * alpha_); dirty_=true; return InsertedCountNotIncremented; } assert (curTableHash < thetaLong_); curProbe=(curProbe + stride) & arrayMask; curTableHash=hashTable[curProbe]; } if (curTableHash == hash) { return RejectedDuplicate; } assert (curTableHash == 0); hashTable[curProbe]=hash; thetaLong_=(long)(thetaLong_ * alpha_); dirty_=true; if (++curCount_ > hashTableThreshold_) { rebuildDirty(); } return InsertedCountIncremented; }
Enhanced Knuth-style Open Addressing, Double Hash insert. The insertion process will overwrite an already existing, dirty (over-theta) value if one is found in the search. If an empty cell is found first, it will be inserted normally.
public ArgumentParser(final String[] args,final boolean enableShortOptions){ this.args=new ArrayList<String>(); this.enableShortOptions=enableShortOptions; parse(args); }
Constructs a new <code>ArgumentParser</code> with the specified behaviour regarding shortOptions.
public String returnVolumeHLU(URI volumeURI){ String hlu=ExportGroup.LUN_UNASSIGNED_DECIMAL_STR; if (_volumes != null) { String temp=_volumes.get(volumeURI.toString()); hlu=(temp != null) ? temp : ExportGroup.LUN_UNASSIGNED_DECIMAL_STR; } return hlu; }
Returns the HLU for the specified Volume/BlockObject
public NoSuchMethodException(String s){ super(s); }
Constructs a <code>NoSuchMethodException</code> with a detail message.
@Override public final boolean isDirty(){ return dirty; }
Returns true if this page is dirty, false otherwise.
public static boolean isEncryptedFilesystemEnabled(){ return SystemProperties.getBoolean(SYSTEM_PROPERTY_EFS_ENABLED,false); }
Returns whether the Encrypted File System feature is enabled on the device or not.
public static synchronized void loadLibrary(String shortName) throws UnsatisfiedLinkError { if (sSoSources == null) { if ("http://www.android.com/".equals(System.getProperty("java.vendor.url"))) { assertInitialized(); } else { System.loadLibrary(shortName); return; } } try { loadLibraryBySoName(System.mapLibraryName(shortName),0); } catch ( IOException ex) { throw new RuntimeException(ex); } catch ( UnsatisfiedLinkError ex) { String message=ex.getMessage(); if (message != null && message.contains("unexpected e_machine:")) { throw new WrongAbiError(ex); } throw ex; } }
Load a shared library, initializing any JNI binding it contains.
public void testBug12970() throws Exception { if (versionMeetsMinimum(5,0,8)) { String tableName="testBug12970"; createTable(tableName,"(binary_field BINARY(32), varbinary_field VARBINARY(64))"); try { this.rs=this.conn.getMetaData().getColumns(this.conn.getCatalog(),null,tableName,"%"); assertTrue(this.rs.next()); assertEquals(Types.BINARY,this.rs.getInt("DATA_TYPE")); assertEquals(32,this.rs.getInt("COLUMN_SIZE")); assertTrue(this.rs.next()); assertEquals(Types.VARBINARY,this.rs.getInt("DATA_TYPE")); assertEquals(64,this.rs.getInt("COLUMN_SIZE")); this.rs.close(); this.rs=this.stmt.executeQuery("SELECT binary_field, varbinary_field FROM " + tableName); ResultSetMetaData rsmd=this.rs.getMetaData(); assertEquals(Types.BINARY,rsmd.getColumnType(1)); assertEquals(32,rsmd.getPrecision(1)); assertEquals(Types.VARBINARY,rsmd.getColumnType(2)); assertEquals(64,rsmd.getPrecision(2)); this.rs.close(); } finally { if (this.rs != null) { this.rs.close(); } } } }
Tests fix for BUG#12970 - java.sql.Types.OTHER returned for binary and varbinary columns.
public MBeanAttributeInfo(String name,String type,String description,boolean isReadable,boolean isWritable,boolean isIs){ this(name,type,description,isReadable,isWritable,isIs,(Descriptor)null); }
Constructs an <CODE>MBeanAttributeInfo</CODE> object.
public void addAll(List<Fragment> aSplits){ splits.addAll(aSplits); }
Adds a list of split elements.
public static final byte[] inflateBestEffort(byte[] in,int sizeLimit){ ByteArrayOutputStream outStream=new ByteArrayOutputStream(EXPECTED_COMPRESSION_RATIO * in.length); Inflater inflater=new Inflater(true); InflaterInputStream inStream=new InflaterInputStream(new ByteArrayInputStream(in),inflater); byte[] buf=new byte[BUF_SIZE]; int written=0; while (true) { try { int size=inStream.read(buf); if (size <= 0) break; if ((written + size) > sizeLimit) { outStream.write(buf,0,sizeLimit - written); break; } outStream.write(buf,0,size); written+=size; } catch ( Exception e) { LOG.info("Caught Exception in inflateBestEffort",e); break; } } try { outStream.close(); } catch ( IOException e) { } return outStream.toByteArray(); }
Returns an inflated copy of the input array, truncated to <code>sizeLimit</code> bytes, if necessary. If the deflated input has been truncated or corrupted, a best-effort attempt is made to inflate as much as possible. If no data can be extracted <code>null</code> is returned.
public static void toggleHideyBar(View decorView){ int uiOptions=decorView.getSystemUiVisibility(); int newUiOptions=uiOptions; boolean isImmersiveModeEnabled=((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions); if (isImmersiveModeEnabled) { } else { } if (Build.VERSION.SDK_INT >= 14) { newUiOptions^=View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } if (Build.VERSION.SDK_INT >= 16) { newUiOptions^=View.SYSTEM_UI_FLAG_FULLSCREEN; } if (Build.VERSION.SDK_INT >= 18) { newUiOptions^=View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } if (Build.VERSION.SDK_INT >= 19) { newUiOptions^=View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; newUiOptions^=View.SYSTEM_UI_FLAG_IMMERSIVE; } decorView.setSystemUiVisibility(newUiOptions); }
Detects and toggles immersive mode (also known as "hidey bar" mode).
public <P,Q>String testSuperSuperMethod(int x1,int x2){ return null; }
Test 23 passes.
public static void assertEqualsAndHash(Object one,Object two){ assertEquals(one,two); assertEquals(two,one); assertEquals(one.hashCode(),two.hashCode()); }
Asserts that two objects are equal according to their equals() method. Also asserts that their hash codes are the same.
public void shutdownImmediately(){ setPowerOffCount(1); try { checkPowerOff(); } catch ( DbException e) { } closeFiles(); }
Immediately close the database.
public FIXMessage create(){ return new FIXMessage(config.getMaxFieldCount(),config.getFieldCapacity()); }
Create a message container.
public static void println(String s){ System.out.println(s); }
Prints a string to System.out with a newline
public static Map<String,String> extractDimColsDataTypeValues(String colDataTypes){ Map<String,String> mapOfColNameDataType=new HashMap<String,String>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); if (null == colDataTypes || colDataTypes.isEmpty()) { return mapOfColNameDataType; } String[] colArray=colDataTypes.split(CarbonCommonConstants.AMPERSAND_SPC_CHARACTER); String[] colValueArray=null; for ( String colArrayVal : colArray) { colValueArray=colArrayVal.split(CarbonCommonConstants.COMA_SPC_CHARACTER); mapOfColNameDataType.put(colValueArray[0].toLowerCase(),colValueArray[1]); } return mapOfColNameDataType; }
This will extract the high cardinality count from the string.
public PatternFitModel(Simulation simulation,GeneralAlgorithmRunner algorithmRunner,Parameters params){ if (params == null) { throw new NullPointerException("Parameters must not be null"); } this.parameters=params; DataModelList dataModels=simulation.getDataModelList(); this.dataModelList=dataModels; List<Graph> graphs=algorithmRunner.getGraphs(); if (dataModels.size() != graphs.size()) { throw new IllegalArgumentException("Sorry, I was expecting the same number of data sets as result graphs."); } if (((DataSet)dataModels.get(0)).isDiscrete()) { bayesPms=new ArrayList<>(); bayesIms=new ArrayList<>(); for (int i=0; i < dataModels.size(); i++) { DataSet dataSet=(DataSet)dataModels.get(0); Graph dag=SearchGraphUtils.dagFromPattern(graphs.get(0)); BayesPm pm=new BayesPmWrapper(dag,new DataWrapper(dataSet)).getBayesPm(); bayesPms.add(pm); bayesIms.add(estimate(dataSet,pm)); } } else if (((DataSet)dataModels.get(0)).isContinuous()) { semPms=new ArrayList<>(); semIms=new ArrayList<>(); for (int i=0; i < dataModels.size(); i++) { DataSet dataSet=(DataSet)dataModels.get(0); Graph dag=SearchGraphUtils.dagFromPattern(graphs.get(0)); try { SemPm pm=new SemPm(dag); semPms.add(pm); semIms.add(estimate(dataSet,pm)); } catch ( Exception e) { e.printStackTrace(); Graph mag=SearchGraphUtils.pagToMag(graphs.get(0)); SemGraph graph=new SemGraph(mag); graph.setShowErrorTerms(false); SemPm pm=new SemPm(graph); semPms.add(pm); semIms.add(estimatePag(dataSet,pm)); } } } }
Compares the results of a PC to a reference workbench by counting errors of omission and commission. The counts can be retrieved using the methods <code>countOmissionErrors</code> and <code>countCommissionErrors</code>.
private boolean discardUpstreamMediaChunks(int queueLength){ if (mediaChunks.size() <= queueLength) { return false; } long startTimeUs=0; long endTimeUs=mediaChunks.getLast().endTimeUs; BaseMediaChunk removed=null; while (mediaChunks.size() > queueLength) { removed=mediaChunks.removeLast(); startTimeUs=removed.startTimeUs; loadingFinished=false; } sampleQueue.discardUpstreamSamples(removed.getFirstSampleIndex()); notifyUpstreamDiscarded(startTimeUs,endTimeUs); return true; }
Discard upstream media chunks until the queue length is equal to the length specified.
public String toString(){ if (isNodeSet()) { return "XMLSignatureInput/NodeSet/" + inputNodeSet.size() + " nodes/"+ getSourceURI(); } if (isElement()) { return "XMLSignatureInput/Element/" + subNode + " exclude "+ excludeNode+ " comments:"+ excludeComments+ "/"+ getSourceURI(); } try { return "XMLSignatureInput/OctetStream/" + getBytes().length + " octets/"+ getSourceURI(); } catch ( IOException iex) { return "XMLSignatureInput/OctetStream//" + getSourceURI(); } catch ( CanonicalizationException cex) { return "XMLSignatureInput/OctetStream//" + getSourceURI(); } }
Method toString
RuleBasedBreakIterator(String datafile) throws IOException, MissingResourceException { readTables(datafile); }
Constructs a RuleBasedBreakIterator according to the datafile provided.
public void clearExpiration(){ builder.expirationTime(null); builder.expirationTimeInterval(null); }
Clears both expiration values, indicating that the notification should never expire.
void doSimStep(final double now){ int inLinksCounter=0; double inLinksCapSum=0.0; for ( PTQLink link : this.inLinksArrayCache) { if (!link.isNotOfferingVehicle()) { this.tempLinks[inLinksCounter]=link; inLinksCounter++; inLinksCapSum+=link.getLink().getCapacity(now); } } if (inLinksCounter == 0) { this.active=false; return; } int auxCounter=0; while (auxCounter < inLinksCounter) { double rndNum=random.nextDouble() * inLinksCapSum; double selCap=0.0; for (int i=0; i < inLinksCounter; i++) { PTQLink link=this.tempLinks[i]; if (link == null) continue; selCap+=link.getLink().getCapacity(now); if (selCap >= rndNum) { auxCounter++; inLinksCapSum-=link.getLink().getCapacity(now); this.tempLinks[i]=null; this.clearLinkBuffer(link,now); break; } } } }
Moves vehicles from the inlinks' buffer to the outlinks where possible.<br> The inLinks are randomly chosen, and for each link all vehicles in the buffer are moved to their desired outLink as long as there is space. If the front most vehicle in a buffer cannot move across the node because there is no free space on its destination link, the work on this inLink is finished and the next inLink's buffer is handled (this means, that at the node, all links have only like one lane, and there are no separate lanes for the different outLinks. Thus if the front most vehicle cannot drive further, all other vehicles behind must wait, too, even if their links would be free).
public void popRTFContext(){ int previous=m_last_pushed_rtfdtm.pop(); if (null == m_rtfdtm_stack) return; if (m_which_rtfdtm == previous) { if (previous >= 0) { boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark(); } } else while (m_which_rtfdtm != previous) { boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark(); --m_which_rtfdtm; } }
Pop the RTFDTM's context mark. This discards any RTFs added after the last mark was set. If there is no RTF DTM, there's nothing to pop so this becomes a no-op. If pushes were issued before this was called, we count on the fact that popRewindMark is defined such that overpopping just resets to empty. Complicating factor: We need to handle the case of popping back to a previous RTF DTM, if one of the weird produce-an-RTF-to-build-an-RTF cases arose. Basically: If pop says this DTM is now empty, then return to the previous if one exists, in whatever state we left it in. UGLY, but hopefully the situation which forces us to consider this will arise exceedingly rarely.
@Override public void onDetach(){ synchronized (mThread) { mProgressBar=null; mReady=false; mThread.notify(); } super.onDetach(); }
This is called right before the fragment is detached from its current activity instance.
private static int bitLength(int[] val,int len){ if (len == 0) return 0; return ((len - 1) << 5) + bitLengthForInt(val[0]); }
Calculate bitlength of contents of the first len elements an int array, assuming there are no leading zero ints.
public DefaultMosaicTransferFeeCalculator(){ this(null); }
Creates a default mosaic transfer fee calculator.
public static void prepareToDraw(){ GLES20.glUseProgram(sProgramHandle); Util.checkGlError("glUseProgram"); GLES20.glEnableVertexAttribArray(sPositionHandle); Util.checkGlError("glEnableVertexAttribArray"); GLES20.glVertexAttribPointer(sPositionHandle,COORDS_PER_VERTEX,GLES20.GL_FLOAT,false,VERTEX_STRIDE,sOutlineVertexBuffer); Util.checkGlError("glVertexAttribPointer"); sDrawPrepared=true; }
Performs setup common to all BasicAlignedRects.
public ReflectiveOperationException(String message){ super(message); }
Constructs a new exception with the given detail message.
public void updateToolbar(){ toolBar.update(); }
Update the elements of the main tool bar.
public static void printTLCBug(int errorCode,String[] parameters){ recorder.record(errorCode,(Object[])parameters); DebugPrinter.print("entering printTLCBug(int, String[]) with errorCode " + errorCode); ToolIO.out.println(getMessage(TLCBUG,errorCode,parameters)); DebugPrinter.print("leaving printTLCBug(int, String[])"); }
Prints parameterized TLC BUG message
private int findNearestPair(double key,double secondaryKey){ int low=0; int high=m_NumValues; int middle=0; while (low < high) { middle=(low + high) / 2; double current=m_CondValues[middle]; if (current == key) { double secondary=m_Values[middle]; if (secondary == secondaryKey) { return middle; } if (secondary > secondaryKey) { high=middle; } else if (secondary < secondaryKey) { low=middle + 1; } } if (current > key) { high=middle; } else if (current < key) { low=middle + 1; } } return low; }
Execute a binary search to locate the nearest data value
public EventNode next() throws Exception { EventNode next=peek; if (next == null) { next=read(); } else { peek=null; } return next; }
This is used to take the next node from the document. This will scan through the document, ignoring any comments to find the next relevant XML event to acquire. Typically events will be the start and end of an element, as well as any text nodes.
@Override public int size(){ return (this.blob == null) ? 0 : this.blob.size(); }
ask for the number of entries
public boolean isReadOnly(){ Object oo=get_Value(COLUMNNAME_IsReadOnly); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Read Only.
@Override public void release(){ this.converterId=null; }
<p>Release references to any acquired resources.
@Override public boolean has(Pattern pattern){ final Matcher matcher=pattern.matcher(rest()); return matcher.find() && matcher.start() == 0; }
This method will determine whether the indicated pattern can be found at this point in the document or not
@Override public void run(){ amIActive=true; String inputHeader=null; String outputHeader=null; double zConvFactor=1; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } inputHeader=args[0]; outputHeader=args[1]; zConvFactor=Double.parseDouble(args[2]); if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { int row, col; double z; double[] N=new double[8]; float progress=0; int[] Dy={-1,0,1,1,1,0,-1,-1}; int[] Dx={1,1,1,0,-1,-1,-1,0}; final double radToDeg=180 / Math.PI; double Zx, Zy, Zxx, Zyy, Zxy, Zx2, Zy2, p, q; WhiteboxRaster inputFile=new WhiteboxRaster(inputHeader,"r"); inputFile.isReflectedAtEdges=true; int rows=inputFile.getNumberRows(); int cols=inputFile.getNumberColumns(); double gridRes=inputFile.getCellSizeX(); double gridResTimes2=gridRes * 2; double gridResSquared=gridRes * gridRes; double fourTimesGridResSquared=gridResSquared * 4; double curv; double noData=inputFile.getNoDataValue(); if (inputFile.getXYUnits().toLowerCase().contains("deg") || inputFile.getProjection().toLowerCase().contains("geog")) { double midLat=(inputFile.getNorth() - inputFile.getSouth()) / 2.0; if (midLat <= 90 && midLat >= -90) { zConvFactor=1.0 / (113200 * Math.cos(Math.toRadians(midLat))); } } WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFile.setPreferredPalette("blue_white_red.pal"); for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=inputFile.getValue(row,col); if (z != noData) { for (int i=0; i < 8; i++) { N[i]=inputFile.getValue(row + Dy[i],col + Dx[i]); if (N[i] != noData) { N[i]=N[i] * zConvFactor; } else { N[i]=z * zConvFactor; } } Zx=(N[1] - N[5]) / gridResTimes2; Zy=(N[7] - N[3]) / gridResTimes2; Zxx=(N[1] - 2 * z + N[5]) / gridResSquared; Zyy=(N[7] - 2 * z + N[3]) / gridResSquared; Zxy=(-N[6] + N[0] + N[4] - N[2]) / fourTimesGridResSquared; Zx2=Zx * Zx; Zy2=Zy * Zy; p=Zx2 + Zy2; q=p + 1; if (p > 0) { curv=(Zxx * Zx2 + 2 * Zxy * Zx* Zy + Zyy * Zy2) / (p * Math.pow(q,1.5)); outputFile.setValue(row,col,curv * radToDeg * 100); } else { outputFile.setValue(row,col,noData); } } else { outputFile.setValue(row,col,noData); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFile.addMetadataEntry("Created on " + new Date()); inputFile.close(); outputFile.close(); returnData(outputHeader); } catch ( OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch ( Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(),e); } finally { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
private Retry processResponseHeaders() throws IOException { Proxy selectedProxy=httpEngine.connection != null ? httpEngine.connection.getRoute().getProxy() : client.getProxy(); final int responseCode=getResponseCode(); switch (responseCode) { case HTTP_PROXY_AUTH: if (selectedProxy.type() != Proxy.Type.HTTP) { throw new ProtocolException("Received HTTP_PROXY_AUTH (407) code while not using proxy"); } case HTTP_UNAUTHORIZED: boolean credentialsFound=HttpAuthenticator.processAuthHeader(client.getAuthenticator(),getResponseCode(),httpEngine.getResponseHeaders().getHeaders(),rawRequestHeaders,selectedProxy,url); return credentialsFound ? Retry.SAME_CONNECTION : Retry.NONE; case HTTP_MULT_CHOICE: case HTTP_MOVED_PERM: case HTTP_MOVED_TEMP: case HTTP_SEE_OTHER: case HTTP_TEMP_REDIRECT: if (!getInstanceFollowRedirects()) { return Retry.NONE; } if (++redirectionCount > MAX_REDIRECTS) { throw new ProtocolException("Too many redirects: " + redirectionCount); } if (responseCode == HTTP_TEMP_REDIRECT && !method.equals("GET") && !method.equals("HEAD")) { return Retry.NONE; } String location=getHeaderField("Location"); if (location == null) { return Retry.NONE; } URL previousUrl=url; url=new URL(previousUrl,location); if (!url.getProtocol().equals("https") && !url.getProtocol().equals("http")) { return Retry.NONE; } boolean sameProtocol=previousUrl.getProtocol().equals(url.getProtocol()); if (!sameProtocol && !client.getFollowProtocolRedirects()) { return Retry.NONE; } boolean sameHost=previousUrl.getHost().equals(url.getHost()); boolean samePort=getEffectivePort(previousUrl) == getEffectivePort(url); if (sameHost && samePort && sameProtocol) { return Retry.SAME_CONNECTION; } else { return Retry.DIFFERENT_CONNECTION; } default : return Retry.NONE; } }
Returns the retry action to take for the current response headers. The headers, proxy and target URL or this connection may be adjusted to prepare for a follow up request.
public DateTime withDayOfMonth(int dayOfMonth){ return withMillis(getChronology().dayOfMonth().set(getMillis(),dayOfMonth)); }
Returns a copy of this datetime with the day of month field updated. <p> DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of month changed.
public static boolean equals(int[] left,int[] right){ if (left == null) { return right == null; } if (right == null) { return false; } if (left == right) { return true; } if (left.length != right.length) { return false; } for (int i=0; i < left.length; i++) { if (left[i] != right[i]) return false; } return true; }
Compare the contents of this array to the contents of the given array.
private void testIsoYearJanuary1thFriday() throws Exception { assertEquals(2009,getIsoYear(parse("2009-12-28"))); assertEquals(2009,getIsoYear(parse("2009-12-29"))); assertEquals(2009,getIsoYear(parse("2009-12-30"))); assertEquals(2009,getIsoYear(parse("2009-12-31"))); assertEquals(2009,getIsoYear(parse("2010-01-01"))); assertEquals(2009,getIsoYear(parse("2010-01-02"))); assertEquals(2009,getIsoYear(parse("2010-01-03"))); assertEquals(2010,getIsoYear(parse("2010-01-04"))); }
January 1st is a Friday therefore 1st - 3rd of January belong to the previous year.
public String poll() throws InterruptedException { return poll(DEFAULT_TIMEOUT); }
Returns the changes received by other sessions for the shared diagram. The method returns an empty XML node if no change was received within 10 seconds.
public void close() throws SQLException { Object mutex=this; MySQLConnection conn=null; if (this.owner != null) { conn=this.owner.connection; if (conn != null) { mutex=conn.getConnectionMutex(); } } boolean hadMore=false; int howMuchMore=0; synchronized (mutex) { while (next() != null) { hadMore=true; howMuchMore++; if (howMuchMore % 100 == 0) { Thread.yield(); } } if (conn != null) { if (!conn.getClobberStreamingResults() && conn.getNetTimeoutForStreamingResults() > 0) { String oldValue=conn.getServerVariable("net_write_timeout"); if (oldValue == null || oldValue.length() == 0) { oldValue="60"; } this.io.clearInputStream(); java.sql.Statement stmt=null; try { stmt=conn.createStatement(); ((com.mysql.jdbc.StatementImpl)stmt).executeSimpleNonQuery(conn,"SET net_write_timeout=" + oldValue); } finally { if (stmt != null) { stmt.close(); } } } if (conn.getUseUsageAdvisor()) { if (hadMore) { ProfilerEventHandler eventSink=ProfilerEventHandlerFactory.getInstance(conn); eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN,"",this.owner.owningStatement == null ? "N/A" : this.owner.owningStatement.currentCatalog,this.owner.connectionId,this.owner.owningStatement == null ? -1 : this.owner.owningStatement.getId(),-1,System.currentTimeMillis(),0,Constants.MILLIS_I18N,null,null,Messages.getString("RowDataDynamic.2") + howMuchMore + Messages.getString("RowDataDynamic.3")+ Messages.getString("RowDataDynamic.4")+ Messages.getString("RowDataDynamic.5")+ Messages.getString("RowDataDynamic.6")+ this.owner.pointOfOrigin)); } } } } this.metadata=null; this.owner=null; }
We're done.
public static boolean canTranslate(String unlocalizedString){ if (I18n.hasKey(unlocalizedString)) return true; else { if (UNLOCALIZED_STRINGS.size() < 100 && !UNLOCALIZED_STRINGS.contains(unlocalizedString)) UNLOCALIZED_STRINGS.add(unlocalizedString); return false; } }
Use this function if you want the string to be logged in debug mode
@Bean public BuildInformation buildInformation(){ BuildInformation buildInformation=new BuildInformation(); buildInformation.setBuildDate(environment.getProperty("build.date")); buildInformation.setBuildNumber(environment.getProperty("build.number")); buildInformation.setBuildOs(environment.getProperty("build.os")); buildInformation.setBuildUser(environment.getProperty("build.user")); LOGGER.info(String.format("Build Information: {buildNumber=%s, buildDate=%s, buildUser=%s, buildOs=%s}",buildInformation.getBuildNumber(),buildInformation.getBuildDate(),buildInformation.getBuildUser(),buildInformation.getBuildOs())); LOGGER.info("System Properties: " + getSystemPropertyMap("java.version","java.runtime.version","java.vm.version","java.vm.name","java.vendor","java.vendor.url","java.home","java.class.path","os.name","os.version","os.arch","user.name","user.dir","user.home","file.separator","path.separator")); return buildInformation; }
Gets the build information.
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:36.433 -0500",hash_original_method="C84307F15A2AB40D2A9CA51D74C5FD0F",hash_generated_method="ED5D513DE4FFFE667446D5431C83A8D7") synchronized void unparcel(){ }
If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
public void clear(){ int h=head; int t=tail; if (h != t) { head=tail=0; int i=h; int mask=elements.length - 1; do { elements[i]=null; i=(i + 1) & mask; } while (i != t); } }
Removes all of the elements from this deque. The deque will be empty after this call returns.
Vset check(Environment env,Context ctx,Vset vset,Hashtable exp){ checkLabel(env,ctx); if (args.length > 0) { vset=reach(env,vset); CheckContext newctx=new CheckContext(ctx,this); Environment newenv=Context.newEnvironment(env,newctx); for (int i=0; i < args.length; i++) { vset=args[i].checkBlockStatement(newenv,newctx,vset,exp); } vset=vset.join(newctx.vsBreak); } return ctx.removeAdditionalVars(vset); }
Check statement
public static void releaseThreadPool(){ mExecutorService=null; }
This executor will be shutdown if it is no longer referenced and has no threads.
@VisibleForTesting protected Process startExecutorProcess(int container){ return ShellUtils.runASyncProcess(getExecutorCommand(container),new File(LocalContext.workingDirectory(config)),Integer.toString(container)); }
Start executor process via running an async shell process
private String createEndMissionXml(){ return "</mission>"; }
A helper function to create an XML string representing the end of a mission.
public void or() throws IOException { writeCode(OR); }
SWFActions interface
public SVGTextFigure(){ this("Text"); }
Creates a new instance.
public void removeUserType(){ if (uriParms != null) uriParms.delete(USER); }
Set the user type.
@Override public void writeToNBT(NBTTagCompound tag){ try { super.writeToNBT(tag); } catch ( RuntimeException e) { } NBTTagCompound data=new NBTTagCompound(); data.setDouble("energy",energyStored); tag.setTag("IC2BasicSink",data); }
Forward for the base TileEntity's writeToNBT(), used for saving the state.
public void randomize(List<CellIndex> cellIndices){ Random rand=new Random(); int range=getUpperBound() - getLowerBound(); for ( CellIndex cellIndex : cellIndices) { int row=cellIndex.row; int col=cellIndex.col; double value=(rand.nextDouble() * range) + getLowerBound(); setLogicalValue(row,col,value,false); } fireTableDataChanged(); }
Randomize neurons within specified bounds.
protected void dispatchQueuedEvents(){ if (isDispatching.get()) { return; } isDispatching.set(true); try { while (true) { EventWithHandler eventWithHandler=eventsToDispatch.get().poll(); if (eventWithHandler == null) { break; } if (eventWithHandler.handler.isValid()) { dispatch(eventWithHandler.event,eventWithHandler.handler); } } } finally { isDispatching.set(false); } }
Drain the queue of events to be dispatched. As the queue is being drained, new events may be posted to the end of the queue.
public MyHashMap(){ this(DEFAULT_INITIAL_CAPACITY,DEFAULT_MAX_LOAD_FACTOR); }
Construct a map with the default capacity and load factor
public GT_MetaGenerated_Item_X32(String aUnlocalized,OrePrefixes... aGeneratedPrefixList){ super(aUnlocalized,(short)32000,(short)766); mGeneratedPrefixList=Arrays.copyOf(aGeneratedPrefixList,32); for (int i=0; i < 32000; i++) { OrePrefixes tPrefix=mGeneratedPrefixList[i / 1000]; if (tPrefix == null) continue; Materials tMaterial=GregTech_API.sGeneratedMaterials[i % 1000]; if (tMaterial == null) continue; if (doesMaterialAllowGeneration(tPrefix,tMaterial)) { ItemStack tStack=new ItemStack(this,1,i); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name",getDefaultLocalization(tPrefix,tMaterial,i)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip",tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); if (tPrefix.mIsUnificatable) { GT_OreDictUnificator.set(tPrefix,tMaterial,tStack); } else { GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial),tStack); } if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { GregTech_API.sSolderingMetalList.add(tStack); } } } }
Creates the Item using these Parameters.