code
stringlengths
10
174k
nl
stringlengths
3
129k
public String registerName(final String name,final Operator operator){ if (operatorNameMap.get(name) != null) { String baseName=name; int index=baseName.indexOf(" ("); if (index >= 0) { baseName=baseName.substring(0,index); } int i=2; while (operatorNameMap.get(baseName + " (" + i+ ")") != null) { i++; } String newName=baseName + " (" + i+ ")"; operatorNameMap.put(newName,operator); return newName; } else { operatorNameMap.put(name,operator); return name; } }
Returns a "name (i)" if name is already in use. This new name should then be used as operator name.
private void logResult(Iterable<Label> result){ if (LogUtils.LOG_LEVEL >= Log.VERBOSE) { final StringBuilder logMessageBuilder=new StringBuilder("Query result: ["); for ( Label label : result) { logMessageBuilder.append("\n "); logMessageBuilder.append(label); } logMessageBuilder.append("]."); LogUtils.log(this,Log.VERBOSE,logMessageBuilder.toString()); } }
Logs labels resulting from a query.
public boolean isInserting(){ return m_inserting; }
Is inserting
public synchronized boolean canBeDeallocate(){ if (shareCounter > 0 || isBeingDeallocate) { return false; } if (!inCache.get()) { isBeingDeallocate=true; return true; } return false; }
Asked if can be deallocate (is not shared in other statement and not in cache) Set deallocate flag to true if so.
protected WrappingJavaFileManager(M fileManager){ super(fileManager); }
Creates a new instance of WrappingJavaFileManager.
protected AbstractParser(AltFormat altFormat,Class<? extends T> resultType){ Preconditions.checkNotNull(altFormat,"altFormat"); Preconditions.checkNotNull(resultType,"resultType"); this.altFormat=altFormat; this.resultType=resultType; }
Constructs a new AbstractParser instance for the specified representation and result type.
void printHelp(){ System.out.println("\nUsage: klist " + "[[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name]"); System.out.println(" name\t name of credentials cache or " + " keytab with the prefix. File-based cache or " + "keytab's prefix is FILE:."); System.out.println(" -c specifies that credential cache is to be " + "listed"); System.out.println(" -k specifies that key tab is to be listed"); System.out.println(" options for credentials caches:"); System.out.println("\t-f \t shows credentials flags"); System.out.println("\t-e \t shows the encryption type"); System.out.println("\t-a \t shows addresses"); System.out.println("\t -n \t do not reverse-resolve addresses"); System.out.println(" options for keytabs:"); System.out.println("\t-t \t shows keytab entry timestamps"); System.out.println("\t-K \t shows keytab entry key value"); System.out.println("\t-e \t shows keytab entry key type"); System.out.println("\nUsage: java sun.security.krb5.tools.Klist " + "-help for help."); }
Prints out the help information.
public boolean hasCharacterIndex(int index){ for (int n=0; n < charMap.length; n++) { if (index == charMap[n]) return true; } return false; }
Return true is the character index is represented by glyphs in this layout.
@Override public ODataResponse handleError(ODataErrorContext ctx) throws ODataApplicationException { return EntityProvider.writeErrorDocument(ctx); }
Logs full stack traces. Always logs at ERROR level From ODataErrorCallback.
public T caseDebuggerStatement(DebuggerStatement object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Debugger Statement</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
boolean wantsToTrigger(PropertyChangeEvent evt){ try { String sysName=((NamedBean)evt.getSource()).getSystemName(); String userName=((NamedBean)evt.getSource()).getUserName(); for (int i=0; i < _variableList.size(); i++) { if (sysName.equals(_variableList.get(i).getName())) { return _variableList.get(i).doTriggerActions(); } } if (userName != null) { for (int i=0; i < _variableList.size(); i++) { if (userName.equals(_variableList.get(i).getName())) { return _variableList.get(i).doTriggerActions(); } } } } catch ( ClassCastException e) { log.error(getDisplayName() + " PropertyChangeEvent source of unexpected type: " + evt); } return true; }
Find out if the state variable is willing to cause the actions to execute
public void openToLeft(){ if (open) { return; } if (bottomRightWrapper.getComponentCount() == 0) { return; } Component bottom=bottomRightWrapper.getComponentAt(0); if (bottomLeftWrapper.getComponentCount() > 0) { bottomLeftWrapper.setVisible(false); } bottomRightWrapper.setVisible(true); int topX=topWrapper.getX(); openCloseMotion=Motion.createSplineMotion(-topX,bottom.getWidth(),300); getComponentForm().registerAnimated(this); openCloseMotion.start(); openedToLeft=true; open=true; }
This method will open the top Component to the left if there is a Component to expose on the right.
@Override public void doInitialize(UimaContext aContext) throws ResourceInitializationException { DB db=mongoResource.getDB(); collection=db.getCollection(collectionName); collection.createIndex(new BasicDBObject(FIELD_UNIQUE_ID,1)); collection.createIndex(new BasicDBObject(FIELD_PUBLISHEDIDS,1)); stopFeatures=new HashSet<String>(); stopFeatures.add("uima.cas.AnnotationBase:sofa"); stopFeatures.add("uk.gov.dstl.baleen.types.BaleenAnnotation:internalId"); maxContentLength=ConfigUtils.stringToInteger(maxContentLengthString,0); }
Get the MongoDB, collection and create some indexes
private void resetHintTime(){ mHandler.removeCallbacks(mHint); mHandler.postDelayed(mHint,HINT_DELAY); }
Reset the hint's delay time so that the delay is counted from the time this method is called.
public ExternalIDPResource externalIdp(){ return externalIdp; }
Get the subresource containing all of the commands related to a tenant's external identity providers.
public boolean isActivePointer(int pointerId){ final int pointerFlag=(1 << pointerId); return (mActivePointers & pointerFlag) != 0; }
Whether an input pointer is active.
private void doTextNormal(final PDFPage cmds,final String text){ final PointF zero=new PointF(); final Matrix scale=new Matrix(); Utils.setMatValues(scale,fsize,0,0,fsize * th,0,tr); final Matrix at=new Matrix(); final List<PDFGlyph> l=(List<PDFGlyph>)font.getGlyphs(text); for ( final PDFGlyph glyph : l) { at.set(cur); at.preConcat(scale); final PointF advance=glyph.addCommands(cmds,at,tm); float advanceX=(advance.x * fsize) + tc; if (glyph.getChar() == ' ') { advanceX+=tw; } advanceX*=th; cur.preTranslate(advanceX,advance.y); } final float[] src={zero.x,zero.y}; final float[] dst=new float[src.length]; cur.mapPoints(dst,src); prevEnd.set(dst[0],dst[1]); }
add some text to the page.
@SuppressWarnings("unused") @Test public void testSiblingStateTransition(){ Statechart sc=_createStatechart("sc"); { InterfaceScope s_scope=_createInterfaceScope("Interface",sc); VariableDefinition v1=_createVariableDefinition("v1",TYPE_INTEGER,s_scope); Region r=_createRegion("r",sc); { Entry r_entry=_createEntry(EntryKind.INITIAL,null,r); State s1=_createState("s1",r); { Region r2=_createRegion("r2",s1); { Entry r2_entry=_createEntry(EntryKind.INITIAL,null,r2); State s2=_createState("s2",r2); _createTransition(r2_entry,s2); } Region r3=_createRegion("r3",s1); { Entry r3_entry=_createEntry(EntryKind.INITIAL,null,r3); State s3=_createState("s3",r3); { Region r3a=_createRegion("r3a",s3); { Entry r3a_entry=_createEntry(EntryKind.INITIAL,null,r3a); State s3a=_createState("s3a",r3a); _createTransition(r3a_entry,s3a); } Region r3b=_createRegion("r3b",s3); { Entry r3b_entry=_createEntry(EntryKind.INITIAL,null,r3b); State s3b=_createState("s3b",r3b); State s3b2=_createState("s3b2",r3b); _createTransition(r3b_entry,s3b); } Region r3c=_createRegion("r3c",s3); { Entry r3c_entry=_createEntry(EntryKind.INITIAL,null,r3c); State s3c=_createState("s3c",r3c); _createTransition(r3c_entry,s3c); } } _createEntryAssignment(v1,s3,42); _createTransition(r3_entry,s3); } Region r4=_createRegion("r4",s1); { Entry r4_entry=_createEntry(EntryKind.INITIAL,null,r4); State s4=_createState("s4",r4); _createTransition(r4_entry,s4); } } _createTransition(r_entry,s1); State s5=_createState("s5",r); _createTransition(findState(sc,"s3b"),findState(sc,"s3b2")); } } ExecutionFlow flow=sequencer.transform(sc); ExecutionState _s2=flow.getStates().get(1); assertEquals("sc.r.s1.r2.s2",_s2.getName()); ExecutionState _s3=flow.getStates().get(2); assertEquals("sc.r.s1.r3.s3",_s3.getName()); ExecutionState _s3a=flow.getStates().get(3); assertEquals("sc.r.s1.r3.s3.r3a.s3a",_s3a.getName()); ExecutionState _s3b=flow.getStates().get(4); assertEquals("sc.r.s1.r3.s3.r3b.s3b",_s3b.getName()); ExecutionState _s3b2=flow.getStates().get(5); assertEquals("sc.r.s1.r3.s3.r3b.s3b2",_s3b2.getName()); ExecutionState _s3c=flow.getStates().get(6); assertEquals("sc.r.s1.r3.s3.r3c.s3c",_s3c.getName()); ExecutionState _s4=flow.getStates().get(7); assertEquals("sc.r.s1.r4.s4",_s4.getName()); ExecutionState _s5=flow.getStates().get(8); assertEquals("sc.r.s5",_s5.getName()); Reaction _t=_s3b.getReactions().get(0); assertTrue(_t.isTransition()); Sequence _effect=(Sequence)_t.getEffect(); assertEquals(2,_effect.getSteps().size()); assertCall(_effect,0,_s3b.getExitSequence()); assertCall(_effect,1,_s3b2.getEnterSequences().get(0)); }
Local transition within a region with orthogonal siblings does not have to invoke sibling region entries or exists.
private void syncBackupsInDBWithExistingOnes(){ List<BackupEntry> realBackups=sdfsStateService.getBackupsFromSDFSMountPoint(); List<BackupEntry> backupEntries=backupRepository.findAll(); List<BackupEntry> toRemove=new ArrayList<>(); backupEntries.stream().filter(null).peek(null).forEach(null); backupRepository.delete(toRemove); List<BackupEntry> toAdd=new ArrayList<>(); realBackups.stream().filter(null).peek(null).forEach(null); backupRepository.save(toAdd); }
There can be situations when user removed/added backups after system backup and than decided to migrate to another instance, in this case backups will not be in consistent state
public ClassMemberValue(String className,ConstPool cp){ super('c',cp); setValue(className); }
Constructs a class value.
public void teleportCheckpoint(Player player){ for (int index=checkpoints.size() - 1; index >= 0; index--) { Checkpoint checkpoint=checkpoints.get(index); if (checkpoint.isActivated()) { player.teleport(checkpoint.getLocation()); return; } } player.teleport(spawns.get(0)); }
Teleports a player to a checkpoint if they are activated. We reverse the search so we don't teleport them to multiple checkpoints
public synchronized void insert(double _priority,Object _data){ numElements++; if (numElements == queue.length) { PriorityQueueNode[] tmp=new PriorityQueueNode[(int)(queue.length * 1.5)]; System.arraycopy(queue,0,tmp,0,queue.length); for (int i=queue.length; i < tmp.length; i++) { tmp[i]=new PriorityQueueNode(); } queue=tmp; } queue[numElements].data=_data; queue[numElements].priority=_priority; reheapify(numElements); }
Insert the object passed with the priority value passed
private void validateTaskSubStageProgression(DeleteVirtualNetworkWorkflowDocument.TaskState startState,DeleteVirtualNetworkWorkflowDocument.TaskState patchState){ if (patchState.stage.ordinal() > TaskState.TaskStage.FINISHED.ordinal()) { return; } if (patchState.stage == TaskState.TaskStage.FINISHED) { Preconditions.checkState(startState.stage == TaskState.TaskStage.STARTED && (startState.subStage == DeleteVirtualNetworkWorkflowDocument.TaskState.SubStage.DELETE_NETWORK_ENTITY || startState.subStage == DeleteVirtualNetworkWorkflowDocument.TaskState.SubStage.CHECK_VM_EXISTENCE)); } if (patchState.stage == TaskState.TaskStage.STARTED) { Preconditions.checkState(patchState.subStage.ordinal() == startState.subStage.ordinal() + 1 || patchState.subStage == startState.subStage); } }
Validate the substage progresses correctly.
public RandomFilterParser(Element element) throws FilterException { String chanceProperty=element.getText(); if (chanceProperty == null) { throw new MissingFilterPropertyException("chance",element); } if (Numbers.isDecimal(chanceProperty)) { chance=Numbers.parseDouble(chanceProperty); } else { if (chanceProperty.contains("\\,")) { String[] range=chanceProperty.replaceAll("\\(","").replaceAll("\\)","").replaceAll("\\[","").replaceAll("\\]","").split(","); if (Numbers.isDecimal(range[0]) && Numbers.isDecimal(range[1])) { chance=Numbers.parseDouble(range[1]) - Numbers.parseDouble(range[0]); } else { throw new InvalidFilterPropertyException("chance",element); } } else { throw new InvalidFilterPropertyException("chance",element); } } }
Parses an element for a random filter.
public ScanQuery(){ this(null,null); }
Create scan query returning all entries.
public static AndroidHttpClient newInstance(String userAgent){ return newInstance(userAgent,null); }
Create a new HttpClient with reasonable defaults (which you can update).
public boolean updatePointByPoint(Point scaledPoint){ boolean changeMade=!scaledPoint.equals(potentialControlPoint); potentialControlPoint=scaledPoint; if (componentSlot != null && !componentSlot.isEmpty()) { componentSlot.get(0).setControlPoint(scaledPoint,1); } return changeMade; }
Updates component in the slot with the new second control point.
public void testNextDoubleBounded2(){ SplittableRandom sr=new SplittableRandom(); for (double least=0.0001; least < 1.0e20; least*=8) { for (double bound=least * 1.001; bound < 1.0e20; bound*=16) { double f=sr.nextDouble(least,bound); assertTrue(least <= f && f < bound); int i=0; double j; while (i < NCALLS && (j=sr.nextDouble(least,bound)) == f) { assertTrue(least <= j && j < bound); ++i; } assertTrue(i < NCALLS); } } }
nextDouble(least, bound) returns least <= value < bound; repeated calls produce at least two distinct results
final void signal(){ synchronized (this) { if (state == State.READY) { state=State.SIGNALLED; watcher.enqueueKey(this); } } }
Enqueues this key to the watch service
public int size(int taskId){ return readTasks.get(taskId).size(); }
Returns the current queue size.
private void registerFitDataListener(FitDataTypeSetting dataTypeSetting,OnDataPointListener listener){ sensorsAwaitingRegistration.add(dataTypeSetting); Fitness.SensorsApi.add(mGoogleApiClient,new SensorRequest.Builder().setDataType(dataTypeSetting.getDataType()).setSamplingRate(dataTypeSetting.getSamplingRateSeconds(),TimeUnit.SECONDS).setAccuracyMode(dataTypeSetting.getAccuracyMode()).build(),listener).setResultCallback(new FitResultCallback<Status>(this,FitResultCallback.RegisterType.SENSORS,dataTypeSetting.getDataType(),true)); }
Add SensorsApi listener for real-time display of sensor data. Can be called repeatedly on multiple data types.
public void translateTexts(){ String labelText=Localization.Main.getText(localizationKey + ".label"); if (labelText.endsWith("label")) labelText=Localization.Main.getText(localizationKey); if (labelText.equals(localizationKey)) labelText=""; String tooltipText=Localization.Main.getText(localizationKey + ".tooltip"); if (tooltipText.endsWith(".tooltip")) tooltipText=""; if (guiLabelField != null) { if (guiLabelField instanceof JButton) { ((JButton)guiLabelField).setText(labelText); } else if (guiLabelField instanceof JLabel) { ((JLabel)guiLabelField).setText(labelText); } else if (guiLabelField instanceof JTextField) { ((JTextField)guiLabelField).setText(labelText); } else if (guiLabelField instanceof JCheckBox) { ((JCheckBox)guiLabelField).setText(labelText); } else if (guiLabelField instanceof JTabbedPane) { int tabIndex=-1 + (localizationKey.charAt(localizationKey.length() - 1)) - '0'; ((JTabbedPane)guiLabelField).setTitleAt(tabIndex,labelText); } else if (guiLabelField instanceof JMenuItem) { ((JMenuItem)guiLabelField).setText(labelText); } else { logger.error("setTranslateTexta: Cannot handle the type for LocalizationKey=" + localizationKey); return; } } if (Helper.isNotNullOrEmpty(tooltipText)) { if (guiLabelField != null) guiLabelField.setToolTipText(tooltipText); if (guiValueField != null) guiValueField.setToolTipText(tooltipText); } }
Apply the localization for the given field(s)
public Statement copyInline(Context ctx,boolean valNeeded){ CompoundStatement s=(CompoundStatement)clone(); s.args=new Statement[args.length]; for (int i=0; i < args.length; i++) { s.args[i]=args[i].copyInline(ctx,valNeeded); } return s; }
Create a copy of the statement for method inlining
public double[] asDegreesArray(){ return new double[]{this.getLatitude().degrees,this.getLongitude().degrees}; }
Returns an array of this object's latitude and longitude in degrees.
@Override public void computeDerivatives(final double time,final double[] y,final double[] ydot) throws MaxCountExceededException, DimensionMismatchException { assignValue(currentScope,time,y); final Map<Integer,IAgent> equaAgents=getEquationAgents(currentScope); for (int i=0, n=getDimension(); i < n; i++) { try { final ExecutionResult result=currentScope.execute(equations.get(i),equaAgents.get(i),null); ydot[i]=Cast.asFloat(currentScope,result.getValue()); } catch ( final Throwable e2) { GAMA.reportAndThrowIfNeeded(currentScope,GamaRuntimeException.create(e2,currentScope),true); } } }
This method is bound to be called by the integrator of the equations system (instantiated in SolveStatement).
protected void initBPOrderDetails(int C_BPartner_ID,boolean forInvoice){ log.config("C_BPartner_ID=" + C_BPartner_ID); KeyNamePair pp=new KeyNamePair(0,""); orderField.removeActionListener(this); orderField.removeAllItems(); orderField.addItem(pp); ArrayList<KeyNamePair> list=loadOrderData(C_BPartner_ID,forInvoice,sameWarehouseCb.isSelected()); for ( KeyNamePair knp : list) orderField.addItem(knp); orderField.setSelectedIndex(0); orderField.addActionListener(this); initBPDetails(C_BPartner_ID); }
Load PBartner dependent Order/Invoice/Shipment Field.
private void initialize(Properties props){ this.autoConnect=validateBoolean(props.getProperty(AUTO_CONNECT_NAME),DEFAULT_AUTO_CONNECT); this.httpEnabled=validateBoolean(props.getProperty(HTTP_ENABLED_NAME),DEFAULT_HTTP_ENABLED); this.httpBindAddress=validateHttpBindAddress(props.getProperty(HTTP_BIND_ADDRESS_NAME)); this.httpPort=validateHttpPort(props.getProperty(HTTP_PORT_NAME)); this.rmiEnabled=validateBoolean(props.getProperty(RMI_ENABLED_NAME),DEFAULT_RMI_ENABLED); this.rmiRegistryEnabled=validateBoolean(props.getProperty(RMI_REGISTRY_ENABLED_NAME),DEFAULT_RMI_REGISTRY_ENABLED); this.rmiBindAddress=validateRmiBindAddress(props.getProperty(RMI_BIND_ADDRESS_NAME)); this.rmiPort=validateRmiPort(props.getProperty(RMI_PORT_NAME)); this.rmiServerPort=validateRmiServerPort(props.getProperty(RMI_SERVER_PORT_NAME)); this.snmpEnabled=validateBoolean(props.getProperty(SNMP_ENABLED_NAME),DEFAULT_SNMP_ENABLED); this.snmpDirectory=validateSnmpDirectory(props.getProperty(SNMP_DIRECTORY_NAME)); this.agentSSLEnabled=validateBoolean(props.getProperty(AGENT_SSL_ENABLED_NAME),DEFAULT_AGENT_SSL_ENABLED); this.agentSSLProtocols=validateNonEmptyString(props.getProperty(AGENT_SSL_PROTOCOLS_NAME),DEFAULT_AGENT_SSL_PROTOCOLS); this.agentSSLCiphers=validateNonEmptyString(props.getProperty(AGENT_SSL_CIPHERS_NAME),DEFAULT_AGENT_SSL_CIPHERS); this.agentSSLRequireAuth=validateBoolean(props.getProperty(AGENT_SSL_REQUIRE_AUTHENTICATION_NAME),DEFAULT_AGENT_SSL_REQUIRE_AUTHENTICATION); this.httpSSLRequireAuth=validateBoolean(props.getProperty(HTTP_SSL_REQUIRE_AUTHENTICATION_NAME),DEFAULT_HTTP_SSL_REQUIRE_AUTHENTICATION); this.httpAuthEnabled=validateBoolean(props.getProperty(HTTP_AUTHENTICATION_ENABLED_NAME),DEFAULT_HTTP_AUTHENTICATION_ENABLED); this.httpAuthUser=validateNonEmptyString(props.getProperty(HTTP_AUTHENTICATION_USER_NAME),DEFAULT_HTTP_AUTHENTICATION_USER); this.httpAuthPassword=validateNonEmptyString(props.getProperty(HTTP_AUTHENTICATION_PASSWORD_NAME),DEFAULT_HTTP_AUTHENTICATION_PASSWORD); this.sslEnabled=validateBoolean(props.getProperty(CLUSTER_SSL_ENABLED),DEFAULT_SSL_ENABLED); this.sslProtocols=validateNonEmptyString(props.getProperty(CLUSTER_SSL_PROTOCOLS),DEFAULT_SSL_PROTOCOLS); this.sslCiphers=validateNonEmptyString(props.getProperty(CLUSTER_SSL_CIPHERS),DEFAULT_SSL_CIPHERS); this.sslAuthenticationRequired=validateBoolean(props.getProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION),DEFAULT_SSL_REQUIRE_AUTHENTICATION); this.sslProperties=new Properties(); for (int i=0; true; i++) { String key="ssl-property-" + i; String value=props.getProperty(key); if (value == null) { break; } StringTokenizer st=new StringTokenizer(value,"="); if (!st.hasMoreTokens()) { break; } String propKey=st.nextToken(); if (!st.hasMoreTokens()) { break; } String propValue=st.nextToken(); this.sslProperties.put(propKey,propValue); } this.isEmailNotificationEnabled=validateBoolean(props.getProperty(AgentConfig.EMAIL_NOTIFICATIONS_ENABLED_NAME),DEFAULT_EMAIL_NOTIFICATIONS_ENABLED); this.emailNotificationHostName=validateNonEmptyString(props.getProperty(AgentConfig.EMAIL_NOTIFICATIONS_HOST_NAME),DEFAULT_EMAIL_HOST); this.emailNotificationFrom=validateNonEmptyString(props.getProperty(AgentConfig.EMAIL_NOTIFICATIONS_FROM_NAME),DEFAULT_EMAIL_FROM); this.emailNotificationToList=validateNonEmptyString(props.getProperty(AgentConfig.EMAIL_NOTIFICATIONS_TO_LIST_NAME),DEFAULT_EMAIL_TO_LIST); this.stateSaveFile=validateNonEmptyString(props.getProperty(AgentConfig.STATE_SAVE_FILE_NAME),DEFAULT_STATE_SAVE_FILE); try { for (int i=0; true; i++) { String hostProp=props.getProperty(LOCATOR_HOST_NAME + i); if (isEmpty(hostProp)) { break; } String host=hostProp; int port=Integer.parseInt(props.getProperty(LOCATOR_PORT_NAME + i)); File workDir=validateWorkingDirectory(props.getProperty(LOCATOR_WORKING_DIRECTORY_NAME + i)); File prodDir=new File(validateProductDirectory(props.getProperty(LOCATOR_PRODUCT_DIRECTORY_NAME + i))); String remoteCmd=props.getProperty(LOCATOR_REMOTE_COMMAND + i); String bindAddr=props.getProperty(LOCATOR_BIND_ADDRESS + i); DistributionLocatorConfig config=this.createDistributionLocatorConfig(); config.setHost(host); config.setPort(port); config.setBindAddress(bindAddr); config.setWorkingDirectory(workDir.getAbsolutePath()); config.setProductDirectory(prodDir.getAbsolutePath()); config.setRemoteCommand(remoteCmd); } } catch ( IllegalArgumentException e) { e.printStackTrace(); } }
Initialize the values of this AgentConfig.
@Override public void removeListener(final IEventLayerListener listener){ listeners.remove(listener); }
Method removeMouseListener()
public int memberOf(){ return theType.memberOf(); }
Return the member-of vector of the element's type. Convenience method.
protected void checkForCompletion(FragmentBuilder builder,Node node){ if (builder.isComplete()) { if (node != null) { Trace trace=builder.getTrace(); if (builder.getLevel().ordinal() <= ReportingLevel.None.ordinal()) { if (log.isLoggable(Level.FINEST)) { log.finest("Not recording trace (level=" + builder.getLevel() + "): "+ trace); } } else { if (trace != null && !trace.getNodes().isEmpty()) { if (log.isLoggable(Level.FINEST)) { log.finest("Record trace: " + trace); } if (trace.getNodes().size() > 1 && trace.getNodes().get(0).getClass() == Consumer.class && ((Consumer)trace.getNodes().get(0)).getEndpointType() == null) { Consumer consumer=(Consumer)trace.getNodes().get(0); while (trace.getNodes().size() > 1) { consumer.getNodes().add(trace.getNodes().get(1)); trace.getNodes().remove(1); } } reporter.report(trace); } } } fragmentManager.clear(); for ( String id : builder.getUncompletedCorrelationIds()) { correlations.remove(id); } diagnostics(); } }
This method checks whether the supplied fragment has been completed and therefore should be processed.
@Override public void acceptDataSet(DataSetEvent e){ m_receivedStopNotification=false; TrainingSetEvent tse=new TrainingSetEvent(this,e.getDataSet()); tse.m_setNumber=1; tse.m_maxSetNumber=1; notifyTrainingSetProduced(tse); }
Accept a data set
@SuppressWarnings("static-access") private void resetUser(boolean isSource,String newUser){ String user=null; if (isSource) { if (newUser == null) { user=s_parameters.getSourceUser(); } else if (newUser.length() == 0) { user=m_sourceUser.getText(); ; } else { user=newUser; } m_sourceUser.setText(user); m_sourceUserOld=user; } else { if (newUser == null) { user=s_parameters.getTargetUser(); } else if (newUser.length() == 0) { user=m_targetUser.getText(); } else { user=newUser; } m_targetUser.setText(user); m_targetUserOld=user; } }
resets the user
void drawImageArea(Image img,int x,int y,int imageX,int imageY,int imageWidth,int imageHeight){ img.drawImageArea(this,nativeGraphics,x,y,imageX,imageY,imageWidth,imageHeight); }
Draws a region of an image in the given x/y coordinate
@Override public void update(BasicCamera camera){ scale=camera.getPixelSizeAt(getWorldTranslation(),true) * PIXEL_SIZE; if (Math.abs(scale - oldScale) > 0.0000001) { oldScale=scale; if (autoScale) { scaleShape(scale); } } }
Update size based on camera location
private static String formatEntry(long ts,String threadName,long threadId,Object... data){ return "<" + DEBUG_DATE_FMT.format(new Date(ts)) + "><~DBG~><"+ threadName+ " id:"+ threadId+ "> "+ Arrays.deepToString(data); }
Formats log entry string.
public void overwriteSeries(String key,double[] values,int bins){ addSeries(key,values,bins); }
Add new values to an existing series. Overwrites the old data. The value set will be sorted after this method completes.
protected static final String addEscapes(String str){ StringBuffer retval=new StringBuffer(); char ch; for (int i=0; i < str.length(); i++) { switch (str.charAt(i)) { case 0: continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default : if ((ch=str.charAt(i)) < 0x20 || ch > 0x7e) { String s="0000" + Integer.toString(ch,16); retval.append("\\u" + s.substring(s.length() - 4,s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); }
Replaces unprintable characters by their escaped (or unicode escaped) equivalents in the given string
public LogConnection connect(boolean readonly) throws ReplicatorException { LogConnection client=new LogConnection(this,readonly); if (logger.isDebugEnabled()) logger.debug("Client connect to log: connection=" + client.toString()); connectionManager.store(client); return client; }
Creates a new log connection.
public MaterializeBuilder withContainerLayoutParams(ViewGroup.LayoutParams layoutParams){ this.mContainerLayoutParams=layoutParams; return this; }
set the layout params for the container which will host the ScrimInsetsFrameLayout
public boolean isLoading(){ return !m_allLoaded; }
Is loading
private boolean isValueSupported(Object value){ for (int i=0; i < values.length; i++) { if (value.equals(values[i])) { return true; } } return false; }
Indicates whether the value specified is supported.
public SimpleMetadataReaderFactory(ResourceLoader resourceLoader){ this.resourceLoader=(resourceLoader != null ? resourceLoader : new DefaultResourceLoader()); }
Create a new SimpleMetadataReaderFactory for the given resource loader.
public static boolean equalsIncludingNaN(double x,double y,double eps){ return equalsIncludingNaN(x,y) || (FastMath.abs(y - x) <= eps); }
Returns true if both arguments are NaN or are equal or within the range of allowed error (inclusive).
public <D,E extends Element>ElementMetadata<D,E> bind(ElementKey<D,E> key){ return bind(null,key,null); }
Returns the default metadata for the element key.
public boolean isActive(){ return isActive; }
Returns true if this user is the active user and false otherwise.
private void remove(ThreadGroup g){ synchronized (groups) { for (Iterator<ThreadGroup> i=groups.iterator(); i.hasNext(); ) { ThreadGroup threadGroup=i.next(); if (threadGroup.equals(g)) { i.remove(); break; } } } destroyIfEmptyDaemon(); }
Removes an immediate subgroup.
public EditableOMText(OMText omc){ setGraphic(omc); }
Create the EditableOMText with an OMText already defined, ready for editing.
public StateData(Object parent,Object region,S state,Collection<E> deferred,Collection<? extends Action<S,E>> entryActions,Collection<? extends Action<S,E>> exitActions,boolean initial){ this.state=state; this.deferred=deferred; this.entryActions=entryActions; this.exitActions=exitActions; this.parent=parent; this.region=region; this.initial=initial; }
Instantiates a new state data.
@Override protected ArrayList<String> collectQueryParameters(){ ArrayList<String> params=new ArrayList<String>(); params.add("event_id=" + _eventId); params.add("logNames=" + _logNames); params.add("severity=" + _severity); params.add("start=" + _start); params.add("end=" + _end); params.add("nodeIds=" + _nodeIds); params.add("msgRegex=" + _msgRegex); params.add("maxCount=" + maxCount); return params; }
Constructs String of query parameters used
public boolean isEmpty(){ return empty; }
is this transaction empty?
public final void add(TXCommitMessage msg){ synchronized (this.txInProgress) { final Object key=msg.getTrackerKey(); if (key == null) { Assert.assertTrue(false,"TXFarSideCMTracker must have a non-null key for message " + msg); } this.txInProgress.put(key,msg); this.txInProgress.notifyAll(); } }
The transcation commit message has been received
@Override public Statement createStatement(int resultSetType,int resultSetConcurrency,int resultSetHoldability) throws SQLException { try { int id=getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement",TraceObject.STATEMENT,id,"createStatement(" + resultSetType + ", "+ resultSetConcurrency+ ", "+ resultSetHoldability+ ")"); } checkTypeConcurrency(resultSetType,resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); return new JdbcStatement(this,id,resultSetType,resultSetConcurrency,false); } catch ( Exception e) { throw logAndConvert(e); } }
Creates a statement with the specified result set type, concurrency, and holdability.
public DragTrustedCertificateEntry(String name,Certificate trustedCertificate) throws CryptoException { super(name); contentStr=X509CertUtil.getCertEncodedX509Pem(X509CertUtil.convertCertificate(trustedCertificate)); contentBytes=contentStr.getBytes(); image=new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("DragTrustedCertificateEntry.Drag.image")))); }
Construct DragTrustedCertificateEntry.
public boolean decodeUintvarInteger(int startIndex){ int index=startIndex; mUnsigned32bit=0; while ((mWspData[index] & 0x80) != 0) { if ((index - startIndex) >= 4) { return false; } mUnsigned32bit=(mUnsigned32bit << 7) | (mWspData[index] & 0x7f); index++; } mUnsigned32bit=(mUnsigned32bit << 7) | (mWspData[index] & 0x7f); mDataLength=index - startIndex + 1; return true; }
Decode the "Uintvar-integer" type for WSP pdu
public static void buildEventsFromCursor(ArrayList<Event> events,Cursor cEvents,Context context,int startDay,int endDay){ if (cEvents == null || events == null) { Log.e(TAG,"buildEventsFromCursor: null cursor or null events list!"); return; } int count=cEvents.getCount(); if (count == 0) { return; } Resources res=context.getResources(); mNoTitleString=res.getString(R.string.no_title_label); mNoColorColor=res.getColor(R.color.event_center); cEvents.moveToPosition(-1); while (cEvents.moveToNext()) { Event e=generateEventFromCursor(cEvents); if (e.startDay > endDay || e.endDay < startDay) { continue; } events.add(e); } }
Adds all the events from the cursors to the events list.
public String flatten(){ flattenAsMap(); if (flattenedMap.containsKey(ROOT)) return javaObj2Json(flattenedMap.get(ROOT)); else return flattenedMap.toString(printMode); }
Returns a flattened JSON string.
public static OutputStream newBZFileOutputStream(String file,boolean useGzip,boolean useOBuffers,int buffersize) throws IOException { return newBZFileOutputStream(file,useGzip,useOBuffers,buffersize,false); }
Constructs an output stream to a file
static void check(PublicKey key,AlgorithmId algorithmId) throws CertPathValidatorException { String sigAlgName=algorithmId.getName(); AlgorithmParameters sigAlgParams=algorithmId.getParameters(); if (!certPathDefaultConstraints.permits(SIGNATURE_PRIMITIVE_SET,sigAlgName,key,sigAlgParams)) { throw new CertPathValidatorException("algorithm check failed: " + sigAlgName + " is disabled",null,null,-1,BasicReason.ALGORITHM_CONSTRAINED); } }
Check the signature algorithm with the specified public key.
public long lengthSquared(){ return x * x + y * y; }
Return the length squared of this vector.
private void addAuthors(Document doc,Eml eml) throws DocumentException { HashSet<Agent> tempAgents=new LinkedHashSet<Agent>(); for ( Agent creator : eml.getCreators()) { if (!Strings.isNullOrEmpty(creator.getLastName())) { tempAgents.add(creator); } } for ( Agent metadataProvider : eml.getMetadataProviders()) { if (!Strings.isNullOrEmpty(metadataProvider.getLastName())) { tempAgents.add(metadataProvider); } } for ( Agent party : eml.getAssociatedParties()) { if (!Strings.isNullOrEmpty(party.getLastName())) { tempAgents.add(party); } } Collection<Integer> toRemove=new ArrayList<Integer>(); int counter=0; for (Iterator<Agent> i=tempAgents.iterator(); i.hasNext(); counter++) { if (toRemove.contains(counter)) { i.next(); i.remove(); } else { Agent agentA=i.next(); boolean flag=false; int countTemp=0; for (Iterator<Agent> j=tempAgents.iterator(); j.hasNext(); countTemp++) { Agent agentB=j.next(); if (flag) { if (equal(agentA.getLastName(),agentB.getLastName()) && equal(agentA.getFirstName(),agentB.getFirstName()) && equal(agentA.getAddress(),agentB.getAddress())) { toRemove.add(countTemp); } } else if (agentA.equals(agentB)) { flag=true; } } } } Agent[] agentsArray=new Agent[tempAgents.size()]; tempAgents.toArray(agentsArray); Paragraph p=new Paragraph(); p.setFont(font); p.setAlignment(Element.ALIGN_CENTER); java.util.List<Agent> affiliations=new ArrayList<Agent>(); int superScriptCounter=1; for (int c=0; c < agentsArray.length; c++) { if (exists(agentsArray[c].getLastName())) { if (c != 0) { p.add(", "); } if (exists(agentsArray[c].getFirstName())) { p.add(agentsArray[c].getFirstName() + " "); } p.add(agentsArray[c].getLastName()); boolean isRepeated=false; for (int index=0; index < affiliations.size(); index++) { if (equal(agentsArray[c].getAddress(),affiliations.get(index).getAddress()) && equal(agentsArray[c].getOrganisation(),affiliations.get(index).getOrganisation())) { p.add(createSuperScript(String.valueOf(index + 1))); isRepeated=true; break; } } if (!isRepeated) { p.add(createSuperScript(String.valueOf(superScriptCounter))); affiliations.add(agentsArray[c]); superScriptCounter++; } } } doc.add(p); p.clear(); doc.add(Chunk.NEWLINE); tempAgents.clear(); p=new Paragraph(); p.setFont(font); p.setAlignment(Element.ALIGN_JUSTIFIED); for (int c=0; c < affiliations.size(); c++) { if (c != 0) { p.add("; "); } p.add((c + 1) + " "); if (exists(affiliations.get(c).getOrganisation())) { p.add(affiliations.get(c).getOrganisation() + ", "); } if (exists(affiliations.get(c).getAddress().getAddress())) { p.add(affiliations.get(c).getAddress().getAddress() + ", "); } if (exists(affiliations.get(c).getAddress().getPostalCode())) { p.add(affiliations.get(c).getAddress().getPostalCode() + ", "); } if (exists(affiliations.get(c).getAddress().getCity())) { p.add(affiliations.get(c).getAddress().getCity()); } if (exists(affiliations.get(c).getAddress().getCountry())) { VocabularyConcept concept=vocabManager.get(Constants.VOCAB_URI_COUNTRY).findConcept(affiliations.get(c).getAddress().getCountry()); if (exists(concept)) { p.add(", " + WordUtils.capitalizeFully(concept.getPreferredTerm(DEFAULT_LANGUAGE).getTitle())); } else { p.add(", " + WordUtils.capitalizeFully(affiliations.get(c).getAddress().getCountry())); } } } doc.add(p); p.clear(); doc.add(Chunk.NEWLINE); p=new Paragraph(); p.setAlignment(Element.ALIGN_JUSTIFIED); p.add(new Phrase(getText("rtf.authors") + ": ",fontTitle)); p.setFont(font); boolean isFirst=true; for ( Agent creator : eml.getCreators()) { if (!Strings.isNullOrEmpty(creator.getFirstName())) { p.add(creator.getFirstName() + " "); } p.add(creator.getLastName()); if (!Strings.isNullOrEmpty(creator.getEmail())) { p.add(" (" + creator.getEmail() + ")"); } isFirst=false; } for ( Agent metadataProvider : eml.getMetadataProviders()) { boolean sameAsCreator=false; for ( Agent creator : eml.getCreators()) { if (equal(metadataProvider.getAddress(),creator.getAddress()) && equal(metadataProvider.getEmail(),creator.getEmail())) { sameAsCreator=true; break; } } if (!sameAsCreator) { if (!isFirst) { p.add(", "); } if (!Strings.isNullOrEmpty(metadataProvider.getFirstName())) { p.add(metadataProvider.getFirstName() + " "); } p.add(metadataProvider.getLastName()); if (!Strings.isNullOrEmpty(metadataProvider.getEmail())) { p.add(" (" + metadataProvider.getEmail() + ")"); } isFirst=false; } } p.add(Chunk.NEWLINE); doc.add(p); p.clear(); }
Add authors section.
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException { if ("Topic".equals(qName)) { curSection=atts.getValue("r:id"); } else if ("ExternalPage".equals(qName)) { if ((!includeAdult) && curSection.startsWith("Top/Adult")) { return; } if (topicPattern != null && !topicPattern.matcher(curSection).matches()) { return; } String url=atts.getValue("about"); int hashValue=MD5Hash.digest(url).hashCode(); hashValue=Math.abs(hashValue ^ hashSkew); if ((hashValue % subsetDenom) != 0) { return; } curURL=url; } else if (curURL != null && "d:Title".equals(qName)) { titlePending=true; } else if (curURL != null && "d:Description".equals(qName)) { descPending=true; } }
Start of an XML elt
public void java_lang_Package_getSystemPackage0(SootMethod method,ReferenceVariable thisVar,ReferenceVariable returnVar,ReferenceVariable params[]){ helper.assignObjectTo(returnVar,Environment.v().getStringObject()); }
This is an undocumented private native method, it returns the first (without caller) method's package. It should be formulated as a string constants. private static native java.lang.String getSystemPackage0(java.lang.String);
public UserConfig fetch(UserConfig config){ config.addCredentials(this); String xml=POST(this.url + "/check-user",config.toXML()); Element root=parse(xml); if (root == null) { return null; } try { UserConfig user=new UserConfig(); user.parseXML(root); return user; } catch ( Exception exception) { this.exception=SDKException.parseFailure(exception); throw this.exception; } }
Fetch the user details for the user credentials. A token or password is required to validate the user.
@Inline public static boolean mightBeTIB(ObjectReference obj){ return !obj.isNull() && Space.isMappedObject(obj) && Space.isMappedObject(ObjectReference.fromObject(ObjectModel.getTIB(obj))); }
Check if object might be a TIB.
private boolean endsWithPossessive(int pos){ return (stemEnglishPossessive && pos > 2 && text[pos - 2] == '\'' && (text[pos - 1] == 's' || text[pos - 1] == 'S') && isAlpha(charType(text[pos - 3])) && (pos == endBounds || isSubwordDelim(charType(text[pos])))); }
Determines if the text at the given position indicates an English possessive which should be removed
public Object jjtAccept(SyntaxTreeBuilderVisitor visitor,Object data) throws VisitorException { return visitor.visit(this,data); }
Accept the visitor.
public boolean isWrap(){ return wrap != null; }
Returns if the flow should wrap to the next line/column <b>after</b> the component that this constraint belongs to. <p> For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
public void enableFiltering(Approximator a){ mFilterData=true; }
Enables data filtering for the chart data, filtering will use the user customized Approximator handed over to this method.
protected void drawItemPass0(Graphics2D x_graphics,Rectangle2D x_dataArea,PlotRenderingInfo x_info,XYPlot x_plot,ValueAxis x_domainAxis,ValueAxis x_rangeAxis,XYDataset x_dataset,int x_series,int x_item,CrosshairState x_crosshairState){ if (!((0 == x_series) && (0 == x_item))) { return; } boolean b_impliedZeroSubtrahend=(1 == x_dataset.getSeriesCount()); if (isEitherSeriesDegenerate(x_dataset,b_impliedZeroSubtrahend)) { return; } if (!b_impliedZeroSubtrahend && areSeriesDisjoint(x_dataset)) { return; } LinkedList l_minuendXs=new LinkedList(); LinkedList l_minuendYs=new LinkedList(); LinkedList l_subtrahendXs=new LinkedList(); LinkedList l_subtrahendYs=new LinkedList(); LinkedList l_polygonXs=new LinkedList(); LinkedList l_polygonYs=new LinkedList(); int l_minuendItem=0; int l_minuendItemCount=x_dataset.getItemCount(0); Double l_minuendCurX=null; Double l_minuendNextX=null; Double l_minuendCurY=null; Double l_minuendNextY=null; double l_minuendMaxY=Double.NEGATIVE_INFINITY; double l_minuendMinY=Double.POSITIVE_INFINITY; int l_subtrahendItem=0; int l_subtrahendItemCount=0; Double l_subtrahendCurX=null; Double l_subtrahendNextX=null; Double l_subtrahendCurY=null; Double l_subtrahendNextY=null; double l_subtrahendMaxY=Double.NEGATIVE_INFINITY; double l_subtrahendMinY=Double.POSITIVE_INFINITY; if (b_impliedZeroSubtrahend) { l_subtrahendItem=0; l_subtrahendItemCount=2; l_subtrahendCurX=new Double(x_dataset.getXValue(0,0)); l_subtrahendNextX=new Double(x_dataset.getXValue(0,(l_minuendItemCount - 1))); l_subtrahendCurY=new Double(0.0); l_subtrahendNextY=new Double(0.0); l_subtrahendMaxY=0.0; l_subtrahendMinY=0.0; l_subtrahendXs.add(l_subtrahendCurX); l_subtrahendYs.add(l_subtrahendCurY); } else { l_subtrahendItemCount=x_dataset.getItemCount(1); } boolean b_minuendDone=false; boolean b_minuendAdvanced=true; boolean b_minuendAtIntersect=false; boolean b_minuendFastForward=false; boolean b_subtrahendDone=false; boolean b_subtrahendAdvanced=true; boolean b_subtrahendAtIntersect=false; boolean b_subtrahendFastForward=false; boolean b_colinear=false; boolean b_positive; double l_x1=0.0, l_y1=0.0; double l_x2=0.0, l_y2=0.0; double l_x3=0.0, l_y3=0.0; double l_x4=0.0, l_y4=0.0; boolean b_fastForwardDone=false; while (!b_fastForwardDone) { l_x1=x_dataset.getXValue(0,l_minuendItem); l_y1=x_dataset.getYValue(0,l_minuendItem); l_x2=x_dataset.getXValue(0,l_minuendItem + 1); l_y2=x_dataset.getYValue(0,l_minuendItem + 1); l_minuendCurX=new Double(l_x1); l_minuendCurY=new Double(l_y1); l_minuendNextX=new Double(l_x2); l_minuendNextY=new Double(l_y2); if (b_impliedZeroSubtrahend) { l_x3=l_subtrahendCurX.doubleValue(); l_y3=l_subtrahendCurY.doubleValue(); l_x4=l_subtrahendNextX.doubleValue(); l_y4=l_subtrahendNextY.doubleValue(); } else { l_x3=x_dataset.getXValue(1,l_subtrahendItem); l_y3=x_dataset.getYValue(1,l_subtrahendItem); l_x4=x_dataset.getXValue(1,l_subtrahendItem + 1); l_y4=x_dataset.getYValue(1,l_subtrahendItem + 1); l_subtrahendCurX=new Double(l_x3); l_subtrahendCurY=new Double(l_y3); l_subtrahendNextX=new Double(l_x4); l_subtrahendNextY=new Double(l_y4); } if (l_x2 <= l_x3) { l_minuendItem++; b_minuendFastForward=true; continue; } if (l_x4 <= l_x1) { l_subtrahendItem++; b_subtrahendFastForward=true; continue; } if ((l_x3 < l_x1) && (l_x1 < l_x4)) { double l_slope=(l_y4 - l_y3) / (l_x4 - l_x3); l_subtrahendCurX=l_minuendCurX; l_subtrahendCurY=new Double((l_slope * l_x1) + (l_y3 - (l_slope * l_x3))); l_subtrahendXs.add(l_subtrahendCurX); l_subtrahendYs.add(l_subtrahendCurY); } if ((l_x1 < l_x3) && (l_x3 < l_x2)) { double l_slope=(l_y2 - l_y1) / (l_x2 - l_x1); l_minuendCurX=l_subtrahendCurX; l_minuendCurY=new Double((l_slope * l_x3) + (l_y1 - (l_slope * l_x1))); l_minuendXs.add(l_minuendCurX); l_minuendYs.add(l_minuendCurY); } l_minuendMaxY=l_minuendCurY.doubleValue(); l_minuendMinY=l_minuendCurY.doubleValue(); l_subtrahendMaxY=l_subtrahendCurY.doubleValue(); l_subtrahendMinY=l_subtrahendCurY.doubleValue(); b_fastForwardDone=true; } while (!b_minuendDone && !b_subtrahendDone) { if (!b_minuendDone && !b_minuendFastForward && b_minuendAdvanced) { l_x1=x_dataset.getXValue(0,l_minuendItem); l_y1=x_dataset.getYValue(0,l_minuendItem); l_minuendCurX=new Double(l_x1); l_minuendCurY=new Double(l_y1); if (!b_minuendAtIntersect) { l_minuendXs.add(l_minuendCurX); l_minuendYs.add(l_minuendCurY); } l_minuendMaxY=Math.max(l_minuendMaxY,l_y1); l_minuendMinY=Math.min(l_minuendMinY,l_y1); l_x2=x_dataset.getXValue(0,l_minuendItem + 1); l_y2=x_dataset.getYValue(0,l_minuendItem + 1); l_minuendNextX=new Double(l_x2); l_minuendNextY=new Double(l_y2); } if (!b_impliedZeroSubtrahend && !b_subtrahendDone && !b_subtrahendFastForward&& b_subtrahendAdvanced) { l_x3=x_dataset.getXValue(1,l_subtrahendItem); l_y3=x_dataset.getYValue(1,l_subtrahendItem); l_subtrahendCurX=new Double(l_x3); l_subtrahendCurY=new Double(l_y3); if (!b_subtrahendAtIntersect) { l_subtrahendXs.add(l_subtrahendCurX); l_subtrahendYs.add(l_subtrahendCurY); } l_subtrahendMaxY=Math.max(l_subtrahendMaxY,l_y3); l_subtrahendMinY=Math.min(l_subtrahendMinY,l_y3); l_x4=x_dataset.getXValue(1,l_subtrahendItem + 1); l_y4=x_dataset.getYValue(1,l_subtrahendItem + 1); l_subtrahendNextX=new Double(l_x4); l_subtrahendNextY=new Double(l_y4); } b_minuendFastForward=false; b_subtrahendFastForward=false; Double l_intersectX=null; Double l_intersectY=null; boolean b_intersect=false; b_minuendAtIntersect=false; b_subtrahendAtIntersect=false; if ((l_x2 == l_x4) && (l_y2 == l_y4)) { if ((l_x1 == l_x3) && (l_y1 == l_y3)) { b_colinear=true; } else { l_intersectX=new Double(l_x2); l_intersectY=new Double(l_y2); b_intersect=true; b_minuendAtIntersect=true; b_subtrahendAtIntersect=true; } } else { double l_denominator=((l_y4 - l_y3) * (l_x2 - l_x1)) - ((l_x4 - l_x3) * (l_y2 - l_y1)); double l_deltaY=l_y1 - l_y3; double l_deltaX=l_x1 - l_x3; double l_numeratorA=((l_x4 - l_x3) * l_deltaY) - ((l_y4 - l_y3) * l_deltaX); double l_numeratorB=((l_x2 - l_x1) * l_deltaY) - ((l_y2 - l_y1) * l_deltaX); if ((0 == l_numeratorA) && (0 == l_numeratorB) && (0 == l_denominator)) { b_colinear=true; } else { if (b_colinear) { l_minuendXs.clear(); l_minuendYs.clear(); l_subtrahendXs.clear(); l_subtrahendYs.clear(); l_polygonXs.clear(); l_polygonYs.clear(); b_colinear=false; boolean b_useMinuend=((l_x3 <= l_x1) && (l_x1 <= l_x4)); l_polygonXs.add(b_useMinuend ? l_minuendCurX : l_subtrahendCurX); l_polygonYs.add(b_useMinuend ? l_minuendCurY : l_subtrahendCurY); } } double l_slopeA=l_numeratorA / l_denominator; double l_slopeB=l_numeratorB / l_denominator; boolean b_vertical=(l_x1 == l_x2) && (l_x3 == l_x4) && (l_x2 == l_x4); if (((0 < l_slopeA) && (l_slopeA <= 1) && (0 < l_slopeB)&& (l_slopeB <= 1)) || b_vertical) { double l_xi; double l_yi; if (b_vertical) { b_colinear=false; l_xi=l_x2; l_yi=l_x4; } else { l_xi=l_x1 + (l_slopeA * (l_x2 - l_x1)); l_yi=l_y1 + (l_slopeA * (l_y2 - l_y1)); } l_intersectX=new Double(l_xi); l_intersectY=new Double(l_yi); b_intersect=true; b_minuendAtIntersect=((l_xi == l_x2) && (l_yi == l_y2)); b_subtrahendAtIntersect=((l_xi == l_x4) && (l_yi == l_y4)); l_minuendCurX=l_intersectX; l_minuendCurY=l_intersectY; l_subtrahendCurX=l_intersectX; l_subtrahendCurY=l_intersectY; } } if (b_intersect) { l_polygonXs.addAll(l_minuendXs); l_polygonYs.addAll(l_minuendYs); l_polygonXs.add(l_intersectX); l_polygonYs.add(l_intersectY); Collections.reverse(l_subtrahendXs); Collections.reverse(l_subtrahendYs); l_polygonXs.addAll(l_subtrahendXs); l_polygonYs.addAll(l_subtrahendYs); b_positive=(l_subtrahendMaxY <= l_minuendMaxY) && (l_subtrahendMinY <= l_minuendMinY); createPolygon(x_graphics,x_dataArea,x_plot,x_domainAxis,x_rangeAxis,b_positive,l_polygonXs,l_polygonYs); l_minuendXs.clear(); l_minuendYs.clear(); l_subtrahendXs.clear(); l_subtrahendYs.clear(); l_polygonXs.clear(); l_polygonYs.clear(); double l_y=l_intersectY.doubleValue(); l_minuendMaxY=l_y; l_subtrahendMaxY=l_y; l_minuendMinY=l_y; l_subtrahendMinY=l_y; l_polygonXs.add(l_intersectX); l_polygonYs.add(l_intersectY); } if (l_x2 <= l_x4) { l_minuendItem++; b_minuendAdvanced=true; } else { b_minuendAdvanced=false; } if (l_x4 <= l_x2) { l_subtrahendItem++; b_subtrahendAdvanced=true; } else { b_subtrahendAdvanced=false; } b_minuendDone=(l_minuendItem == (l_minuendItemCount - 1)); b_subtrahendDone=(l_subtrahendItem == (l_subtrahendItemCount - 1)); } if (b_minuendDone && (l_x3 < l_x2) && (l_x2 < l_x4)) { double l_slope=(l_y4 - l_y3) / (l_x4 - l_x3); l_subtrahendNextX=l_minuendNextX; l_subtrahendNextY=new Double((l_slope * l_x2) + (l_y3 - (l_slope * l_x3))); } if (b_subtrahendDone && (l_x1 < l_x4) && (l_x4 < l_x2)) { double l_slope=(l_y2 - l_y1) / (l_x2 - l_x1); l_minuendNextX=l_subtrahendNextX; l_minuendNextY=new Double((l_slope * l_x4) + (l_y1 - (l_slope * l_x1))); } l_minuendMaxY=Math.max(l_minuendMaxY,l_minuendNextY.doubleValue()); l_subtrahendMaxY=Math.max(l_subtrahendMaxY,l_subtrahendNextY.doubleValue()); l_minuendMinY=Math.min(l_minuendMinY,l_minuendNextY.doubleValue()); l_subtrahendMinY=Math.min(l_subtrahendMinY,l_subtrahendNextY.doubleValue()); l_minuendXs.add(l_minuendNextX); l_minuendYs.add(l_minuendNextY); l_subtrahendXs.add(l_subtrahendNextX); l_subtrahendYs.add(l_subtrahendNextY); l_polygonXs.addAll(l_minuendXs); l_polygonYs.addAll(l_minuendYs); Collections.reverse(l_subtrahendXs); Collections.reverse(l_subtrahendYs); l_polygonXs.addAll(l_subtrahendXs); l_polygonYs.addAll(l_subtrahendYs); b_positive=(l_subtrahendMaxY <= l_minuendMaxY) && (l_subtrahendMinY <= l_minuendMinY); createPolygon(x_graphics,x_dataArea,x_plot,x_domainAxis,x_rangeAxis,b_positive,l_polygonXs,l_polygonYs); }
Draws the visual representation of a single data item, first pass.
@Override public void actionPerformed(ActionEvent e){ if (abort()) { return; } WalletData perWalletModelData=super.bitcoinController.getModel().getActivePerWalletModelData(); boolean encryptNewKeys=false; if (super.bitcoinController.getModel().getActiveWallet() != null && super.bitcoinController.getModel().getActiveWallet().getEncryptionType() == EncryptionType.ENCRYPTED_SCRYPT_AES) { if (walletPassword.getPassword() == null || walletPassword.getPassword().length == 0) { createNewReceivingAddressPanel.setMessageText(controller.getLocaliser().getString("showExportPrivateKeysAction.youMustEnterTheWalletPassword")); return; } encryptNewKeys=true; try { if (!super.bitcoinController.getModel().getActiveWallet().checkPassword(CharBuffer.wrap(walletPassword.getPassword()))) { createNewReceivingAddressPanel.setMessageText(controller.getLocaliser().getString("createNewReceivingAddressSubmitAction.passwordIsIncorrect")); return; } } catch ( KeyCrypterException ede) { log.debug(ede.getClass().getCanonicalName() + " " + ede.getMessage()); createNewReceivingAddressPanel.setMessageText(controller.getLocaliser().getString("createNewReceivingAddressSubmitAction.passwordIsIncorrect")); return; } } WalletInfoData walletInfo=perWalletModelData.getWalletInfo(); if (walletInfo == null) { walletInfo=new WalletInfoData(perWalletModelData.getWalletFilename(),perWalletModelData.getWallet(),MultiBitWalletVersion.PROTOBUF_ENCRYPTED); perWalletModelData.setWalletInfo(walletInfo); } if (!perWalletModelData.isBusy()) { perWalletModelData.setBusy(true); perWalletModelData.setBusyTaskKey("createNewReceivingAddressSubmitAction.tooltip"); createNewReceivingAddressPanel.getCancelButton().setEnabled(false); int numberOfAddressesToCreate=createNewReceivingAddressPanel.getNumberOfAddressesToCreate(); String walletDescription=super.bitcoinController.getModel().getActiveWalletWalletInfo().getProperty(WalletInfoData.DESCRIPTION_PROPERTY); String shortMessage=controller.getLocaliser().getString("createNewReceivingAddressSubmitAction.creatingShort",new Object[]{numberOfAddressesToCreate}); String longMessage=controller.getLocaliser().getString("createNewReceivingAddressSubmitAction.creatingLong",new Object[]{numberOfAddressesToCreate,walletDescription}); createNewReceivingAddressPanel.setMessageText(shortMessage); MessageManager.INSTANCE.addMessage(new Message(" ")); Message logMessage=new Message(longMessage); logMessage.setShowInStatusBar(false); MessageManager.INSTANCE.addMessage(logMessage); super.bitcoinController.fireWalletBusyChange(true); createNewReceivingAddressesInBackground(createNewReceivingAddressPanel.getNumberOfAddressesToCreate(),encryptNewKeys,CharBuffer.wrap(walletPassword.getPassword()),this); } }
Create new receiving addresses.
private void deleteJSONManifest(String manifestPath) throws IOException { logger.info("Deleting " + manifestPath); File file=new File(manifestPath); if (file.exists()) if (!file.delete()) throw new IOException("Unable to delete " + manifestPath); }
Removes .manifest.json file form the file system.
public Object trunc(InstanceScope scope,Object v){ if (v == null) return null; if (v instanceof List) { List<?> elems=(List<?>)v; if (elems.size() <= 1) return null; return elems.subList(0,elems.size() - 1); } v=convertAnythingIteratableToIterator(scope,v); if (v instanceof Iterator) { List<Object> a=new ArrayList<Object>(); Iterator<?> it=(Iterator<?>)v; while (it.hasNext()) { Object o=it.next(); if (it.hasNext()) a.add(o); } return a; } return null; }
Return all but the last element. <code>trunc(<i>x</i>)==null</code> if <code><i>x</i></code> is single-valued.
protected Node inlineExternal(Document doc,ParsedURL urldata,Node eold){ File in=new File(urldata.getPath()); if (!in.exists()) { LoggingUtil.warning("Referencing non-existant file: " + urldata.toString()); return null; } ByteArrayOutputStream os=new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder=new Base64EncoderStream(os); FileInputStream instream=new FileInputStream(in); byte[] buf=new byte[4096]; while (true) { int read=instream.read(buf,0,buf.length); if (read <= 0) { break; } encoder.write(buf,0,read); } instream.close(); encoder.close(); } catch ( IOException e) { LoggingUtil.exception("Exception serializing image to png",e); return null; } Element i=(Element)super.cloneNode(doc,eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI,SVGConstants.XLINK_HREF_ATTRIBUTE,os.toString().replaceAll("\\s*[\\r\\n]+\\s*","")); return i; }
Inline an external file (usually from temp).
private UILib(){ }
Not instantiable.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:10.408 -0500",hash_original_method="DB70AA378C6CA75A97E2143D1A039441",hash_generated_method="3A1052EDADDDC32BAF9C16CC5ECEDA67") public static ETC1Texture createTexture(InputStream input) throws IOException { int width=0; int height=0; byte[] ioBuffer=new byte[4096]; { if (input.read(ioBuffer,0,ETC1.ETC_PKM_HEADER_SIZE) != ETC1.ETC_PKM_HEADER_SIZE) { throw new IOException("Unable to read PKM file header."); } ByteBuffer headerBuffer=ByteBuffer.allocateDirect(ETC1.ETC_PKM_HEADER_SIZE).order(ByteOrder.nativeOrder()); headerBuffer.put(ioBuffer,0,ETC1.ETC_PKM_HEADER_SIZE).position(0); if (!ETC1.isValid(headerBuffer)) { throw new IOException("Not a PKM file."); } width=ETC1.getWidth(headerBuffer); height=ETC1.getHeight(headerBuffer); } int encodedSize=ETC1.getEncodedDataSize(width,height); ByteBuffer dataBuffer=ByteBuffer.allocateDirect(encodedSize).order(ByteOrder.nativeOrder()); for (int i=0; i < encodedSize; ) { int chunkSize=Math.min(ioBuffer.length,encodedSize - i); if (input.read(ioBuffer,0,chunkSize) != chunkSize) { throw new IOException("Unable to read PKM file data."); } dataBuffer.put(ioBuffer,0,chunkSize); i+=chunkSize; } dataBuffer.position(0); return new ETC1Texture(width,height,dataBuffer); }
Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.
public BitcoinURI(String uri) throws BitcoinURIParseException { this(null,uri); }
Constructs a new BitcoinURI from the given string. Can be for any network.
public boolean checkForStringAttributes(){ return checkForAttributeType(Attribute.STRING); }
Checks for string attributes in the dataset
@Nullable public Date convert(@Nullable Date srcDate,TimeZone srcTimeZone,TimeZone dstTimeZone){ if (srcDate == null) return null; Preconditions.checkNotNullArgument(srcTimeZone,"srcTimeZone is null"); Preconditions.checkNotNullArgument(dstTimeZone,"dstTimeZone is null"); int srcOffset=srcTimeZone.getOffset(srcDate.getTime()); int dstOffset=dstTimeZone.getOffset(srcDate.getTime()); return new Date(srcDate.getTime() - srcOffset + dstOffset); }
Converts date between time zones.
private void removeTagArticleRelations(final String articleId,final String... tagIds) throws JSONException, RepositoryException { final List<String> tagIdList=Arrays.asList(tagIds); final List<JSONObject> tagArticleRelations=tagArticleRepository.getByArticleId(articleId); for (int i=0; i < tagArticleRelations.size(); i++) { final JSONObject tagArticleRelation=tagArticleRelations.get(i); String relationId; if (tagIdList.isEmpty()) { relationId=tagArticleRelation.getString(Keys.OBJECT_ID); tagArticleRepository.remove(relationId); } else if (tagIdList.contains(tagArticleRelation.getString(Tag.TAG + "_" + Keys.OBJECT_ID))) { relationId=tagArticleRelation.getString(Keys.OBJECT_ID); tagArticleRepository.remove(relationId); } } }
Removes tag-article relations by the specified article id and tag ids of the relations to be removed. <p> Removes all relations if not specified the tag ids. </p>
private static Credential authorize() throws Exception { GoogleClientSecrets clientSecrets=GoogleClientSecrets.load(JSON_FACTORY,new InputStreamReader(PlusSample.class.getResourceAsStream("/client_secrets.json"))); if (clientSecrets.getDetails().getClientId().startsWith("Enter") || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) { System.out.println("Enter Client ID and Secret from https://code.google.com/apis/console/?api=plus " + "into plus-cmdline-sample/src/main/resources/client_secrets.json"); System.exit(1); } GoogleAuthorizationCodeFlow flow=new GoogleAuthorizationCodeFlow.Builder(httpTransport,JSON_FACTORY,clientSecrets,Collections.singleton(PlusScopes.PLUS_ME)).setDataStoreFactory(dataStoreFactory).build(); return new AuthorizationCodeInstalledApp(flow,new LocalServerReceiver()).authorize("user"); }
Authorizes the installed application to access user's protected data.
public Expression compile(int opPos) throws TransformerException { int op=getOp(opPos); Expression expr=null; switch (op) { case OpCodes.OP_XPATH: expr=compile(opPos + 2); break; case OpCodes.OP_OR: expr=or(opPos); break; case OpCodes.OP_AND: expr=and(opPos); break; case OpCodes.OP_NOTEQUALS: expr=notequals(opPos); break; case OpCodes.OP_EQUALS: expr=equals(opPos); break; case OpCodes.OP_LTE: expr=lte(opPos); break; case OpCodes.OP_LT: expr=lt(opPos); break; case OpCodes.OP_GTE: expr=gte(opPos); break; case OpCodes.OP_GT: expr=gt(opPos); break; case OpCodes.OP_PLUS: expr=plus(opPos); break; case OpCodes.OP_MINUS: expr=minus(opPos); break; case OpCodes.OP_MULT: expr=mult(opPos); break; case OpCodes.OP_DIV: expr=div(opPos); break; case OpCodes.OP_MOD: expr=mod(opPos); break; case OpCodes.OP_NEG: expr=neg(opPos); break; case OpCodes.OP_STRING: expr=string(opPos); break; case OpCodes.OP_BOOL: expr=bool(opPos); break; case OpCodes.OP_NUMBER: expr=number(opPos); break; case OpCodes.OP_UNION: expr=union(opPos); break; case OpCodes.OP_LITERAL: expr=literal(opPos); break; case OpCodes.OP_VARIABLE: expr=variable(opPos); break; case OpCodes.OP_GROUP: expr=group(opPos); break; case OpCodes.OP_NUMBERLIT: expr=numberlit(opPos); break; case OpCodes.OP_ARGUMENT: expr=arg(opPos); break; case OpCodes.OP_EXTFUNCTION: expr=compileExtension(opPos); break; case OpCodes.OP_FUNCTION: expr=compileFunction(opPos); break; case OpCodes.OP_LOCATIONPATH: expr=locationPath(opPos); break; case OpCodes.OP_PREDICATE: expr=null; break; case OpCodes.OP_MATCHPATTERN: expr=matchPattern(opPos + 2); break; case OpCodes.OP_LOCATIONPATHPATTERN: expr=locationPathPattern(opPos); break; case OpCodes.OP_QUO: error(XPATHErrorResources.ER_UNKNOWN_OPCODE,new Object[]{"quo"}); break; default : error(XPATHErrorResources.ER_UNKNOWN_OPCODE,new Object[]{Integer.toString(getOp(opPos))}); } return expr; }
Execute the XPath object from a given opcode position.
public MyArrayList(){ }
Create a defalut list
public boolean shouldConnectTo(DiscoveryNode otherNode){ if (clientNode() && otherNode.clientNode()) { return false; } return true; }
Should this node form a connection to the provided node.
@Override public void refresh(){ googleMap.setZoom(googleMap.getZoom() + 1); googleMap.setZoom(googleMap.getZoom() - 1); }
Redraws the map
@Override protected void visit(final Object obj){ set[slot]=(ITuple<?>)(obj == NULL_VALUE ? null : obj); }
Assign tuple to set[slot]. Note: If [obj==NULL_VALUE] then no solutions for that slot.
@Override public List<String> hmget(final String key,final String... fields){ checkIsInMultiOrPipeline(); client.hmget(key,fields); return client.getMultiBulkReply(); }
Retrieve the values associated to the specified fields. <p> If some of the specified fields do not exist, nil values are returned. Non existing keys are considered like empty hashes. <p> <b>Time complexity:</b> O(N) (with N being the number of fields)
public Builder baseModelId(String baseModelId){ this.baseModelId=baseModelId; return this; }
Base model id.
@SideOnly(Side.CLIENT) public void changeYStart(int yStart){ this.unchangedYStart=yStart; }
Changes the starting coordinate
public void assertNotEqual(short expected,short actual,String errorMessage){ TestUtils.assertNotEqual(expected,actual,errorMessage); }
This method just invokes the test utils method, it is here for convenience
public static boolean deleteRecursive(File directory){ String canonicalParent; try { canonicalParent=getCanonicalPath(directory); } catch ( IOException ioe) { return false; } if (!directory.isDirectory()) return directory.delete(); File[] files=directory.listFiles(); for (int i=0; i < files.length; i++) { try { if (!getCanonicalPath(files[i]).startsWith(canonicalParent)) continue; } catch ( IOException ioe) { return false; } if (!deleteRecursive(files[i])) return false; } return directory.delete(); }
Deletes all files in 'directory'. Returns true if this succesfully deleted every file recursively, including itself.