code
stringlengths
10
174k
nl
stringlengths
3
129k
protected void emptyTag(Element elem) throws BadLocationException, IOException { if (!inContent && !inPre) { indentSmart(); } AttributeSet attr=elem.getAttributes(); closeOutUnwantedEmbeddedTags(attr); writeEmbeddedTags(attr); if (matchNameAttribute(attr,HTML.Tag.CONTENT)) { inContent=true; text(elem); } else if (matchNameAttribute(attr,HTML.Tag.COMMENT)) { comment(elem); } else { boolean isBlock=isBlockTag(elem.getAttributes()); if (inContent && isBlock) { writeLineSeparator(); indentSmart(); } Object nameTag=(attr != null) ? attr.getAttribute(StyleConstants.NameAttribute) : null; Object endTag=(attr != null) ? attr.getAttribute(HTML.Attribute.ENDTAG) : null; boolean outputEndTag=false; if (nameTag != null && endTag != null && (endTag instanceof String) && endTag.equals("true")) { outputEndTag=true; } if (completeDoc && matchNameAttribute(attr,HTML.Tag.HEAD)) { if (outputEndTag) { writeStyles(((HTMLDocument)getDocument()).getStyleSheet()); } wroteHead=true; } write('<'); if (outputEndTag) { write('/'); } write(elem.getName()); writeAttributes(attr); write('>'); if (matchNameAttribute(attr,HTML.Tag.TITLE) && !outputEndTag) { Document doc=elem.getDocument(); String title=(String)doc.getProperty(Document.TitleProperty); write(title); } else if (!inContent || isBlock) { writeLineSeparator(); if (isBlock && inContent) { indentSmart(); } } } }
Writes out all empty elements (all tags that have no corresponding end tag).
public boolean isPending(){ return getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.PENDING; }
Convenience wrapper around getConfidence().getConfidenceType()
public final void fireSensorMatrixChanged(final SensorMatrix oldSensorMatrix,final SensorMatrix sensorMatrix){ if (oldSensorMatrix == null) { throw new IllegalArgumentException("oldSensorMatrix must not be null"); } if (sensorMatrix == null) { throw new IllegalArgumentException("sensorMatrix must not be null"); } Object[] listeners=listenerList.getListenerList(); VisionWorldModelEvent event=null; for (int i=listeners.length - 2; i >= 0; i-=2) { if (listeners[i] == VisionWorldModelListener.class) { if (event == null) { event=new VisionWorldModelEvent(source,oldSensorMatrix,sensorMatrix); } ((VisionWorldModelListener)listeners[i + 1]).sensorMatrixChanged(event); } } }
Fire a sensor matrix changed event to all registered vision world model listeners.
public DNameConstraints(JDialog parent){ super(parent); setTitle(res.getString("DNameConstraints.Title")); initComponents(); }
Creates a new DNameConstraints dialog.
@Override public void visit(NodeVisitor v){ v.visit(this); }
Visits this node. There are no children.
@Override public void LDC(int x){ env.topFrame().operandStack.pushBv32(ExpressionFactory.buildNewIntegerConstant(x)); }
Bytecode instruction stream: ... ,0x12, index, ... <p> Push corresponding symbolic constant from constant pool (at index) onto the operand stack. http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2. doc8.html#ldc
@SuppressWarnings("unused") private SentenceFilteredTrie filter_regexp(Trie unfilteredTrie){ SentenceFilteredTrie trie=null; if (unfilteredTrie.hasRules()) if (matchesSentence(unfilteredTrie)) trie=new SentenceFilteredTrie(unfilteredTrie); else return null; if (unfilteredTrie.hasExtensions()) for ( Entry<Integer,? extends Trie> arc : unfilteredTrie.getChildren().entrySet()) { Trie unfilteredChildTrie=arc.getValue(); SentenceFilteredTrie nextTrie=filter_regexp(unfilteredChildTrie); if (nextTrie != null) { if (trie == null) trie=new SentenceFilteredTrie(unfilteredTrie); trie.children.put(arc.getKey(),nextTrie); } } return trie; }
Alternate filter that uses regular expressions, walking the grammar trie and matching the source side of each rule collection against the input sentence. Failed matches are discarded, and trie nodes extending from that position need not be explored.
protected void engineUpdate(byte input){ if (first == true) { md.update(k_ipad); first=false; } md.update(input); }
Processes the given byte.
@Override public void configureZone(final StendhalRPZone zone,final Map<String,String> attributes){ buildAdosGreetingSoldier(zone); }
Configure a zone.
public static KerberosTime parse(DerInputStream data,byte explicitTag,boolean optional) throws Asn1Exception, IOException { if ((optional) && (((byte)data.peekByte() & (byte)0x1F) != explicitTag)) return null; DerValue der=data.getDerValue(); if (explicitTag != (der.getTag() & (byte)0x1F)) { throw new Asn1Exception(Krb5.ASN1_BAD_ID); } else { DerValue subDer=der.getData().getDerValue(); Date temp=subDer.getGeneralizedTime(); return new KerberosTime(temp.getTime(),0); } }
Parse (unmarshal) a kerberostime from a DER input stream. This form parsing might be used when expanding a value which is part of a constructed sequence and uses explicitly tagged type.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:38.770 -0500",hash_original_method="C464D16A28A9DCABA3B0B8FD02F52155",hash_generated_method="0A183B7841054C14E915336FD1A0DC9E") public static boolean hasExtension(String extension){ if (extension == null || extension.isEmpty()) { return false; } return extensionToMimeTypeMap.containsKey(extension); }
Returns true if the given extension has a registered MIME type.
public void testExhaustContentSource() throws Exception { String algLines[]={"# ----- properties ","content.source=org.apache.lucene.benchmark.byTask.feeds.SingleDocSource","content.source.log.step=1","doc.term.vector=false","content.source.forever=false","directory=RAMDirectory","doc.stored=false","doc.tokenized=false","# ----- alg ","CreateIndex","{ AddDoc } : * ","ForceMerge(1)","CloseIndex","OpenReader","{ CountingSearchTest } : 100","CloseReader","[ CountingSearchTest > : 30","[ CountingSearchTest > : 9"}; CountingSearchTestTask.numSearches=0; Benchmark benchmark=execBenchmark(algLines); assertEquals("TestSearchTask was supposed to be called!",139,CountingSearchTestTask.numSearches); assertTrue("Index does not exist?...!",DirectoryReader.indexExists(benchmark.getRunData().getDirectory())); IndexWriter iw=new IndexWriter(benchmark.getRunData().getDirectory(),new IndexWriterConfig(new MockAnalyzer(random())).setOpenMode(OpenMode.APPEND)); iw.close(); IndexReader ir=DirectoryReader.open(benchmark.getRunData().getDirectory()); assertEquals("1 docs were added to the index, this is what we expect to find!",1,ir.numDocs()); ir.close(); }
Test Exhasting Doc Maker logic
@DSSource({DSSourceKind.NETWORK}) @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:38:10.723 -0500",hash_original_method="8EB7107FA2367D701AF7CBC234A81F19",hash_generated_method="B23ED7B4CA5FBA5E6343C71EA6EDB1E4") public String toString(){ StringBuffer header=new StringBuffer(); header.append("From: "); header.append(__from); header.append("\nNewsgroups: "); header.append(__newsgroups.toString()); header.append("\nSubject: "); header.append(__subject); header.append('\n'); if (__headerFields.length() > 0) header.append(__headerFields.toString()); header.append('\n'); return header.toString(); }
Converts the SimpleNNTPHeader to a properly formatted header in the form of a String, including the blank line used to separate the header from the article body. <p>
private void sincronizarBase(){ listaOrganizacao=ControleDAO.getBanco().getOrganizacaoDAO().listar(); }
Sincronizar dados com banco de dados
protected int newlines(char[] text){ int result=0; for (int i=0; i < text.length; i++) { if (text[i] == 10) { result++; } } return result; }
Returns the number of newlines in the given char array.
protected BinaryBitmap toBitmap(LuminanceSource source){ return new BinaryBitmap(new HybridBinarizer(source)); }
Given an image source, convert to a binary bitmap. Override this to use a custom binarizer.
protected void handleMergeException(Directory dir,Throwable exc){ throw new MergePolicy.MergeException(exc,dir); }
Called when an exception is hit in a background merge thread
public FactoryDto merge(FactoryDto factory,ProjectConfigDto computedProjectConfig){ final List<ProjectConfigDto> projects=factory.getWorkspace().getProjects(); if (projects == null || projects.isEmpty()) { factory.getWorkspace().setProjects(singletonList(computedProjectConfig)); return factory; } if (projects.size() == 1) { ProjectConfigDto projectConfig=projects.get(0); if (projectConfig.getSource() == null) projectConfig.setSource(computedProjectConfig.getSource()); } return factory; }
Apply the merging of project config dto including source storage dto into the existing factory <p> here are the following rules <ul> <li>no projects --> add whole project</li> <li>if projects <ul> <li>: if there is only one project: add source if missing</li> <li> if many projects: do nothing</li> </ul></li> </ul>
public StatusLine parseSIPStatusLine(String statusLine) throws ParseException { statusLine+="\n"; return new StatusLineParser(statusLine).parse(); }
Parse the SIP Response message status line
public void initQuitAction(QuitAction quitAction){ if (quitAction == null) throw new IllegalArgumentException("quitAction is null"); if (this.quitAction != null) throw new IllegalArgumentException("The method is once-call."); this.quitAction=quitAction; }
Set the action to call from quit().
public static boolean isFileStoragePool(StoragePool storagePool,DbClient dbClient){ URI storageSystemUri=storagePool.getStorageDevice(); StorageSystem storageSystem=dbClient.queryObject(StorageSystem.class,storageSystemUri); ArgValidator.checkEntity(storageSystem,storageSystemUri,false); StorageSystem.Type storageSystemType=StorageSystem.Type.valueOf(storageSystem.getSystemType()); return (storageSystemType.equals(StorageSystem.Type.isilon) || storageSystemType.equals(StorageSystem.Type.vnxfile)); }
Finds if a pool is file storage pool
public static Object invokeStatic(String clazz,String methodName,Class[] types,Object[] values,Object defaultValue){ try { return invokeStatic(Class.forName(clazz),methodName,types,values); } catch ( ClassNotFoundException e) { return defaultValue; } catch ( NoSuchMethodException e) { return defaultValue; } }
Invokes the specified parameterless method if it exists.
String internalsprintf(double s) throws IllegalArgumentException { String s2=""; switch (conversionCharacter) { case 'f': s2=printFFormat(s); break; case 'E': case 'e': s2=printEFormat(s); break; case 'G': case 'g': s2=printGFormat(s); break; default : throw new IllegalArgumentException("Cannot " + "format a double with a format using a " + conversionCharacter + " conversion character."); } return s2; }
Format a double argument using this conversion specification.
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){ switch (featureID) { case N4mfPackage.MODULE_FILTER__MODULE_SPECIFIERS: return ((InternalEList<?>)getModuleSpecifiers()).basicRemove(otherEnd,msgs); } return super.eInverseRemove(otherEnd,featureID,msgs); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public boolean hasUiObjectExpression(){ return !StringUtils.isEmpty(getUiObjectExpression); }
If this databinding reference an ui element that is not the widget bound to this binding, then an expression is used to retrieve the target ui element
public void restore(){ try { if (inCurrentStorage) currentStorage.insertElementSafe(element); else currentStorage.removeElement(element); if (inApiStorage) apiStorage.insertElementSafe(element); else apiStorage.removeElement(element); } catch ( StorageException e) { e.printStackTrace(); } element.osmId=osmId; element.osmVersion=osmVersion; element.state=state; element.setTags(tags); if (parentRelations != null) { element.parentRelations=new ArrayList<Relation>(); element.parentRelations.addAll(parentRelations); } else { element.parentRelations=null; } }
Restores the saved state of the element
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:00.382 -0500",hash_original_method="A7CC818E7F384DAEC54D76069E9C5019",hash_generated_method="E8FCEBA0D995DB6EE22CA1B5390C8697") protected int available() throws IOException { return getInputStream().available(); }
Returns the number of bytes available for reading without blocking.
public boolean isOverwriteMode(){ return hexEditControl == null || hexEditControl.isOverwriteMode(); }
Tells whether the input is in overwrite or insert mode
public String[] loadStrings(String filename){ InputStream is=createInput(filename); if (is != null) return loadStrings(is); System.err.println("The file \"" + filename + "\" "+ "is missing or inaccessible, make sure "+ "the URL is valid or that the file has been "+ "added to your sketch and is readable."); return null; }
Load data from a file and shove it into a String array. <p/> Exceptions are handled internally, when an error, occurs, an exception is printed to the console and 'null' is returned, but the program continues running. This is a tradeoff between 1) showing the user that there was a problem but 2) not requiring that all i/o code is contained in try/catch blocks, for the sake of new users (or people who are just trying to get things done in a "scripting" fashion. If you want to handle exceptions, use Java methods for I/O.
private Iterable<Field> fieldsWithAnnotation(Class<?> cls){ synchronized (mux) { List<Field> fields=fieldCache.get(cls); if (fields == null) { fields=new ArrayList<>(); for ( Field field : cls.getDeclaredFields()) { Annotation ann=field.getAnnotation(annCls); if (ann != null || needsRecursion(field)) fields.add(field); } if (!fields.isEmpty()) fieldCache.put(cls,fields); } return fields; } }
Gets all entries from the specified class or its super-classes that have been annotated with annotation provided.
public Resource mapRelations(Resource object,JSONObject jsonObject,List<Resource> included) throws Exception { HashMap<String,String> relationshipNames=getRelationshipNames(object.getClass()); for ( String relationship : relationshipNames.keySet()) { JSONObject relationJsonObject=null; try { relationJsonObject=jsonObject.getJSONObject(relationship); } catch ( JSONException e) { Logger.debug("Relationship named " + relationship + "not found in JSON"); continue; } JSONObject relationDataObject=null; try { relationDataObject=relationJsonObject.getJSONObject("data"); Resource relationObject=Factory.newObjectFromJSONObject(relationDataObject,null); relationObject=matchIncludedToRelation(relationObject,included); mDeserializer.setField(object,relationshipNames.get(relationship),relationObject); } catch ( JSONException e) { Logger.debug("JSON relationship does not contain data"); } JSONArray relationDataArray=null; try { relationDataArray=relationJsonObject.getJSONArray("data"); List<Resource> relationArray=Factory.newObjectFromJSONArray(relationDataArray,null); relationArray=matchIncludedToRelation(relationArray,included); mDeserializer.setField(object,relationshipNames.get(relationship),relationArray); } catch ( JSONException e) { Logger.debug("JSON relationship does not contain data"); } } return object; }
Loops through relation JSON array and maps annotated objects.
@Override public void onDestroyView(){ mIsWebViewAvailable=false; super.onDestroyView(); }
Called when the WebView has been detached from the fragment. The WebView is no longer available after this time.
public void clearMovementData(){ pathSprites=new ArrayList<StepSprite>(); movementTarget=null; checkFoVHexImageCacheClear(); repaint(); refreshMoveVectors(); }
Clears current movement data from the screen
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception { EditRoomDeptForm editRoomDeptForm=(EditRoomDeptForm)form; MessageResources rsc=getResources(request); String doit=editRoomDeptForm.getDoit(); if (doit != null) { if (doit.equals(rsc.getMessage("button.update"))) { ActionMessages errors=new ActionMessages(); errors=editRoomDeptForm.validate(mapping,request); if (errors.size() == 0) { doUpdate(editRoomDeptForm,request); return mapping.findForward("showRoomDetail"); } else { saveErrors(request,errors); } } if (doit.equals(rsc.getMessage("button.returnToRoomDetail"))) { response.sendRedirect("roomDetail.do?id=" + editRoomDeptForm.getId()); return null; } if (doit.equals(rsc.getMessage("button.addRoomDept"))) { if (editRoomDeptForm.getDept() == null || editRoomDeptForm.getDept().length() == 0) { ActionMessages errors=new ActionMessages(); errors.add("roomDept",new ActionMessage("errors.required","Department")); saveErrors(request,errors); } else if (editRoomDeptForm.getDepartmentIds().contains(new Long(editRoomDeptForm.getDept()))) { ActionMessages errors=new ActionMessages(); errors.add("roomDept",new ActionMessage("errors.alreadyPresent","Department")); saveErrors(request,errors); } else { editRoomDeptForm.addDepartment(editRoomDeptForm.getDept()); } } if (doit.equals(rsc.getMessage("button.removeRoomDept"))) { if (editRoomDeptForm.getDept() == null || editRoomDeptForm.getDept().length() == 0) { ActionMessages errors=new ActionMessages(); errors.add("roomDept",new ActionMessage("errors.required","Department")); saveErrors(request,errors); } else if (!editRoomDeptForm.getDepartmentIds().contains(new Long(editRoomDeptForm.getDept()))) { ActionMessages errors=new ActionMessages(); errors.add("roomDept",new ActionMessage("errors.notPresent","Department")); saveErrors(request,errors); } else { editRoomDeptForm.removeDepartment(editRoomDeptForm.getDept()); } } } Long id=Long.valueOf(request.getParameter("id")); LocationDAO ldao=new LocationDAO(); Location location=ldao.get(id); sessionContext.checkPermission(location,Right.RoomEditAvailability); if (doit != null && doit.equals(rsc.getMessage("button.modifyRoomDepts"))) { TreeSet roomDepts=new TreeSet(location.getRoomDepts()); for (Iterator i=roomDepts.iterator(); i.hasNext(); ) { RoomDept roomDept=(RoomDept)i.next(); editRoomDeptForm.addDepartment(roomDept.getDepartment().getUniqueId().toString()); } } boolean timeVertical=CommonValues.VerticalGrid.eq(UserProperty.GridOrientation.get(sessionContext.getUser())); RequiredTimeTable rtt=location.getRoomSharingTable(sessionContext.getUser(),editRoomDeptForm.getDepartmentIds()); rtt.getModel().setDefaultSelection(UserProperty.GridSize.get(sessionContext.getUser())); if (doit != null && (doit.equals(rsc.getMessage("button.removeRoomDept")) || doit.equals(rsc.getMessage("button.addRoomDept")))) { rtt.update(request); } editRoomDeptForm.setSharingTable(rtt.print(true,timeVertical)); if (location instanceof Room) { Room r=(Room)location; editRoomDeptForm.setName(r.getLabel()); editRoomDeptForm.setNonUniv(false); } else if (location instanceof NonUniversityLocation) { NonUniversityLocation nonUnivLocation=(NonUniversityLocation)location; editRoomDeptForm.setName(nonUnivLocation.getName()); editRoomDeptForm.setNonUniv(true); } else { ActionMessages errors=new ActionMessages(); errors.add("editRoomDept",new ActionMessage("errors.lookup.notFound","Room Department")); saveErrors(request,errors); } setupDepartments(editRoomDeptForm,request,location); return mapping.findForward("showEditRoomDept"); }
Method execute
@Override public void execute(MetricTimeSeries timeSeries,FunctionValueMap functionValueMap){ if (timeSeries.isEmpty()) { functionValueMap.add(this,false,null); return; } DoubleList points=timeSeries.getValues(); double q1=Percentile.evaluate(points,.25); double q3=Percentile.evaluate(points,.75); double threshold=(q3 - q1) * 1.5 + q3; for (int i=0; i < points.size(); i++) { double point=points.get(i); if (point > threshold) { functionValueMap.add(this,true,null); return; } } functionValueMap.add(this,false,null); }
Detects outliers using the default box plot implementation. An outlier every value that is above (q3-q1)*1.5*q3 where qN is the nth percentile
public DuplicatePrimaryPartitionException(String message){ super(message); }
Creates a new <code>DuplicatePrimaryPartitionException</code> with the given detail message.
public void buildFieldTypes(TableDefinition tableDef){ ((JPAMTableDefinition)tableDef).buildFieldTypes(getSession()); }
INTERNAL: builds the field names based on the type read in from the builder
public static void clearCache(){ softCache=new SoftReference<String[]>(null); }
Clear the cache. This method is used for testing.
public void clear(){ oredCriteria.clear(); orderByClause=null; distinct=false; }
This method was generated by MyBatis Generator. This method corresponds to the database table activity
protected void remove(int id){ nodes.remove(id); }
Removes the node with the specified identifier from this problem instance.
public void addHaptic(int id){ mHapticFeedback.add(id); }
Adds haptic feedback to this utterance.
private void init(){ Grid grid=new Grid(); appendChild(grid); grid.setWidth("100%"); grid.setStyle("margin:0; padding:0; position: absolute;"); grid.makeNoStrip(); grid.setOddRowSclass("even"); Rows rows=new Rows(); grid.appendChild(rows); for (int i=0; i < m_goals.length; i++) { Row row=new Row(); rows.appendChild(row); row.setWidth("100%"); WPerformanceIndicator pi=new WPerformanceIndicator(m_goals[i]); row.appendChild(pi); pi.addEventListener(Events.ON_CLICK,this); } }
Static/Dynamic Init
public int deleteBack(){ int oldBack=getBack(); size=size - 1; return oldBack; }
Deletes item from back of the list and returns deleted item.
public boolean isLicensed(){ return resourceExists(thresholdFileResource) && resourceExists(overlappingFileResource); }
This method returns true if the threshold and overlap files are present.
protected SimplePhase(String name){ super(name); }
Construct a phase given just a name and a global/local ordering scheme.
private void URIUtil(){ }
Prevent instance creation.
public synchronized void processResponse(SIPResponse transactionResponse,MessageChannel sourceChannel,SIPDialog dialog){ if (getState() == null) return; if ((TransactionState.COMPLETED == this.getState() || TransactionState.TERMINATED == this.getState()) && transactionResponse.getStatusCode() / 100 == 1) { return; } if (sipStack.isLoggingEnabled()) { sipStack.getStackLogger().logDebug("processing " + transactionResponse.getFirstLine() + "current state = "+ getState()); sipStack.getStackLogger().logDebug("dialog = " + dialog); } this.lastResponse=transactionResponse; try { if (isInviteTransaction()) inviteClientTransaction(transactionResponse,sourceChannel,dialog); else nonInviteClientTransaction(transactionResponse,sourceChannel,dialog); } catch ( IOException ex) { if (sipStack.isLoggingEnabled()) sipStack.getStackLogger().logException(ex); this.setState(TransactionState.TERMINATED); raiseErrorEvent(SIPTransactionErrorEvent.TRANSPORT_ERROR); } }
Process a new response message through this transaction. If necessary, this message will also be passed onto the TU.
public void disable(BluetoothAdapter adapter){ int mask=(BluetoothReceiver.STATE_TURNING_OFF_FLAG | BluetoothReceiver.STATE_OFF_FLAG | BluetoothReceiver.SCAN_MODE_NONE_FLAG); long start=-1; BluetoothReceiver receiver=getBluetoothReceiver(mask); int state=adapter.getState(); switch (state) { case BluetoothAdapter.STATE_OFF: assertFalse(adapter.isEnabled()); removeReceiver(receiver); return; case BluetoothAdapter.STATE_TURNING_ON: assertFalse(adapter.isEnabled()); start=System.currentTimeMillis(); break; case BluetoothAdapter.STATE_ON: assertTrue(adapter.isEnabled()); start=System.currentTimeMillis(); assertTrue(adapter.disable()); break; case BluetoothAdapter.STATE_TURNING_OFF: assertFalse(adapter.isEnabled()); mask=0; break; default : removeReceiver(receiver); fail(String.format("disable() invalid state: state=%d",state)); } long s=System.currentTimeMillis(); while (System.currentTimeMillis() - s < ENABLE_DISABLE_TIMEOUT) { state=adapter.getState(); if (state == BluetoothAdapter.STATE_OFF && (receiver.getFiredFlags() & mask) == mask) { assertFalse(adapter.isEnabled()); long finish=receiver.getCompletedTime(); if (start != -1 && finish != -1) { writeOutput(String.format("disable() completed in %d ms",(finish - start))); } else { writeOutput("disable() completed"); } removeReceiver(receiver); return; } sleep(POLL_TIME); } int firedFlags=receiver.getFiredFlags(); removeReceiver(receiver); fail(String.format("disable() timeout: state=%d (expected %d), flags=0x%x (expected 0x%x)",state,BluetoothAdapter.STATE_OFF,firedFlags,mask)); }
Disables Bluetooth and checks to make sure that Bluetooth was turned off and that the correct actions were broadcast.
public boolean isLocal(){ return local; }
Indicates if the ejb referenced is a local ejb.
public PowerDecay(){ this(10,0.5); }
Creates a new Power Decay rate
public Boolean isStorageIORMSupported(){ return storageIORMSupported; }
Gets the value of the storageIORMSupported property.
public final byte[] array(){ return array; }
Returns the underlying byte array.
public void buildClassifier(Instances D) throws Exception { Random r=new Random(m_seed); if (fastaram) { networks=new ARAMNetworkfast[numberofnetworks]; } else if (sparsearam) { networks=new ARAMNetworkSparse[numberofnetworks]; } else if (sparsearamH) { networks=new ARAMNetworkSparseV[numberofnetworks]; } else if (sparsearamHT) { networks=new ARAMNetworkSparseHT[numberofnetworks]; } else { networks=new ARAMNetwork[numberofnetworks]; } numClasses=D.classIndex(); if (tfastaram) { BuildClassifier[] bc=new BuildClassifier[numberofnetworks]; for (int i=0; i < numberofnetworks; i++) { List<Integer> list=new ArrayList<Integer>(); for (int j=0; j < D.numInstances(); j++) { list.add(j); } java.util.Collections.shuffle(list,r); if (fastaram) { networks[i]=new ARAMNetworkfast(); } else if (sparsearam) { networks[i]=new ARAMNetworkSparse(); } else if (sparsearamH) { networks[i]=new ARAMNetworkSparseV(); } else if (sparsearamHT) { networks[i]=new ARAMNetworkSparseHT(); } else { networks[i]=new ARAMNetwork(); } networks[i].order=list; networks[i].roa=roa; bc[i]=new BuildClassifier(networks[i]); bc[i].setinstances(D); bc[i].start(); } for (int i=0; i < numberofnetworks; i++) { bc[i].join(); networks[i]=bc[i].m_network; networks[i].learningphase=false; } } else { for (int i=0; i < numberofnetworks; i++) { if (fastaram) { networks[i]=new ARAMNetworkfast(); } else if (sparsearam) { networks[i]=new ARAMNetworkSparse(); } else if (sparsearamH) { networks[i]=new ARAMNetworkSparseV(); } else if (sparsearamHT) { networks[i]=new ARAMNetworkSparseHT(); } else { networks[i]=new ARAMNetwork(); } networks[i].roa=roa; networks[i].buildClassifier(D); networks[i].learningphase=false; D.randomize(r); } } dc=new DistributionCalc[numberofnetworks]; }
Generates the classifier.
private void startCameraSource(){ int code=GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext()); if (code != ConnectionResult.SUCCESS) { Dialog dlg=GoogleApiAvailability.getInstance().getErrorDialog(this,code,RC_HANDLE_GMS); dlg.show(); } if (mCameraSource != null) { try { mPreview.start(mCameraSource,mGraphicOverlay); } catch ( IOException e) { Log.e(TAG,"Unable to start camera source.",e); mCameraSource.release(); mCameraSource=null; } } }
Starts or restarts the camera source, if it exists. If the camera source doesn't exist yet (e.g., because onResume was called before the camera source was created), this will be called again when the camera source is created.
public Timezone(String text){ this(null,text); }
Creates a timezone property.
public static <K,V>V putAt(Map<K,V> self,K key,V value){ self.put(key,value); return value; }
A helper method to allow maps to work with subscript operators
@Override public String toString(){ return toString(","); }
Form a string listing all elements with comma as the separator character.
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.857 -0400",hash_original_method="8DBE36D3CC23C0C9E5FAAD9804EB9F8E",hash_generated_method="B8E268DF01A1D59287B8F2ED5303EAE7") private void processInput(boolean endOfInput) throws IOException { decoderIn.flip(); CoderResult coderResult; while (true) { coderResult=decoder.decode(decoderIn,decoderOut,endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { throw new IOException("Unexpected coder result"); } } decoderIn.compact(); }
Decode the contents of the input ByteBuffer into a CharBuffer.
public static float byte52ToFloat(byte b){ if (b == 0) return 0.0f; int bits=(b & 0xff) << (24 - 5); bits+=(63 - 2) << 24; return Float.intBitsToFloat(bits); }
byteToFloat(b, mantissaBits=5, zeroExponent=2)
private void createAndRegisterObserverProxyLocked(IContentObserver observer){ if (mObserver != null) { throw new IllegalStateException("an observer is already registered"); } mObserver=new ContentObserverProxy(observer,this); mCursor.registerContentObserver(mObserver); }
Create a ContentObserver from the observer and register it as an observer on the underlying cursor.
public int compressEstim(byte[] src,int srcOff,final int srcLen){ if (srcLen < 10) return srcLen; int stride=LZ4_64K_LIMIT - 1; int segments=(srcLen + stride - 1) / stride; stride=srcLen / segments; if (stride >= LZ4_64K_LIMIT - 1 || stride * segments > srcLen || segments < 1 || stride < 1) throw new RuntimeException("?? " + srcLen); int bytesIn=0; int bytesOut=0; int len=srcLen; while (len > 0) { if (len > stride) len=stride; bytesOut+=compress64k(src,srcOff,len); srcOff+=len; bytesIn+=len; len=srcLen - bytesIn; } double ratio=bytesOut / (double)bytesIn; return bytesIn == srcLen ? bytesOut : (int)(ratio * srcLen + 0.5); }
Estimates the length of the compressed bytes, as compressed by Lz4 WARNING: if larger than LZ4_64K_LIMIT it cuts it in fragments WARNING: if some part of the input is discarded, this should return the proportional (so that returnValue/srcLen=compressionRatio)
@Override public boolean eIsSet(int featureID){ switch (featureID) { case N4JSPackage.ARRAY_LITERAL__ELEMENTS: return elements != null && !elements.isEmpty(); case N4JSPackage.ARRAY_LITERAL__TRAILING_COMMA: return trailingComma != TRAILING_COMMA_EDEFAULT; } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public FilterStreamSpecRaw(){ }
Default ctor.
void onMenuVisibilityChanged(boolean isVisible){ for (int i=0; i < mObservers.size(); ++i) { mObservers.get(i).onMenuVisibilityChanged(isVisible); } }
Called by AppMenu to report that the App Menu visibility has changed.
public void updateDownload(){ ArrayList<DownloadInfoRunnable> ongoingDownloads=getOngoingDownloads(); if (!ongoingDownloads.isEmpty()) { updateProgress(); } else { timer.cancel(); timer.purge(); stopSelf(); mBuilder=null; stopForeground(true); isStopped=true; } }
Updates the download list and stops the service if it's empty. If not, updates the progress in the Notification bar
private int remoteAddPois(List<Poi> pois,String changeSetId){ int count=0; for ( Poi poi : pois) { if (remoteAddPoi(poi,changeSetId)) { count++; } } return count; }
Add a List of POIs to the backend.
public CopyOnWriteArraySet(Collection<? extends E> c){ al=new CopyOnWriteArrayList<E>(); al.addAllAbsent(c); }
Creates a set containing all of the elements of the specified collection.
@Override public void close() throws SQLException { try { super.close(); } finally { this.outputLogger.close(); } }
This method will close the connection to the output.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:41.688 -0500",hash_original_method="1623111994CBCA0890DA0FF2A1E140E0",hash_generated_method="478ACA79A313929F4EF55B9242DEEF4D") public boolean isBackToBackUserAgent(){ return super.isBackToBackUserAgent; }
Get the "back to back User Agent" flag. return the value of the flag
public EnglishMinimalStemFilterFactory(Map<String,String> args){ super(args); if (!args.isEmpty()) { throw new IllegalArgumentException("Unknown parameters: " + args); } }
Creates a new EnglishMinimalStemFilterFactory
public AABB(ReadonlyVec3D pos,float extent){ super(pos); setExtent(new Vec3D(extent,extent,extent)); }
Creates a new instance from centre point and uniform extent in all directions.
public static <T>JavaslangSubscriber<T> subscriber(){ return new JavaslangSubscriber<T>(); }
A reactive-streams subscriber than can generate Javaslang traversable types
public SQLNonTransientException(String reason,Throwable cause){ super(reason,cause); }
Creates an SQLNonTransientException object. The Reason string is set to the given and the cause Throwable object is set to the given cause Throwable object.
public void localTransactionCommitted(ConnectionEvent event){ }
Ignored event callback
protected boolean runAndReset(){ if (state != NEW || !UNSAFE.compareAndSwapObject(this,runnerOffset,null,Thread.currentThread())) return false; boolean ran=false; int s=state; try { Callable<V> c=callable; if (c != null && s == NEW) { try { c.call(); ran=true; } catch ( Throwable ex) { setException(ex); } } } finally { runner=null; s=state; if (s >= INTERRUPTING) handlePossibleCancellationInterrupt(s); } return ran && s == NEW; }
Executes the computation without setting its result, and then resets this future to initial state, failing to do so if the computation encounters an exception or is cancelled. This is designed for use with tasks that intrinsically execute more than once.
public void addCookie(GoogleCookie cookie){ if (cookieManager != null) { cookieManager.addCookie(cookie); } }
Adds a new GoogleCookie instance to the cache.
public void debug(String trace){ printTrace(trace,DEBUG_LEVEL); }
Debug trace
public boolean isAutoIndentEnabled(){ return autoIndentEnabled; }
Returns whether or not auto-indent is enabled.
public void disableHardwareLayersForContent(){ View widget=getContent(); if (widget != null) { widget.setLayerType(LAYER_TYPE_NONE,null); } }
Because this view has fading outlines, it is essential that we enable hardware layers on the content (child) so that updating the alpha of the outlines doesn't result in the content layer being recreated.
public PaymentGatewayDescriptorImpl(final String description,final String label,final String url){ super(description,label); this.url=url; }
Construct payment gateway descriptor.
public static Date parseDateLong(String dateString,String pattern) throws ParseException { return getSimplDateFormat(pattern).parse(dateString); }
Returns date parsed from string by given pattern
public void add(int i,Coordinate coord,boolean allowRepeated){ if (!allowRepeated) { int size=size(); if (size > 0) { if (i > 0) { Coordinate prev=(Coordinate)get(i - 1); if (prev.equals2D(coord)) return; } if (i < size) { Coordinate next=(Coordinate)get(i); if (next.equals2D(coord)) return; } } } super.add(i,coord); }
Inserts the specified coordinate at the specified position in this list.
private void loadAppThemeDefaults(){ TypedValue typedValue=new TypedValue(); TypedArray a=getContext().obtainStyledAttributes(typedValue.data,new int[]{R.attr.colorAccent,android.R.attr.textColorPrimary,R.attr.colorControlNormal}); dialColor=a.getColor(0,dialColor); textColor=a.getColor(1,textColor); clockColor=a.getColor(2,clockColor); a.recycle(); }
Sets default theme attributes for picker These will be used if picker's attributes are'nt set
public void increaseRefcount(){ refcount++; }
Increase number of data points by one.
public static double computePolygonAreaFromVertices(Iterable<? extends Vec4> points){ if (points == null) { String message=Logging.getMessage("nullValue.IterableIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } java.util.Iterator<? extends Vec4> iter=points.iterator(); if (!iter.hasNext()) { return 0; } double area=0; Vec4 firstPoint=iter.next(); Vec4 point=firstPoint; while (iter.hasNext()) { Vec4 nextLocation=iter.next(); area+=point.x * nextLocation.y; area-=nextLocation.x * point.y; point=nextLocation; } if (!point.equals(firstPoint)) { area+=point.x * firstPoint.y; area-=firstPoint.x * point.y; } area/=2.0; return area; }
Returns the area enclosed by the specified (x, y) points (the z and w coordinates are ignored). If the specified points do not define a closed loop, then the loop is automatically closed by simulating appending the first point to the last point.
public void init(KeyGenerationParameters param){ this.params=(NTRUEncryptionKeyGenerationParameters)param; }
Constructs a new instance with a set of encryption parameters.
public static JPanel createDemoPanel(){ JFreeChart chart=createChart(createDataset()); ChartPanel panel=new ChartPanel(chart,false); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); return panel; }
Creates a panel for the demo (used by SuperDemo.java).
public static void deleteVMsOnThisEndpoint(VerificationHost host,boolean isMock,String parentComputeLink,List<String> instanceIdsToDelete) throws Throwable { deleteVMsOnThisEndpoint(host,null,isMock,parentComputeLink,instanceIdsToDelete,null); }
A utility method that deletes the VMs on the specified endpoint filtered by the instanceIds that are passed in.
public boolean isIn(byte i){ return (i >= this.min) && (i <= this.max); }
Check if given number is in range.
public void completeAll(){ long currentCompleted=completedCount; int size=Math.max(1,actionList.size()); while (completedCount - currentCompleted < size) { if (getState() != Thread.State.BLOCKED && getState() != Thread.State.RUNNABLE) break; try { Thread.sleep(50); } catch ( InterruptedException ex) { break; } } }
<p>Complete all scheduled actions at the time of this call. Since other threads may keep adding actions, this method makes sure that only the actions in the queue at the time of the call are waited upon. </p>
public String toString(){ return image; }
Returns the image.
public KtVisualPanel1(){ initComponents(); }
Creates new form KtVisualPanel1
public URI(String p_scheme,String p_schemeSpecificPart) throws MalformedURIException { if (p_scheme == null || p_scheme.trim().length() == 0) { throw new MalformedURIException("Cannot construct URI with null/empty scheme!"); } if (p_schemeSpecificPart == null || p_schemeSpecificPart.trim().length() == 0) { throw new MalformedURIException("Cannot construct URI with null/empty scheme-specific part!"); } setScheme(p_scheme); setPath(p_schemeSpecificPart); }
Construct a new URI that does not follow the generic URI syntax. Only the scheme and scheme-specific part (stored as the path) are initialized.
public boolean isDoingRangedAttack(){ return isDoingRangedAttack; }
Check if the currently performed attack is ranged.
public SdfReaderWrapper(File sdfDir,boolean useMem,boolean checkConsistency) throws IOException { mIsPaired=ReaderUtils.isPairedEndDirectory(sdfDir); if (mIsPaired) { mSingle=null; mLeft=createSequencesReader(ReaderUtils.getLeftEnd(sdfDir),useMem); mRight=createSequencesReader(ReaderUtils.getRightEnd(sdfDir),useMem); if (checkConsistency) { if (mLeft.numberSequences() != mRight.numberSequences() || !mLeft.type().equals(mRight.type()) || mLeft.hasQualityData() != mRight.hasQualityData() || mLeft.hasNames() != mRight.hasNames()) { throw new NoTalkbackSlimException(ErrorType.INFO_ERROR,"Paired end SDF has inconsistencies between arms."); } } } else { mLeft=null; mRight=null; mSingle=createSequencesReader(sdfDir,useMem); } }
Wrapper for the readers.
public DefaultRenderStack(){ stack=new ArrayDeque<>(); }
Constructs the stack.
public void onLocationChanged(Location location){ if (location == null) { return; } float distance=getDistanceFromNetwork(location); mTrackerData.writeEntry(location,distance); }
Writes details of location update to tracking file, including recording the distance between this location update and the last network location update
public static File secondaryIndexFileName(File data){ final int extensionIndex=data.getName().lastIndexOf('.'); if (extensionIndex != -1) { return new File(data.getParentFile(),data.getName().substring(0,extensionIndex) + BamIndexer.BAM_INDEX_EXTENSION); } return indexFileName(data); }
Get the secondary possible name for an index to have for a given data file (Will return same as indexFileName if there is no file extension)
private void cancelOrder(Contract contract,TradeOrder order) throws IOException { OrderState orderState=new OrderState(); orderState.m_status=OrderStatus.CANCELLED; this.brokerModel.openOrder(order.getOrderKey(),contract,order,orderState); order.setStatus(OrderStatus.CANCELLED); }
Method cancelOrder.
private TempTripleStore(final TemporaryStore store,final Properties properties){ this(store,UUID.randomUUID() + "kb",ITx.UNISOLATED,properties); }
Note: This is here just to make it easy to have the reference to the [store] and its [uuid] when we create one in the calling ctor.