code
stringlengths
10
174k
nl
stringlengths
3
129k
static String cleanString(String s){ return s.replaceAll("[^a-zA-Z ]","").toLowerCase(); }
Helper to process strings into their "cleaned" form, ignoring punctuation and capitalization.
public UploadExample(UploadObject sample){ oredCriteria=new ArrayList<Criteria>(); Criteria criteria=this.or(); if (sample.getProjectId() != null) { criteria.andProjectIdEqualTo(sample.getProjectId()); } if (sample.getContent() != null) { criteria.andContentEqualTo(sample.getContent()); } if (sample.getCreatorId() != null) { criteria.andCreatorIdEqualTo(sample.getCreatorId()); } if (sample.getDeleted() != null) { criteria.andDeletedEqualTo(sample.getDeleted()); } if (sample.getCreated() != null) { criteria.andCreatedEqualTo(sample.getCreated()); } if (sample.getUpdated() != null) { criteria.andUpdatedEqualTo(sample.getUpdated()); } if (sample.getCreatorName() != null) { criteria.andCreatorNameEqualTo(sample.getCreatorName()); } if (sample.getCompanyId() != null) { criteria.andCompanyIdEqualTo(sample.getCompanyId()); } if (sample.getCreatorAvatar() != null) { criteria.andCreatorAvatarEqualTo(sample.getCreatorAvatar()); } }
This method was generated by MyBatis Generator. This method corresponds to the database table upload
public void requestThrottleSetup(LocoAddress address,boolean control){ DCCppThrottle throttle; if (log.isDebugEnabled()) { log.debug("Requesting Throttle: " + address); } if (throttles.containsKey(address)) { notifyThrottleKnown(throttles.get(address),address); } else { if (tc.getCommandStation().requestNewRegister(address.getNumber()) == DCCppConstants.NO_REGISTER_FREE) { log.error("No Register available for Throttle. Address = {}",address); return; } throttle=new DCCppThrottle((DCCppSystemConnectionMemo)adapterMemo,address,tc); throttles.put(address,throttle); notifyThrottleKnown(throttle,address); } }
Request a new throttle object be created for the address, and let the throttle listeners know about it.
static void recordStartedBy(String packageName,Intent intent){ if (intent == null) { recordStartedBy(DocumentMetricIds.STARTED_BY_UNKNOWN); return; } int intentSource=DocumentMetricIds.STARTED_BY_UNKNOWN; IntentHandler.ExternalAppId appId=IntentHandler.determineExternalIntentSource(packageName,intent); if (intent.hasExtra(IntentHandler.EXTRA_STARTED_BY)) { intentSource=IntentUtils.safeGetIntExtra(intent,IntentHandler.EXTRA_STARTED_BY,DocumentMetricIds.STARTED_BY_UNKNOWN); } else if (IntentUtils.safeGetBooleanExtra(intent,ShortcutHelper.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB,false)) { intentSource=DocumentMetricIds.STARTED_BY_LAUNCHER; } else if (IntentUtils.safeGetBooleanExtra(intent,IntentHandler.EXTRA_APPEND_TASK,false)) { intentSource=DocumentMetricIds.STARTED_BY_SEARCH_RESULT_PAGE; } else if (IntentUtils.safeGetBooleanExtra(intent,IntentHandler.EXTRA_PRESERVE_TASK,false)) { intentSource=DocumentMetricIds.STARTED_BY_SEARCH_SUGGESTION_EXTERNAL; } else if (appId == IntentHandler.ExternalAppId.GMAIL) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_GMAIL; } else if (appId == IntentHandler.ExternalAppId.FACEBOOK) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_FACEBOOK; } else if (appId == IntentHandler.ExternalAppId.PLUS) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_PLUS; } else if (appId == IntentHandler.ExternalAppId.TWITTER) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_TWITTER; } else if (appId == IntentHandler.ExternalAppId.CHROME) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_CHROME; } else if (appId == IntentHandler.ExternalAppId.HANGOUTS) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_HANGOUTS; } else if (appId == IntentHandler.ExternalAppId.MESSENGER) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_MESSENGER; } else if (appId == IntentHandler.ExternalAppId.NEWS) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_NEWS; } else if (appId == IntentHandler.ExternalAppId.LINE) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_LINE; } else if (appId == IntentHandler.ExternalAppId.WHATSAPP) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_WHATSAPP; } else if (appId == IntentHandler.ExternalAppId.GSA) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_GSA; } else if (appId == IntentHandler.ExternalAppId.OTHER) { intentSource=DocumentMetricIds.STARTED_BY_EXTERNAL_APP_OTHER; } if (intentSource == DocumentMetricIds.STARTED_BY_UNKNOWN) { android.util.Log.d("DocumentUma","Unknown source detected"); } if (intentSource >= DocumentMetricIds.STARTED_BY_EXTERNAL_APP_GMAIL && intentSource < DocumentMetricIds.STARTED_BY_CONTEXTUAL_SEARCH) { RecordHistogram.recordEnumeratedHistogram("MobileIntent.PageLoadDueToExternalApp",appId.ordinal(),IntentHandler.ExternalAppId.INDEX_BOUNDARY.ordinal()); } recordStartedBy(intentSource); }
Records UMA about the Intent fired to create a DocumentActivity.
static List<GeoPoint> filterPoints(final List<? extends GeoPoint> input){ final List<GeoPoint> noIdenticalPoints=new ArrayList<>(input.size()); int startIndex=-1; final GeoPoint comparePoint=input.get(0); for (int i=0; i < input.size() - 1; i++) { final GeoPoint thePoint=input.get(getLegalIndex(-i - 1,input.size())); if (!thePoint.isNumericallyIdentical(comparePoint)) { startIndex=getLegalIndex(-i,input.size()); break; } } if (startIndex == -1) { return null; } int currentIndex=startIndex; while (true) { final GeoPoint currentPoint=input.get(currentIndex); noIdenticalPoints.add(currentPoint); while (true) { currentIndex=getLegalIndex(currentIndex + 1,input.size()); if (currentIndex == startIndex) { break; } final GeoPoint nextNonIdenticalPoint=input.get(currentIndex); if (!nextNonIdenticalPoint.isNumericallyIdentical(currentPoint)) { break; } } if (currentIndex == startIndex) { break; } } if (noIdenticalPoints.size() < 3) { return null; } return noIdenticalPoints; }
Filter duplicate points.
protected void addNamePropertyDescriptor(Object object){ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),getResourceLocator(),getString("_UI_NamedElement_name_feature"),getString("_UI_PropertyDescriptor_description","_UI_NamedElement_name_feature","_UI_NamedElement_type"),BasePackage.Literals.NAMED_ELEMENT__NAME,true,false,false,ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,null,null)); }
This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- end-user-doc -->
@Override protected Instances process(Instances instances) throws Exception { Instances result; Instance instOld; Instance instNew; int i; int n; double[] values; int numAttNew; int numAttOld; if (!isFirstBatchDone()) { computeThresholds(instances); } result=getOutputFormat(); numAttOld=instances.numAttributes(); numAttNew=result.numAttributes(); for (n=0; n < instances.numInstances(); n++) { instOld=instances.instance(n); values=new double[numAttNew]; System.arraycopy(instOld.toDoubleArray(),0,values,0,numAttOld); instNew=new DenseInstance(1.0,values); instNew.setDataset(result); if (!getDetectionPerAttribute()) { if (isOutlier(instOld)) { instNew.setValue(m_OutlierAttributePosition[0],1); } if (isExtremeValue(instOld)) { instNew.setValue(m_OutlierAttributePosition[0] + 1,1); if (getExtremeValuesAsOutliers()) { instNew.setValue(m_OutlierAttributePosition[0],1); } } } else { for (i=0; i < m_AttributeIndices.length; i++) { if (m_AttributeIndices[i] == NON_NUMERIC) { continue; } if (isOutlier(instOld,m_AttributeIndices[i])) { instNew.setValue(m_OutlierAttributePosition[i],1); } if (isExtremeValue(instOld,m_AttributeIndices[i])) { instNew.setValue(m_OutlierAttributePosition[i] + 1,1); if (getExtremeValuesAsOutliers()) { instNew.setValue(m_OutlierAttributePosition[i],1); } } if (getOutputOffsetMultiplier()) { instNew.setValue(m_OutlierAttributePosition[i] + 2,calculateMultiplier(instOld,m_AttributeIndices[i])); } } } copyValues(instNew,false,instOld.dataset(),getOutputFormat()); result.add(instNew); } return result; }
Processes the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished(). This implementation only calls process(Instance) for each instance in the given dataset.
public static BinaryHeapInputStream create(byte[] data,int pos){ assert pos < data.length; BinaryHeapInputStream stream=new BinaryHeapInputStream(data); stream.pos=pos; return stream; }
Create stream with pointer set at the given position.
public SetSubtitle(int playerId,int subtitle,boolean enable){ super(); addParameterToRequest("playerid",playerId); addParameterToRequest("subtitle",subtitle); addParameterToRequest("enable",enable); }
Set the subtitle displayed by the player
private void addSymbolsDeclaredLater(HashSet<String> prevDeclared,NodeRepresentation nodeRepArg,boolean includeGoal){ NodeRepresentation assumpRepNode=nodeRepArg; while (assumpRepNode.parentNode != null) { assumpRepNode=assumpRepNode.parentNode; } int idx=0; while ((idx < this.assumeReps.size()) && (this.assumeReps.elementAt(idx) != assumpRepNode)) { idx++; } if (idx == this.assumeReps.size()) { return; } for (int i=idx + 1; i < assumeReps.size(); i++) { NodeRepresentation anode=assumeReps.elementAt(i); if (anode.nodeType == NodeRepresentation.NEW_NODE) { prevDeclared.add(anode.newId); } } if (includeGoal) { FormalParamNode[] goalIdents=ResourceHelper.getBoundIdentifiers((ExprNode)this.goalRep.semanticNode); for (int i=0; i < goalIdents.length; i++) { prevDeclared.add(goalIdents[i].getName().toString()); } } }
Adds to `prevDeclared' all top-level NEW symbols that occur after the position of NodeRepresentation `nodeRepArg' or its ancestor in assumpReps. And, if includeGoal = true, to all bound symbols in the goal. It can be called only when `nodeRepArg' is in this.assumeReps, is a descendant of a node in this.assumeReps, or is the goal.
public void paint(Graphics g,Shape allocation){ Rectangle a=(Rectangle)allocation; painter.paint(g,a.x,a.y,a.width,a.height,this); super.paint(g,a); }
Renders using the given rendering surface and area on that surface. This is implemented to delegate to the css box painter to paint the border and background prior to the interior.
private String validateInputs(){ String pomPath=pathEntry.getText(); if (Strings.isNullOrEmpty(pomPath)) { return "GraphML file cannot be empty"; } File pathFile=new File(pomPath); if (!pathFile.exists()) { return "GraphML file doesn't exist"; } return null; }
Determine if the page has been filled in correctly.
public static Map<String,String> mergeProps(Map<String,String> defaultProps,Map<String,String> overrideProps){ Map<String,String> mergedProps=new HashMap<String,String>(defaultProps); for ( Map.Entry<String,String> entry : overrideProps.entrySet()) { mergedProps.put(entry.getKey(),entry.getValue()); } return mergedProps; }
Merge properties
public Shape paintLayer(Graphics g,int offs0,int offs1,Shape bounds,JTextComponent c,View view){ Color color=getColor(); if (color == null) { g.setColor(c.getSelectionColor()); } else { g.setColor(color); } boolean firstIsDot=false; boolean secondIsDot=false; if (c.isEditable()) { int dot=c.getCaretPosition(); firstIsDot=(offs0 == dot); secondIsDot=(offs1 == dot); } if (offs0 == view.getStartOffset() && offs1 == view.getEndOffset()) { Rectangle alloc; if (bounds instanceof Rectangle) { alloc=(Rectangle)bounds; } else { alloc=bounds.getBounds(); } if (firstIsDot && alloc.width > 0) { g.fillRect(alloc.x + 1,alloc.y,alloc.width - 1,alloc.height); } else if (secondIsDot && alloc.width > 0) { g.fillRect(alloc.x,alloc.y,alloc.width - 1,alloc.height); } else { g.fillRect(alloc.x,alloc.y,alloc.width,alloc.height); } return alloc; } else { try { Shape shape=view.modelToView(offs0,Position.Bias.Forward,offs1,Position.Bias.Backward,bounds); Rectangle r=(shape instanceof Rectangle) ? (Rectangle)shape : shape.getBounds(); if (firstIsDot && r.width > 0) { g.fillRect(r.x + 1,r.y,r.width - 1,r.height); } else if (secondIsDot && r.width > 0) { g.fillRect(r.x,r.y,r.width - 1,r.height); } else { g.fillRect(r.x,r.y,r.width,r.height); } return r; } catch ( BadLocationException e) { } } return null; }
Paints a portion of a highlight.
public void loadLayoutBlocks(Element layoutblocks){ LayoutBlockManager tm=InstanceManager.getDefault(LayoutBlockManager.class); if (layoutblocks.getAttribute("blockrouting") != null) { if (layoutblocks.getAttribute("blockrouting").getValue().equals("yes")) { tm.enableAdvancedRouting(true); } } if (layoutblocks.getAttribute("routingStablisedSensor") != null) { try { tm.setStabilisedSensor(layoutblocks.getAttribute("routingStablisedSensor").getValue()); } catch ( jmri.JmriException e) { } } List<Element> layoutblockList=layoutblocks.getChildren("layoutblock"); if (log.isDebugEnabled()) { log.debug("Found " + layoutblockList.size() + " layoutblocks"); } for (int i=0; i < layoutblockList.size(); i++) { String sysName=getSystemName(layoutblockList.get(i)); if (sysName == null) { log.warn("unexpected null in systemName " + ((layoutblockList.get(i))) + " "+ ((layoutblockList.get(i))).getAttributes()); break; } String userName=getUserName(layoutblockList.get(i)); LayoutBlock b=tm.createNewLayoutBlock(sysName,userName); loadCommon(b,layoutblockList.get(i)); if (b != null) { Color color=ColorUtil.stringToColor(((layoutblockList.get(i))).getAttribute("trackcolor").getValue()); b.setBlockTrackColor(color); color=ColorUtil.stringToColor(((layoutblockList.get(i))).getAttribute("occupiedcolor").getValue()); b.setBlockOccupiedColor(color); Attribute a=((layoutblockList.get(i))).getAttribute("extracolor"); if (a != null) { b.setBlockExtraColor(ColorUtil.stringToColor(a.getValue())); } a=((layoutblockList.get(i))).getAttribute("occupancysensor"); if (a != null) { b.setOccupancySensorName(a.getValue()); } a=((layoutblockList.get(i))).getAttribute("memory"); if (a != null) { b.setMemoryName(a.getValue()); } a=((layoutblockList.get(i))).getAttribute("occupancysensorsense"); int sense=Sensor.ACTIVE; try { sense=((layoutblockList.get(i))).getAttribute("occupiedsense").getIntValue(); } catch ( org.jdom2.DataConversionException e) { log.error("failed to convert occupiedsense attribute"); } b.setOccupiedSense(sense); if (((layoutblockList.get(i))).getChild("metric") != null) { String stMetric=((layoutblockList.get(i))).getChild("metric").getText(); try { b.setBlockMetric(Integer.valueOf(stMetric)); } catch ( java.lang.NumberFormatException e) { log.error("failed to convert metric attribute for block " + b.getDisplayName()); } } } } }
Utility method to load the individual LayoutBlock objects. If there's no additional info needed for a specific layoutblock type, invoke this with the parent of the set of layoutblock elements.
public static String convertSourceCodeIntoUtf8(RecordingInputStream recis,String charset) throws IOException { ByteArrayOutputStream baos=null; try { if (!charset.equalsIgnoreCase(DEFAULT_CHARSET)) { Charset utf8charset=Charset.forName(DEFAULT_CHARSET); Charset incomingCharset=Charset.forName(charset); baos=new ByteArrayOutputStream(); recis.getReplayInputStream().readContentTo(baos); ByteBuffer inputBuffer=ByteBuffer.wrap(baos.toByteArray()); CharBuffer data=incomingCharset.decode(inputBuffer); ByteBuffer outputBuffer=utf8charset.encode(data); byte[] outputData=outputBuffer.array(); String source=new String(outputData); return source; } else { baos=new ByteArrayOutputStream(); recis.getReplayInputStream().readContentTo(baos); String source=baos.toString(charset); return source; } } finally { IOUtils.closeQuietly(recis); if (baos != null) { IOUtils.closeQuietly(baos); } } }
This method converts the sourceCode into UTF-8 charset to ensure the charset compatibility with the source and the charset used for the persistence.
public void addCladeSiteModel(SiteModel siteModel,TaxonList taxonList,boolean includeStem) throws Tree.MissingTaxonException { Logger.getLogger("dr.evomodel").info("SiteModel added for clade."); cladeSiteModels.add(new Clade(siteModel,taxonList,includeStem)); addModel(siteModel); commonAncestorsKnown=true; }
Add an additional siteModel for a clade in the tree.
protected void rotateRight(BalancedBinaryNode<K,V> p){ BalancedBinaryNode<K,V> l=p.left; p.left=l.right; if (l.right != null) l.right.parent=p; l.parent=p.parent; if (p.parent == null) root=l; else if (p.parent.right == p) p.parent.right=l; else p.parent.left=l; l.right=p; p.parent=l; }
From CLR
public void parse(Node node) throws SAXException { contentHandler.setDocumentLocator(this); Node current=node; Node next; for (; ; ) { current.visit(this); if ((next=current.getFirstChild()) != null) { current=next; continue; } for (; ; ) { current.revisit(this); if (current == node) { return; } if ((next=current.getNextSibling()) != null) { current=next; break; } current=current.getParentNode(); } } }
Causes SAX events for the tree rooted at the argument to be emitted. <code>startDocument()</code> and <code>endDocument()</code> are only emitted for a <code>Document</code> node.
private static Result showDialog(Stage owner,MessageType type,String msg,boolean applyToAll){ MessageBox dlg=new MessageBox(owner,type,msg,applyToAll); dlg.showModal(); return dlg.res; }
Show message in modal dialog.
public PacketMOUSE(int x,int y){ super(PT_MOUSE); byte flags=0; flags|=MS_ABSOLUTE; appendPayload(flags); appendPayload((short)x); appendPayload((short)y); }
A MOUSE packets sets the mouse position in XBMC
@Override public void onComplete(Void result){ assert activeStreams.size() == 0; closeFuture.set(null); }
Occurs when the client has initiated the connection closure.
default String name(){ return getClass().getSimpleName(); }
The name of the event. This is the key that will be used to determine which listeners might be interested. <p> The default name of any event is the simple class name.
public static <K,V>Map<K,V> of(K k1,V v1,K k2,V v2,K k3,V v3,K k4,V v4){ Map map=of(); map.put(k1,v1); map.put(k2,v2); map.put(k3,v3); map.put(k4,v4); return map; }
Returns map containing the given entries.
public void update(Graphics a,JComponent b){ for (int i=0; i < uis.size(); i++) { ((ComponentUI)(uis.elementAt(i))).update(a,b); } }
Invokes the <code>update</code> method on each UI handled by this object.
LambdaFormBuffer replaceParameterByCopy(int pos,int valuePos){ assert (pos != valuePos); replaceName(pos,names[valuePos]); noteDuplicate(pos,valuePos); return this; }
Replace a parameter by another parameter or expression already in the form.
public void startWatching(String fileName){ synchronized (mObservedChildren) { if (!mObservedChildren.containsKey(fileName)) { mObservedChildren.put(fileName,Boolean.valueOf(false)); } } if (new File(mPath).exists()) { startWatching(); Log_OC.d(TAG,"Started watching parent folder " + mPath + "/"); } }
Adds a child file to the list of files observed by the folder observer.
String modifyToolTipText(String start,VariableValue variable){ log.trace("modifyToolTipText: {}",variable.label()); start=addCvDescription(start,variable.getCvDescription(),variable.getMask()); if (_cvModel.getProgrammer() != null && !_cvModel.getProgrammer().getCanRead()) { start=addTextHTMLaware(start," (Hardware cannot read)"); } if (_cvModel.getProgrammer() != null && !_cvModel.getProgrammer().getCanWrite()) { start=addTextHTMLaware(start," (Hardware cannot write)"); } if (variable.getReadOnly()) { start=addTextHTMLaware(start," (Defined to be read only)"); } if (variable.getWriteOnly()) { start=addTextHTMLaware(start," (Defined to be write only)"); } return start; }
Takes default tool tip text, e.g. from the decoder element, and modifies it as needed. <p> Intended to handle e.g. adding CV numbers to variables.
public void toggleSelection(int position){ if (selectedItems.get(position,false)) { selectedItems.delete(position); } else { selectedItems.put(position,true); } notifyItemChanged(position); }
Toggle the selection status of the item at a given position
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
private void validateStoragePolicyCreateRequest(StoragePolicyCreateRequest request){ Assert.notNull(request,"A storage policy create request must be specified."); storagePolicyHelper.validateStoragePolicyKey(request.getStoragePolicyKey()); validateStoragePolicyRule(request.getStoragePolicyRule()); validateStoragePolicyFilter(request.getStoragePolicyFilter()); validateStoragePolicyTransition(request.getStoragePolicyTransition()); Assert.hasText(request.getStatus(),"A storage policy status must be specified."); request.setStatus(request.getStatus().trim()); }
Validates the storage policy create request. This method also trims the request parameters.
private void validatePortals(){ for ( final IRPZone zone : this) { for ( final Portal portal : ((StendhalRPZone)zone).getPortals()) { validatePortal(portal); } } }
Checks for unpaired portals.
public void addTextProperty(String propertyName,TextNode node){ if (node instanceof TextLayoutFormatNode) { if (FXG_LINKACTIVEFORMAT_PROPERTY_ELEMENT.equals(propertyName)) { if (linkActiveFormat == null) { linkActiveFormat=(TextLayoutFormatNode)node; linkActiveFormat.setParent(this); if (properties == null) properties=new HashMap<String,TextNode>(3); properties.put(propertyName,linkActiveFormat); } else { throw new FXGException(getStartLine(),getStartColumn(),"MultipleLinkFormatElements"); } } else if (FXG_LINKHOVERFORMAT_PROPERTY_ELEMENT.equals(propertyName)) { if (linkHoverFormat == null) { linkHoverFormat=(TextLayoutFormatNode)node; linkHoverFormat.setParent(this); if (properties == null) properties=new HashMap<String,TextNode>(3); properties.put(propertyName,linkHoverFormat); } else { throw new FXGException(getStartLine(),getStartColumn(),"MultipleLinkFormatElements"); } } else if (FXG_LINKNORMALFORMAT_PROPERTY_ELEMENT.equals(propertyName)) { if (linkNormalFormat == null) { linkNormalFormat=(TextLayoutFormatNode)node; linkNormalFormat.setParent(this); if (properties == null) properties=new HashMap<String,TextNode>(3); properties.put(propertyName,linkNormalFormat); } else { throw new FXGException(getStartLine(),getStartColumn(),"MultipleLinkFormatElements"); } } else { throw new FXGException(node.getStartLine(),node.getStartColumn(),"UnknownLinkFormat",propertyName); } } else { super.addTextProperty(propertyName,node); } }
A tcy node can also have special child property nodes that represent complex property values that cannot be set via a simple attribute.
private void updateAction(){ int numSelected=networkPanel.getSelectedModelElements().size(); if (numSelected > 0) { setEnabled(true); } else { setEnabled(false); } }
Set action text based on number of selected neurons.
public ErrorMessage(ErrorMessage other){ if (other.isSetHeader()) { this.header=new AsyncMessageHeader(other.header); } if (other.isSetError()) { this.error=new SyncError(other.error); } if (other.isSetType()) { this.type=other.type; } }
Performs a deep copy on <i>other</i>.
public final AlertDialog initiateScan(){ return initiateScan(ALL_CODE_TYPES); }
Initiates a scan for all known barcode types.
@Override public Lesson findById(Long lessonId){ Lesson lesson=this.lessonRepository.findById(lessonId).orElseThrow(null); return lesson; }
Find a lesson by its id, if not found then throw a <code>LessonNotFoundException</code>
private static Sync.Type type(Sync<? extends Synced> sync){ if (sync.object instanceof Review) { return REVIEW; } else if (sync.object instanceof User) { return USER; } else if (sync.object instanceof Restaurant) { return RESTAURANT; } return null; }
Get the type of object that was acted on.
public BrowserRows(BrowseTable table){ this.table=table; }
Build With table *** Build Of Class
@Override public void eUnset(int featureID){ switch (featureID) { case TypesPackage.DECLARED_TYPE_WITH_ACCESS_MODIFIER__DECLARED_TYPE_ACCESS_MODIFIER: setDeclaredTypeAccessModifier(DECLARED_TYPE_ACCESS_MODIFIER_EDEFAULT); return; case TypesPackage.DECLARED_TYPE_WITH_ACCESS_MODIFIER__DECLARED_PROVIDED_BY_RUNTIME: setDeclaredProvidedByRuntime(DECLARED_PROVIDED_BY_RUNTIME_EDEFAULT); return; } super.eUnset(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void testReplaceValuesRandomAccess(){ Multimap<String,Integer> multimap=create(); multimap.put("foo",1); multimap.put("foo",3); assertTrue(multimap.replaceValues("foo",Arrays.asList(2,4)) instanceof RandomAccess); assertTrue(multimap.replaceValues("bar",Arrays.asList(2,4)) instanceof RandomAccess); }
Confirm that replaceValues() returns a List that implements RandomAccess, even though get() doesn't.
public static boolean isDtoWith(Method method){ if (method.isAnnotationPresent(DelegateTo.class)) { return false; } String methodName=method.getName(); return methodName.startsWith("with") && method.getParameterTypes().length == 1; }
Check is specified method is DTO with.
private static FitnessAndQuality fitnessAndQualityParsed(String mimeType,Collection<ParseResults> parsedRanges){ int bestFitness=-1; float bestFitQ=0; ParseResults target=parseMediaRange(mimeType); for ( ParseResults range : parsedRanges) { if ((target.type.equals(range.type) || range.type.equals("*") || target.type.equals("*")) && (target.subType.equals(range.subType) || range.subType.equals("*") || target.subType.equals("*"))) { for ( String k : target.params.keySet()) { int paramMatches=0; if (!k.equals("q") && range.params.containsKey(k) && target.params.get(k).equals(range.params.get(k))) { paramMatches++; } int fitness=(range.type.equals(target.type)) ? 100 : 0; fitness+=(range.subType.equals(target.subType)) ? 10 : 0; fitness+=paramMatches; if (fitness > bestFitness) { bestFitness=fitness; bestFitQ=toFloat(range.params.get("q"),0); } } } } return new FitnessAndQuality(bestFitness,bestFitQ); }
Find the best match for a given mimeType against a list of media_ranges that have already been parsed by MimeParse.parseMediaRange(). Returns a tuple of the fitness value and the value of the 'q' quality parameter of the best match, or (-1, 0) if no match was found. Just as for quality_parsed(), 'parsed_ranges' must be a list of parsed media ranges.
public static char[] toPrimitive(final Character[] array){ if (array == null) { return null; } else if (array.length == 0) { return ArrayUtils.EMPTY_CHAR_ARRAY; } final char[] result=new char[array.length]; for (int i=0; i < array.length; i++) { result[i]=array[i].charValue(); } return result; }
<p>Converts an array of object Characters to primitives.</p> <p>This method returns <code>null</code> for a <code>null</code> input array.</p>
@Override public ImmutableSetMultimap<K,V> build(){ if (keyComparator != null) { Multimap<K,V> sortedCopy=MultimapBuilder.linkedHashKeys().linkedHashSetValues().<K,V>build(); List<Map.Entry<K,Collection<V>>> entries=Ordering.from(keyComparator).<K>onKeys().immutableSortedCopy(builderMultimap.asMap().entrySet()); for ( Map.Entry<K,Collection<V>> entry : entries) { sortedCopy.putAll(entry.getKey(),entry.getValue()); } builderMultimap=sortedCopy; } return copyOf(builderMultimap,valueComparator); }
Returns a newly-created immutable set multimap.
private String readLine() throws IOException { String line=null; int newLineMatchByteCount; boolean isLastFilePart=no == 1; int i=currentLastBytePos; while (i > -1) { if (!isLastFilePart && i < avoidNewlineSplitBufferSize) { createLeftOver(); break; } if ((newLineMatchByteCount=getNewLineMatchByteCount(data,i)) > 0) { final int lineStart=i + 1; int lineLengthBytes=currentLastBytePos - lineStart + 1; if (lineLengthBytes < 0) { throw new IllegalStateException("Unexpected negative line length=" + lineLengthBytes); } byte[] lineData=new byte[lineLengthBytes]; System.arraycopy(data,lineStart,lineData,0,lineLengthBytes); line=new String(lineData,encoding); currentLastBytePos=i - newLineMatchByteCount; break; } i-=byteDecrement; if (i < 0) { createLeftOver(); break; } } if (isLastFilePart && leftOver != null) { line=new String(leftOver,encoding); leftOver=null; } return line; }
Reads a line.
public void preSuggest(){ currentMetric.inc(); }
Called before suggest
@Override public int hashCode(){ return super.hashCode(); }
Returns a hash code for this object.
public static void main(String[] args){ TestRunner.run(InvocableEndpointTest.class); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@Override public void addBatch(String sql) throws SQLException { try { debugCodeCall("addBatch",sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch ( Exception e) { throw logAndConvert(e); } }
Calling this method is not legal on a PreparedStatement.
private static void splitAdd(final double a[],final double b[],final double ans[]){ ans[0]=a[0] + b[0]; ans[1]=a[1] + b[1]; resplit(ans); }
Add two numbers in split form.
protected static void printUsage(){ System.out.println("Generate the control flow graph of a Java method, represented as a DOT graph."); System.out.println("Parameters: <inputfile> <outputdir> [-method <name>] [-class <name>] [-pdf]"); System.out.println(" -pdf: Also generate the PDF by invoking 'dot'."); System.out.println(" -method: The method to generate the CFG for (defaults to 'test')."); System.out.println(" -class: The class in which to find the method (defaults to 'Test')."); }
Print usage information.
public void removeOnNavigationPositionListener(){ this.navigationPositionListener=null; }
Remove OnNavigationPositionListener()
public final void testMinLengthWithContextParameter(){ assertNotNull(Validators.minLength(getContext(),1)); }
Tests the functionality of the minLength-method, which expects a context as a parameter.
public T image(String url,boolean memCache,boolean fileCache){ return image(url,memCache,fileCache,0,0); }
Set the image of an ImageView.
@Override public ExampleSet performPrediction(ExampleSet origExampleSet,Attribute predictedLabel) throws OperatorException { if (predictedLabel.isNominal()) { final String attributePrefix="BaggingModelPrediction"; final int numLabels=predictedLabel.getMapping().size(); final Attribute[] specialAttributes=new Attribute[numLabels]; for (int i=0; i < numLabels; i++) { specialAttributes[i]=com.rapidminer.example.Tools.createSpecialAttribute(origExampleSet,attributePrefix + i,Ontology.NUMERICAL); } Iterator<Example> reader=origExampleSet.iterator(); while (reader.hasNext()) { Example example=reader.next(); for (int i=0; i < specialAttributes.length; i++) { example.setValue(specialAttributes[i],0); } } reader=origExampleSet.iterator(); for (int modelNr=0; modelNr < this.getNumberOfModels(); modelNr++) { Model model=this.getModel(modelNr); ExampleSet exampleSet=(ExampleSet)origExampleSet.clone(); exampleSet=model.apply(exampleSet); updateEstimates(exampleSet,modelNr,specialAttributes); PredictionModel.removePredictedLabel(exampleSet); } this.evaluateSpecialAttributes(origExampleSet,specialAttributes); for (int i=0; i < numLabels; i++) { origExampleSet.getAttributes().remove(specialAttributes[i]); origExampleSet.getExampleTable().removeAttribute(specialAttributes[i]); } return origExampleSet; } else { double[] predictionSums=new double[origExampleSet.size()]; for ( Model model : models) { ExampleSet resultSet=model.apply((ExampleSet)origExampleSet.clone()); int index=0; Attribute innerPredictedLabel=resultSet.getAttributes().getPredictedLabel(); for ( Example example : resultSet) { predictionSums[index++]+=example.getValue(innerPredictedLabel); } PredictionModel.removePredictedLabel(resultSet); } int index=0; for ( Example example : origExampleSet) { example.setValue(predictedLabel,predictionSums[index++] / models.size()); } return origExampleSet; } }
Iterates over all models and averages confidences.
public State(PlotRenderingInfo info){ super(info); this.lowerCoordinates=new java.util.ArrayList(); this.upperCoordinates=new java.util.ArrayList(); }
Creates a new state instance.
public Object nextMeta() throws JSONException { char c; char q; do { c=next(); } while (Character.isWhitespace(c)); switch (c) { case 0: throw syntaxError("Misshaped meta tag"); case '<': return XML.LT; case '>': return XML.GT; case '/': return XML.SLASH; case '=': return XML.EQ; case '!': return XML.BANG; case '?': return XML.QUEST; case '"': case '\'': q=c; for (; ; ) { c=next(); if (c == 0) { throw syntaxError("Unterminated string"); } if (c == q) { return Boolean.TRUE; } } default : for (; ; ) { c=next(); if (Character.isWhitespace(c)) { return Boolean.TRUE; } switch (c) { case 0: case '<': case '>': case '/': case '=': case '!': case '?': case '"': case '\'': back(); return Boolean.TRUE; } } } }
Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures.
private final void createUsageVariables() throws AdeException { String dataObjectName=getAnalysisGroup() + "." + getName()+ ".m_prevIntervalTimelineMap"; Object tmp=Ade.getAde().getDataStore().models().getModelDataObject(dataObjectName); instantiateTimelineAndAlreadySeen(dataObjectName,tmp); dataObjectName=getAnalysisGroup() + "." + getName()+ ".m_alreadySeen"; tmp=Ade.getAde().getDataStore().models().getModelDataObject(dataObjectName); instantiateTimelineAndAlreadySeen(dataObjectName,tmp); if (m_dataTypeFactory == null) { try { m_dataTypeFactory=DatatypeFactory.newInstance(); } catch ( DatatypeConfigurationException e) { throw new AdeInternalException("Failed to instantiate data factory for calendar",e); } } if (m_gc == null) { final TimeZone outputTimeZone=Ade.getAde().getConfigProperties().getOutputTimeZone(); m_gc=new GregorianCalendar(outputTimeZone); } }
Creates variables used by this class for tracking last seen messages. m_prevIntervalTimelineMap contains the previous timeline (milliseconds from epoch time) for each message ID. m_alreadySeen contains the message IDs of those messages that were seen previously.
private String createString(String f){ StringBuilder sb=new StringBuilder(); switch (resType) { case CUresourcetype.CU_RESOURCE_TYPE_ARRAY: sb.append("hArray=" + array_hArray + f); break; case CUresourcetype.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: sb.append("hMipmappedArray=" + mipmap_hMipmappedArray + f); break; case CUresourcetype.CU_RESOURCE_TYPE_LINEAR: sb.append("devPtr=" + linear_devPtr + f); sb.append("format=" + CUarray_format.stringFor(linear_format) + f); sb.append("numChannels=" + linear_numChannels + f); sb.append("sizeInBytes=" + linear_sizeInBytes + f); break; case CUresourcetype.CU_RESOURCE_TYPE_PITCH2D: sb.append("devPtr=" + pitch2D_devPtr + f); sb.append("format=" + CUarray_format.stringFor(pitch2D_format) + f); sb.append("numChannels=" + pitch2D_numChannels + f); sb.append("width=" + pitch2D_width + f); sb.append("height=" + pitch2D_height + f); sb.append("pitchInBytes=" + pitch2D_pitchInBytes + f); break; default : sb.append("INVALID"); } return sb.toString(); }
Creates and returns a string representation of this object, using the given separator for the fields
public ShapeRenderer(){ }
Creates a new ShapeRenderer with default base size of 10 pixels.
public CAMatrix drawBoxAt(int x,int y,int w,int state){ for (int i=y - w / 2; i < y + w / 2; i++) { for (int j=x - w / 2; j < x + w / 2; j++) { if (j >= 0 && j < width && i >= 0 && i < height) { int idx=j + i * width; swap[idx]=matrix[idx]=state; } } } return this; }
Sets all matrix cells in a square around the given x,y coordinates to the requested state.
public boolean isWorkerThreadNameSupported(){ return workerThreadNameSupported; }
Checks if is worker thread name supported.
public boolean isValid(List<S2Point> vertices){ int n=vertices.size(); for (int i=0; i < n; ++i) { if (!S2.isUnitLength(vertices.get(i))) { log.info("Vertex " + i + " is not unit length"); return false; } } for (int i=1; i < n; ++i) { if (vertices.get(i - 1).equals(vertices.get(i)) || vertices.get(i - 1).equals(S2Point.neg(vertices.get(i)))) { log.info("Vertices " + (i - 1) + " and "+ i+ " are identical or antipodal"); return false; } } return true; }
Return true if the given vertices form a valid polyline.
public float readFloat(){ return scanner.nextFloat(); }
Read and return the next float.
public void mouseEntered(MouseEvent e){ ((MouseListener)a).mouseEntered(e); ((MouseListener)b).mouseEntered(e); }
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.
public final void applyForceToCenter(Vec2 force){ if (m_type != BodyType.DYNAMIC) { return; } if (isAwake() == false) { setAwake(true); } m_force.x+=force.x; m_force.y+=force.y; }
Apply a force to the center of mass. This wakes up the body.
public static <T>boolean equals(final Collection<T> c1,final Collection<T> c2){ if (c1 == null || c2 == null) { return c1 == c2; } if (c1.size() != c2.size()) { return false; } if (c1 == c2) { return true; } if (!c1.containsAll(c2)) { return false; } return c2.containsAll(c1); }
true if for each a in c1, a exists in c2, and if for each b in c2, b exist in c1 and c1 and c2 are the same size. Note that (a,a,b) (a,b,b) are equal.
public static double intersectRayLine(Vector2dc origin,Vector2dc dir,Vector2dc point,Vector2dc normal,double epsilon){ return intersectRayLine(origin.x(),origin.y(),dir.x(),dir.y(),point.x(),point.y(),normal.x(),normal.y(),epsilon); }
Test whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the line containing the given <code>point</code> and having the given <code>normal</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <tt>-1.0</tt> if the ray does not intersect the line, because it is either parallel to the line or its direction points away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).
@Interruptible public static void fullyBootedVM(){ Selected.Plan.get().fullyBooted(); }
Notify the MM that the host VM is now fully booted.
public DoubleMatrix1D like1D(int size){ return new SparseDoubleMatrix1D(size); }
Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc.
private void readDefinition(InH3Amp inAmp){ int id=(int)readUnsigned(); String name=readString(); int type=(int)readUnsigned(); int fields=(int)readUnsigned(); FieldInfoH3[] fieldInfo=new FieldInfoH3[fields]; for (int i=0; i < fields; i++) { fieldInfo[i]=readFieldInfo(); } ClassInfoH3 info=new ClassInfoH3(name,fieldInfo); inAmp.define(id,info); }
Define object
void scramble(){ initialSize=getSize(); int a[]=new int[initialSize.height / 2]; double f=initialSize.width / (double)a.length; for (int i=a.length; --i >= 0; ) { a[i]=(int)(i * f); } for (int i=a.length; --i >= 0; ) { int j=(int)(i * Math.random()); int t=a[i]; a[i]=a[j]; a[j]=t; } arr=a; }
Fill the array with random numbers from 0..n-1.
@Override public void execute(StepInstance stepInstance,String temporaryFileDirectory){ Set<RawProtein<CDDRawMatch>> rawMatches=rawMatchDAO.getProteinsByIdRange(stepInstance.getBottomProtein(),stepInstance.getTopProtein(),signatureLibraryRelease); Map<String,RawProtein<CDDRawMatch>> proteinIdToRawProteinMap=new HashMap<String,RawProtein<CDDRawMatch>>(rawMatches.size()); if (rawMatches.size() == 0) { Long sequenceCout=stepInstance.getTopProtein() - stepInstance.getBottomProtein(); Utilities.verboseLog(10,"Zero matches found: on " + sequenceCout + " proteins stepinstance:"+ stepInstance.toString()); int waitTimeFactor=2; if (!Utilities.isRunningInSingleSeqMode()) { waitTimeFactor=Utilities.getWaitTimeFactorLogE(10 * sequenceCout.intValue()).intValue(); } Utilities.sleep(waitTimeFactor * 1000); rawMatches=rawMatchDAO.getProteinsByIdRange(stepInstance.getBottomProtein(),stepInstance.getTopProtein(),signatureLibraryRelease); Utilities.verboseLog(10,"matches after : " + rawMatches.size()); } int matchCount=0; for ( final RawProtein rawProtein : rawMatches) { matchCount+=rawProtein.getMatches().size(); } Utilities.verboseLog(10," CDD: Retrieved " + rawMatches.size() + " proteins to post-process."+ " A total of "+ matchCount+ " raw matches."); for ( RawProtein<CDDRawMatch> rawMatch : rawMatches) { proteinIdToRawProteinMap.put(rawMatch.getProteinIdentifier(),rawMatch); } Map<String,RawProtein<CDDRawMatch>> filteredMatches=postProcessor.process(proteinIdToRawProteinMap); filteredMatchDAO.persist(filteredMatches.values()); matchCount=0; for ( final RawProtein rawProtein : filteredMatches.values()) { matchCount+=rawProtein.getMatches().size(); } Utilities.verboseLog(10," CDD: " + filteredMatches.size() + " proteins passed through post processing."+ " and a total of "+ matchCount+ " matches PASSED."); if (LOGGER.isDebugEnabled()) { LOGGER.debug("CDD: " + filteredMatches.size() + " proteins passed through post processing."); LOGGER.debug("CDD: A total of " + matchCount + " matches PASSED."); } }
This method is called to execute the action that the StepInstance must perform. <p/> If an error occurs that cannot be immediately recovered from, the implementation of this method MUST throw a suitable Exception, as the call to execute is performed within a transaction with the reply to the JMSBroker. <p/> Implementations of this method MAY call delayForNfs() before starting, if, for example, they are operating of file system resources.
public Provider<WorkingSetManagerBrokerImpl> provideWorkingSetManagerBrokerImpl(){ return Access.contributedProvider(WorkingSetManagerBrokerImpl.class); }
Binds the broker implementation for the working set managers in a singleton scope.
private void populate(ParameterTable matrix,ParameterList signature,int index){ ParameterList column=table.get(index); int width=signature.size(); int height=column.size(); for (int i=0; i < height; i++) { for (int j=0; j < width; j++) { ParameterList list=matrix.get(j); Parameter parameter=signature.get(j); list.add(parameter); } ParameterList list=matrix.get(index); Parameter parameter=column.get(i); list.add(parameter); } }
This is the final leg of building a permutation where a signature is given to permutate on the last column. Once finished the matrix will have a new row of parameters added which represents a new set of permutations to create signatures from.
@NotNull @ObjectiveCName("findUsersCommandWithQuery:") public Command<UserVM[]> findUsers(String query){ return null; }
Find Users
public static int executeUpdate(String sql,boolean ignoreError,String trxName,int timeOut){ return executeUpdate(sql,null,ignoreError,trxName,timeOut); }
Execute Update. saves "DBExecuteError" in Log
private static void waitUntilTreeItemHasItem(SWTBot bot,final SWTBotTreeItem tree,final String nodeText){ if (!waitUntilTreeHasItemImpl(bot,tree.widget,nodeText)) { bot.sleep(1000); tree.doubleClick(); bot.waitUntil(new TreeCollapsedCondition(tree.widget)); bot.sleep(1000); tree.expand(); bot.waitUntil(new TreeExpandedCondition(tree.widget)); if (!waitUntilTreeHasItemImpl(bot,tree.widget,nodeText)) { printTree(tree.widget); throw new TimeoutException(String.format("Timed out waiting for %s, giving up...",nodeText)); } } }
Blocks the caller until the tree item has the given item text.
public JSONTokener(InputStream inputStream) throws JSONException { this(new InputStreamReader(inputStream)); }
Construct a JSONTokener from an InputStream.
public String minNumTipText(){ return "The minimum total weight of the instances in a leaf."; }
Returns the tip text for this property
public void copyFrom(ReturnPathType other){ this.type=other.type; }
Make this dataflow fact an exact copy of the other one.
public synchronized List<Vertex> findAllQuery(String jpql){ return findAllQuery(jpql,1000); }
Return all vertices matching the JPQL query.
public static HttpServletRequest buildMockHttpServletRequestObject(SignableSAMLObject samlObject,boolean doCompress,String relayStateParameter,String sigAlg,String signature,StringBuffer sbRequestUrl) throws MarshallingException, IOException { logger.info("buildMockHttpServletRequestObject. "); HttpServletRequest request=createMock(HttpServletRequest.class); if (samlObject instanceof LogoutResponse || samlObject instanceof Response) { expect(request.getParameter(SamlUtils.SAML_RESPONSE_PARAMETER)).andReturn(SamlUtils.encodeSAMLObject(samlObject,doCompress)).anyTimes(); expect(request.getParameter(SamlUtils.SAML_REQUEST_PARAMETER)).andReturn(null).anyTimes(); } else if (samlObject instanceof LogoutRequest) { expect(request.getParameter(SamlUtils.SAML_REQUEST_PARAMETER)).andReturn(SamlUtils.encodeSAMLObject(samlObject,doCompress)).anyTimes(); expect(request.getParameter(SamlUtils.SAML_RESPONSE_PARAMETER)).andReturn(null).anyTimes(); } else { throw new IllegalArgumentException(); } expect(request.getParameter(SamlUtils.RELAY_STATE_PARAMETER)).andReturn(relayStateParameter).anyTimes(); expect(request.getParameter(SamlUtils.SIGNATURE_ALGORITHM_PARAMETER)).andReturn(sigAlg).anyTimes(); expect(request.getParameter(SamlUtils.SIGNATURE_PARAMETER)).andReturn(signature).anyTimes(); expect(request.getRequestURL()).andReturn(sbRequestUrl).anyTimes(); String queryString=null; if (samlObject instanceof LogoutResponse || samlObject instanceof Response) { queryString=SamlUtils.SAML_RESPONSE_PARAMETER + "=" + SamlUtils.encodeSAMLObject(samlObject,doCompress); } else if (samlObject instanceof LogoutRequest) { queryString=SamlUtils.SAML_REQUEST_PARAMETER + "=" + SamlUtils.encodeSAMLObject(samlObject,doCompress); } else { throw new IllegalArgumentException(); } if (relayStateParameter != null) { queryString=queryString + "&" + SamlUtils.RELAY_STATE_PARAMETER+ "="+ relayStateParameter; } if (sigAlg != null) { queryString=queryString + "&" + SamlUtils.SIGNATURE_ALGORITHM_PARAMETER+ "="+ sigAlg; } if (signature != null) { queryString=queryString + "&" + SamlUtils.SIGNATURE_PARAMETER+ "="+ signature; } expect(request.getQueryString()).andReturn(queryString).anyTimes(); replay(request); return request; }
Build a mock HttpServletRequest with given expected parameters.
@Override public boolean verifyPublicKey(PGPPublicKey keyToVerify,PGPPublicKey keyToVerifyWith){ try { return PGPEncryptionUtil.verifyPublicKey(keyToVerify,keyToVerifyWith); } catch ( Exception e) { throw new RuntimeException(e); } }
Verifies that a public key is signed with another public key
private void readData() throws IOException { while (!isClosed) { int code=is.read(); switch (code) { case ' ': case '\t': case '\n': case '\r': break; case 'C': { int channel=(is.read() << 8) + is.read(); inputReady[channel]=true; return; } case 'E': { int channel=(is.read() << 8) + is.read(); int status=(is.read() << 8) + is.read(); inputReady[channel]=true; return; } case -1: close(); return; default : close(); return; } } return; }
Reads data until a channel packet 'C' or error 'E' is received.
public double normalizeLatitude(double lat){ if (lat > NORTH_LIMIT) { lat=NORTH_LIMIT; } else if (lat < SOUTH_LIMIT) { lat=SOUTH_LIMIT; } return lat; }
Sets radian latitude to something sane. This is an abstract function since some projections don't deal well with extreme latitudes.
public Shape greatCircleLineShape(){ GeneralPath path=null; if (llpts != null && llpts.length >= 4 && llpts.length % 2 == 0) { double y1=llpts[0]; double x1=llpts[1]; path=new GeneralPath(GeneralPath.WIND_EVEN_ODD,llpts.length / 2); boolean firstCoords=true; for (int i=2; i < llpts.length; i+=2) { double y2=llpts[i]; double x2=llpts[i + 1]; double radDist=GreatCircle.sphericalDistance(y1,x1,y2,x2); int nsegs=(int)(ProjMath.radToDeg(radDist) * segsPerDeg); if (nsegs == 0) { nsegs=1; } double[] coords=GreatCircle.greatCircle(y1,x1,y2,x2,nsegs,false); if (returnDegrees) { ProjMath.arrayRadToDeg(coords); } for (int j=0; j <= coords.length - 1; j+=2) { if (firstCoords) { path.moveTo(coords[j + 1],coords[j]); firstCoords=false; } else { path.lineTo(coords[j + 1],coords[j]); } } x1=x2; y1=y2; } if (returnDegrees) { path.lineTo(ProjMath.radToDeg(x1),ProjMath.radToDeg(y1)); } else { path.lineTo(x1,y1); } } return path; }
Create a java.awt.Shape object of coordinates connected by great circle lines.
final public boolean checkCacheClosing(DistributionManager dm){ GemFireCacheImpl cache=GemFireCacheImpl.getInstance(); return (cache == null || cache.getCancelCriterion().isCancelInProgress()); }
check to see if the cache is closing
public AbstractGraph(List<V> vertices,List<Edge> edges){ for (int i=0; i < vertices.size(); i++) { addVertex(vertices.get(i)); } createAdjacencyLists(edges,vertices.size()); }
Construct a graph from vertices and edges stored in lists
public void onEvent(Event e){ log.info("Cmd=" + e.getTarget().getId()); if (cmbDocType.equals(e.getTarget())) { form.postQueryEvent(); return; } validate(); }
Action Listener
public static URL resolvePropertiesUrl(String resource,Locale locale){ if (UtilValidate.isEmpty(resource)) { throw new IllegalArgumentException("resource cannot be null or empty"); } String resourceName=createResourceName(resource,locale,false); if (propertiesNotFound.contains(resourceName)) { return null; } URL url=null; try { if (resource.endsWith(".xml") || resource.endsWith(".properties")) { url=FlexibleLocation.resolveLocation(resource); if (url != null) { return url; } } url=FlexibleLocation.resolveLocation(resourceName + ".properties"); if (url != null) { return url; } url=FlexibleLocation.resolveLocation(resourceName + ".xml"); if (url != null) { return url; } url=FlexibleLocation.resolveLocation(resource + ".xml"); if (url != null) { return url; } url=FlexibleLocation.resolveLocation(resourceName); if (url != null) { return url; } } catch ( Exception e) { Debug.logInfo("Properties resolver: invalid URL - " + e.getMessage(),module); } if (propertiesNotFound.size() <= 300) { propertiesNotFound.add(resourceName); } return null; }
Resolve a properties file URL. <p>This method uses the following strategy:<br /> <ul> <li>Locate the XML file specified in <code>resource (MyProps.xml)</code></li> <li>Locate the file that starts with the name specified in <code>resource</code> and ends with the locale's string and <code>.xml (MyProps_en.xml)</code></li> <li>Locate the file that starts with the name specified in <code>resource</code> and ends with the locale's string and <code>.properties (MyProps_en.properties)</code></li> <li>Locate the file that starts with the name specified in <code>resource and ends with the locale's string (MyProps_en)</code></li> </ul> <br /> The <code>component://</code> protocol is supported in the <code>resource</code> parameter. </p>
@Override public ServerHandshakeBuilder onWebsocketHandshakeReceivedAsServer(WebSocket conn,Draft draft,ClientHandshake request) throws InvalidDataException { return new HandshakeImpl1Server(); }
This default implementation does not do anything. Go ahead and overwrite it.
public final int yylength(){ return zzMarkedPos - zzStartRead; }
Returns the length of the matched text region.
public boolean editCellAt(int row,int column,java.util.EventObject e){ if (!super.editCellAt(row,column,e)) return false; Object ed=getCellEditor(); if (ed instanceof VEditor) ((Component)ed).requestFocus(); else if (ed instanceof VCellEditor) { ed=((VCellEditor)ed).getEditor(); ((Component)ed).requestFocus(); } return true; }
Transfer focus explicitly to editor due to editors with multiple components
public static int lowerBound(final List<Date> dates,final Date value){ int len=dates.size(); int from=0; int half; int middle; while (len > 0) { half=len >> 1; middle=from; middle=middle + half; if (value.compareTo(dates.get(middle)) == 1) { from=middle; from++; len=len - half - 1; } else { len=half; } } return from; }
This method is equivalent to std:lower_bound function Returns an index pointing to the first element in the ordered collection is equal or greater than passed value
public boolean isAmbient(){ return this.ambient; }
Makes potion effect produce more, translucent, particles.
public void select(boolean flag){ isSelected=flag; if (!isSelected) { mark=0; } }
Determine selectable status.
protected void waitForDownloadOrTimeout(long id,long poll,long timeoutMillis) throws TimeoutException, InterruptedException { doWaitForDownloadsOrTimeout(new Query().setFilterById(id),poll,timeoutMillis); waitForReceiverNotifications(1); }
Helper to wait for a particular download to finish, or else a timeout to occur Also guarantees a notification has been posted for the download.
public JasperException(Throwable exception){ super(exception); }
Creates a JasperException with the embedded exception