code
stringlengths
10
174k
nl
stringlengths
3
129k
public Plugin loadPlugin() throws PluginException { return getPlugin(); }
Get the Plugin.
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:15.455 -0500",hash_original_method="E29573D85212414C15B5600ED44221C0",hash_generated_method="45AB3E76A33739E95CE9CE6CD6FCDA89") protected void sendMessage(byte[] msg,InetAddress peerAddress,int peerPort,boolean reConnect) throws IOException { if (sipStack.isLoggingEnabled() && this.sipStack.isLogStackTraceOnMessageSend()) { this.sipStack.getStackLogger().logStackTrace(StackLogger.TRACE_INFO); } if (peerPort == -1) { if (sipStack.isLoggingEnabled()) { this.sipStack.getStackLogger().logDebug(getClass().getName() + ":sendMessage: Dropping reply!"); } throw new IOException("Receiver port not set "); } else { if (sipStack.isLoggingEnabled()) { this.sipStack.getStackLogger().logDebug("sendMessage " + peerAddress.getHostAddress() + "/"+ peerPort+ "\n"+ "messageSize = "+ msg.length+ " message = "+ new String(msg)); this.sipStack.getStackLogger().logDebug("*******************\n"); } } DatagramPacket reply=new DatagramPacket(msg,msg.length,peerAddress,peerPort); try { DatagramSocket sock; boolean created=false; if (sipStack.udpFlag) { sock=((UDPMessageProcessor)messageProcessor).sock; } else { sock=new DatagramSocket(); created=true; } sock.send(reply); if (created) sock.close(); } catch ( IOException ex) { throw ex; } catch ( Exception ex) { InternalErrorHandler.handleException(ex); } }
Send a message to a specified receiver address.
public Collection<Integer> pendingReducers(){ return pendingReducers; }
Gets collection of pending reducers.
public boolean isEncapsulated(){ return encapsulated; }
To check if this Progress is ready to be shown
private void resolveConflict(final ConflictDescription description){ final ConflictResolutionDialog resolveDialog=new ConflictResolutionDialog(getShell(),description); description.clearAnalysis(); if (resolveDialog.open() != IDialogConstants.OK_ID) { return; } final ConflictResolution resolution=resolveDialog.getResolution(); resolution.addStatusListener(this); synchronized (runningResolutionList) { runningResolutionList.add(resolution); } if (resolution instanceof ExternalConflictResolution) { ((ExternalConflictResolution)resolution).setConflictResolver(new ResourceChangingConflictResolver(getShell())); } final ResolveConflictsCommand resolver=new ResolveConflictsCommand(repository,resolution); final ICommandExecutor commandExecutor; if (resolution instanceof EclipseMergeConflictResolution) { commandExecutor=UICommandExecutorFactory.newUICommandExecutor(getShell(),0); } else { commandExecutor=UICommandExecutorFactory.newUICommandExecutor(getShell()); } commandExecutor.execute(new ResourceChangingCommand(resolver)); }
Raise the dialog prompting the user for conflict resolution, and then attempt to resolve the conflict with that given resolution.
@SuppressWarnings("unchecked") public Frame(final int nLocals,final int nStack){ this.values=(V[])new Value[nLocals + nStack]; this.locals=nLocals; }
Constructs a new frame with the given size.
@Override protected EClass eStaticClass(){ return ExpressionsPackage.Literals.CONDITIONAL_EXPRESSION; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static FactoryImage createImage(InputStream is,String mediaType,String name) throws BadRequestException, ServerException { try { final ByteArrayOutputStream out=new ByteArrayOutputStream(); final byte[] buffer=new byte[1024]; int read; while ((read=is.read(buffer,0,buffer.length)) != -1) { out.write(buffer,0,read); if (out.size() > 1024 * 1024) { throw new BadRequestException("Maximum upload size exceeded."); } } if (out.size() == 0) { return new FactoryImage(); } out.flush(); return new FactoryImage(out.toByteArray(),mediaType,name); } catch ( IOException ioEx) { throw new ServerException(ioEx.getLocalizedMessage()); } }
Creates factory image from input stream. InputStream should be closed manually.
public void pad(int factor) throws IOException { int padding=factor - (int)(nrBits % factor); int excess=padding & 7; if (excess > 0) { this.write(0,excess); padding-=excess; } while (padding > 0) { this.write(0,8); padding-=8; } this.out.flush(); }
Pad the rest of the block with zeroes and flush. pad(8) flushes the last unfinished byte. The underlying OutputStream will be flushed.
protected void processCompletionStageUpdateAuthzArtifacts(Operation op){ op.complete(); }
Update any authz cache artifacts. Service authors need to override this method to define custom authz cache clear behavior
public void createUser(String username,String password) throws SQLException { createUser(username,password,null); }
Create a database user. <p> On Firebird 3.0 or higher this uses the default user manager plugin. </p>
public void runTest() throws Throwable { Document doc; NodeList elementList; Element testAddr; NamedNodeMap addrAttr; Node attrNode; NamedNodeMap attrList; doc=(Document)load("hc_staff",false); elementList=doc.getElementsByTagName("acronym"); testAddr=(Element)elementList.item(0); addrAttr=testAddr.getAttributes(); attrNode=addrAttr.item(0); attrList=attrNode.getAttributes(); assertNull("nodeAttributeNodeAttributeAssert1",attrList); }
Runs the test case.
protected void registerTouchpadAttributes(){ addAttributeProcessor(new DeadZoneLmlAttribute(),"deadzone","deadzoneRadius"); addAttributeProcessor(new ResetOnTouchUpLmlAttribute(),"resetOnTouchUp"); }
Touchpad widget attributes.
@Override public void handle(ReadyEvent event){ try { event.getClient().changeUsername("Awesome Bot"); } catch ( RateLimitException|DiscordException e) { e.printStackTrace(); } }
The ReadyEvent is fired when the bot is ready to interact with Discord. Attempting to do so (e.g. Changing account info, sending messages, etc.) before the event is fired will result in an error.
public boolean isContactIdAssociatedWithRcsContactProvider(final ContactId contact){ Cursor cursor=null; Uri uri=Uri.withAppendedPath(CONTENT_URI,contact.toString()); try { cursor=mLocalContentResolver.query(uri,PROJ_RCSCONTACT_CONTACT,null,null,null); CursorUtil.assertCursorIsNotNull(cursor,uri); return cursor.moveToFirst(); } finally { CursorUtil.close(cursor); } }
Utility to check if a phone number is associated to an entry in the RCS contact provider
public T caseAnonymous_activity_1_(Anonymous_activity_1_ object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Anonymous activity 1</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
public HostQueue(final File hostPath,final boolean onDemand,final boolean exceed134217727) throws MalformedURLException { this.onDemand=onDemand; this.exceed134217727=exceed134217727; this.hostPath=hostPath; String filename=hostPath.getName(); int pdot=filename.lastIndexOf('.'); if (pdot < 0) throw new RuntimeException("hostPath name must contain a dot: " + filename); this.port=Integer.parseInt(filename.substring(pdot + 1)); int p1=filename.lastIndexOf("-#"); if (p1 >= 0) { this.hostName=filename.substring(0,p1); this.hostHash=filename.substring(p1 + 2,pdot); } else throw new RuntimeException("hostPath name must contain -# followd by hosthash: " + filename); init(); }
Initializes host queue from cache files. The internal id of the queue is extracted form the path name an must match the key initially generated currently the hosthash is used as id.
private void createIcon(final int numberOfRows){ final Label label=new Label(this.composite,SWT.NONE); label.setImage(this.icon); label.setBackground(this.composite.getDisplay().getSystemColor(SWT.COLOR_WHITE)); label.setLayoutData(new GridData(GridData.CENTER,GridData.BEGINNING,false,false,1,numberOfRows)); }
Create the icon
boolean isAttributeAssigned(int attrId){ return ((attrVals[attrId - CSS_STYLE_ID_OFFSET] != -1) || ((getAttributes() != null) && (getAttributes().get(new Integer(attrId)) != null))); }
Checks if the specified attribute is assigned (i.e. was set with a legal value)
private void addReference(final int sourcePosition,final int referencePosition){ if (srcAndRefPositions == null) { srcAndRefPositions=new int[6]; } if (referenceCount >= srcAndRefPositions.length) { int[] a=new int[srcAndRefPositions.length + 6]; System.arraycopy(srcAndRefPositions,0,a,0,srcAndRefPositions.length); srcAndRefPositions=a; } srcAndRefPositions[referenceCount++]=sourcePosition; srcAndRefPositions[referenceCount++]=referencePosition; }
Adds a forward reference to this label. This method must be called only for a true forward reference, i.e. only if this label is not resolved yet. For backward references, the offset of the reference can be, and must be, computed and stored directly.
public UnitImageFactory(){ }
Creates new IconImageFactory
@Override public void eSet(int featureID,Object newValue){ switch (featureID) { case UmplePackage.AFTER_EVENT___TIMER_1: setTimer_1((String)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
protected void processMappingValueConverter(DatabaseMapping mapping,String convertValue,List<ConvertMetadata> converts,MetadataClass referenceClass,MetadataClass referenceClassWithGenerics){ processMappingConverter(mapping,convertValue,getConverts(converts),referenceClass,referenceClassWithGenerics,false); }
INTERNAL: Process a convert value which specifies the name of an EclipseLink converter to process with this accessor's mapping.
@NonNull public RxAppState startMonitoring(){ appStateRecognizer.start(app,internalAppStateListener); return this; }
Starts monitoring the app for background / foreground changes.
public int addMovingPoint(int x,int y){ int position=super.addMovingPoint(x,y); redraw(null,true); return position; }
Overridden to overcome some repainting unpleasantness that occurs when a point is added. Slows things down, however.
public RenewSpec(boolean renewable,boolean renew,int remainingRenewables){ Validate.isTrue(remainingRenewables >= 0); this.remainingRenewables=remainingRenewables; this.renewable=renewable; this.renew=renew; }
Creates a new specification
private static Region RegionToTokPair(MappingObject[][] spec,Region reg){ PCalLocation regBegin=reg.getBegin(); PCalLocation regEnd=reg.getEnd(); if (regEnd.getLine() < 0 || regBegin.getLine() >= spec.length) { return null; } if (regBegin.getLine() < 0) { regBegin=new PCalLocation(0,0); } if (regEnd.getLine() >= spec.length) { regEnd=new PCalLocation(spec.length - 1,999); } PCalLocation tokAtOrRightOfBeginning=null; boolean prevIsBeginToLeft=false; boolean notDone=true; int locLine=regBegin.getLine(); while (locLine < spec.length && spec[locLine].length == 0) { locLine++; } if (locLine >= spec.length) { notDone=false; } PCalLocation loc=new PCalLocation(locLine,0); PCalLocation prevloc=null; while (notDone && loc != null) { if (prevIsBeginToLeft) { MappingObject.EndTLAToken mobj=(MappingObject.EndTLAToken)ObjectAt(loc,spec); if (LT(regBegin,new PCalLocation(loc.getLine(),mobj.getColumn()))) { tokAtOrRightOfBeginning=prevloc; notDone=false; } else { prevIsBeginToLeft=false; } } else { MappingObject obj=ObjectAt(loc,spec); if (obj.getType() == MappingObject.END_TLATOKEN) { MappingObject.EndTLAToken eobj=(MappingObject.EndTLAToken)obj; if (LT(regBegin,new PCalLocation(loc.getLine(),eobj.getColumn()))) { tokAtOrRightOfBeginning=PrevLocOf(loc,spec); notDone=false; } } else if (obj.getType() == MappingObject.BEGIN_TLATOKEN) { MappingObject.BeginTLAToken bobj=(MappingObject.BeginTLAToken)obj; if (LTEq(regBegin,new PCalLocation(loc.getLine(),bobj.getColumn()))) { tokAtOrRightOfBeginning=loc; notDone=false; } else { prevIsBeginToLeft=true; } } else if (obj.getType() == MappingObject.SOURCE_TOKEN) { MappingObject.SourceToken sobj=(MappingObject.SourceToken)obj; if (LT(regBegin,new PCalLocation(loc.getLine(),sobj.getEndColumn()))) { tokAtOrRightOfBeginning=loc; notDone=false; } } } prevloc=loc; loc=NextLocOf(loc,spec); } PCalLocation tokAtOrLeftOfEnd=null; boolean prevIsEndToRight=false; notDone=true; locLine=regEnd.getLine(); while (locLine >= 0 && spec[locLine].length == 0) { locLine--; } if (locLine < 0) { notDone=false; } loc=new PCalLocation(locLine,spec[locLine].length - 1); prevloc=null; while (notDone && loc != null) { if (prevIsEndToRight) { MappingObject.BeginTLAToken mobj=(MappingObject.BeginTLAToken)ObjectAt(loc,spec); if (LT(new PCalLocation(loc.getLine(),mobj.getColumn()),regEnd)) { tokAtOrLeftOfEnd=prevloc; notDone=false; } else { prevIsEndToRight=false; } } else { MappingObject obj=ObjectAt(loc,spec); if (obj.getType() == MappingObject.BEGIN_TLATOKEN) { MappingObject.BeginTLAToken eobj=(MappingObject.BeginTLAToken)obj; if (LT(new PCalLocation(loc.getLine(),eobj.getColumn()),regEnd)) { tokAtOrLeftOfEnd=NextLocOf(loc,spec); notDone=false; } } else if (obj.getType() == MappingObject.END_TLATOKEN) { MappingObject.EndTLAToken bobj=(MappingObject.EndTLAToken)obj; if (LTEq(new PCalLocation(loc.getLine(),bobj.getColumn()),regEnd)) { tokAtOrLeftOfEnd=loc; notDone=false; } else { prevIsEndToRight=true; } } else if (obj.getType() == MappingObject.SOURCE_TOKEN) { MappingObject.SourceToken sobj=(MappingObject.SourceToken)obj; if (LT(new PCalLocation(loc.getLine(),sobj.getBeginColumn()),regEnd)) { tokAtOrLeftOfEnd=loc; notDone=false; } } } prevloc=loc; loc=PrevLocOf(loc,spec); } if (tokAtOrRightOfBeginning != null) { if (tokAtOrLeftOfEnd == null) { return new Region(tokAtOrRightOfBeginning,tokAtOrRightOfBeginning); } else if (LTEq(tokAtOrRightOfBeginning,tokAtOrLeftOfEnd)) { return new Region(tokAtOrRightOfBeginning,tokAtOrLeftOfEnd); } else { int distToLeft; MappingObject obj=ObjectAt(tokAtOrLeftOfEnd,spec); if (obj.getType() == MappingObject.END_TLATOKEN) { distToLeft=Dist(new PCalLocation(tokAtOrLeftOfEnd.getLine(),((MappingObject.EndTLAToken)obj).getColumn()),regBegin); } else { distToLeft=Dist(new PCalLocation(tokAtOrLeftOfEnd.getLine(),((MappingObject.SourceToken)obj).getEndColumn()),regEnd); } int distToRight; obj=ObjectAt(tokAtOrRightOfBeginning,spec); if (obj.getType() == MappingObject.BEGIN_TLATOKEN) { distToRight=Dist(new PCalLocation(tokAtOrRightOfBeginning.getLine(),((MappingObject.BeginTLAToken)obj).getColumn()),regEnd); } else { distToRight=Dist(new PCalLocation(tokAtOrRightOfBeginning.getLine(),((MappingObject.SourceToken)obj).getBeginColumn()),regEnd); } PCalLocation leftBegin=null; PCalLocation rightEnd=null; if (distToLeft >= distToRight) { rightEnd=tokAtOrRightOfBeginning; notDone=true; while (rightEnd != null && notDone) { int type=ObjectAt(rightEnd,spec).getType(); if ((type == MappingObject.END_TLATOKEN) || (type == MappingObject.SOURCE_TOKEN)) { notDone=false; } if (notDone) { rightEnd=NextLocOf(rightEnd,spec); } } } if (distToLeft <= distToRight) { leftBegin=tokAtOrLeftOfEnd; notDone=true; while (notDone) { int type=ObjectAt(leftBegin,spec).getType(); if ((type == MappingObject.BEGIN_TLATOKEN) || (type == MappingObject.SOURCE_TOKEN)) { notDone=false; } if (notDone) { leftBegin=PrevLocOf(leftBegin,spec); } } } if (distToLeft > distToRight) { return new Region(tokAtOrRightOfBeginning,rightEnd); } else if (distToLeft < distToRight) { return new Region(leftBegin,tokAtOrLeftOfEnd); } else { return new Region(leftBegin,rightEnd); } } } else if (tokAtOrLeftOfEnd != null) { return new Region(tokAtOrLeftOfEnd,tokAtOrLeftOfEnd); } return null; }
This implements the operator of the same name in TLAToPCal.tla. The Region return value is the position in spec of a pair of PCalLocations of a BeginTLAToken and EndTLAToken, which delimit the region in the TLA+ translation that we interpret the user's selection as having chosen. However, if the user has effectively chosen the entire algorithm, it returns null. Note: the spec implies that if the right edge of reg is at the beginning of a token, then that token is part of the region returned. Similarly, if the left edge of reg is at the end of a token, that token is part of the returned region. This is counterintuitive, and perhaps it should be changed. However, I will see if this is a practical problem before fixing it. Preconditions of this method: The first and last lines of spec are non-empty.
public static byte[] hexStringToByteArray(final String s,int offset,int len){ final byte[] b=new byte[len / 2]; for (int i=0; i < b.length; i++) { final int index=offset + i * 2; final int v=Integer.parseInt(s.substring(index,index + 2),16); b[i]=(byte)v; } return b; }
Hex string to byte array.
private void snipOutEntry(Entry entry,final Entry parent,boolean removeParentRelationship){ final String previousId=entry.getPreviousSiblingId(); if (previousId != null) { final Entry previous=getEntryById(previousId); previous.setNextSiblingId(entry.getNextSiblingId()); } else { parent.setFirstChildId(entry.getNextSiblingId()); } final String nextId=entry.getNextSiblingId(); if (nextId != null) { final Entry next=getEntryById(nextId); next.setPreviousSiblingId(previousId); } else { parent.setLastChildId(previousId); } }
Helper method. Removes an entry from its parent and siblings, but not from its children. The user's entitlements must be checked before calling this method.
private void gotoMyLocation(){ LocationManager locationManager=(LocationManager)getSystemService(LOCATION_SERVICE); Criteria criteria=new Criteria(); String provider=locationManager.getBestProvider(criteria,true); if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getActivity(),android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(getActivity(),android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { } else { Location myLocation=locationManager.getLastKnownLocation(provider); if (myLocation != null) { LatLng latLng=new LatLng(myLocation.getLatitude(),myLocation.getLongitude()); activeLatLng=latLng; googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,15)); googleMap.addMarker(new MarkerOptions().position(latLng)); } } }
animate google map to my location and add marker to my location
public T caseIfStatement(IfStatement object){ return null; }
Returns the result of interpreting the object as an instance of '<em>If Statement</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
public double eval(double params[]){ return (Math.abs(params[0])); }
Evaluate the absolute value of a single parameter.
public boolean explicitCast(Type from,Type to) throws ClassNotFound { if (implicitCast(from,to)) { return true; } if (from.inMask(TM_NUMBER)) { return to.inMask(TM_NUMBER); } if (from.isType(TC_CLASS) && to.isType(TC_CLASS)) { ClassDefinition fromClass=getClassDefinition(from); ClassDefinition toClass=getClassDefinition(to); if (toClass.isFinal()) { return fromClass.implementedBy(this,toClass.getClassDeclaration()); } if (fromClass.isFinal()) { return toClass.implementedBy(this,fromClass.getClassDeclaration()); } if (toClass.isInterface() && fromClass.isInterface()) { return toClass.couldImplement(fromClass); } return toClass.isInterface() || fromClass.isInterface() || fromClass.superClassOf(this,toClass.getClassDeclaration()); } if (to.isType(TC_ARRAY)) { if (from.isType(TC_ARRAY)) { Type t1=from.getElementType(); Type t2=to.getElementType(); while ((t1.getTypeCode() == TC_ARRAY) && (t2.getTypeCode() == TC_ARRAY)) { t1=t1.getElementType(); t2=t2.getElementType(); } if (t1.inMask(TM_ARRAY | TM_CLASS) && t2.inMask(TM_ARRAY | TM_CLASS)) { return explicitCast(t1,t2); } } else if (from == Type.tObject || from == Type.tCloneable || from == Type.tSerializable) return true; } return false; }
Return true if an explicit cast from this type to the given type is allowed.
public boolean match(CatchClause node,Object other){ if (!(other instanceof CatchClause)) { return false; } CatchClause o=(CatchClause)other; return (safeSubtreeMatch(node.getException(),o.getException()) && safeSubtreeMatch(node.getBody(),o.getBody())); }
Returns whether the given node and the other object match. <p> The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed. </p>
public final void writeShort(short[] pa,int start,int n) throws IOException { for (int i=0; i < n; i++) { writeShort(pa[start + i]); } }
Write an array of shorts
public static double logPdf(double x,double m,double shape){ double a=Math.sqrt(shape / (2.0 * Math.PI * x* x* x)); double b=((-shape) * (x - m) * (x - m)) / (2.0 * m * m* x); return Math.log(a) + b; }
the natural log of the probability density function of the distribution
public long findUniqueLong(@NotNull SqlQuery query){ return executeQuery(rowMapperForClass(long.class).unique(),query); }
A convenience method for retrieving a single non-null long.
public static PivotTracingClient client(){ PivotTracingClient pt=new PivotTracingClient(); pt.addTracepoint(hdfs_datanode_incrBytesRead); pt.addTracepoint(hdfs_datanode_addReadBlockOp); pt.addTracepoint(hdfs_datanode_dataTransferProtocol); pt.addTracepoint(hdfs_client_open); pt.addTracepoint(hdfs_namenode_getBlockLocations); pt.addTracepoint(hdfs_namenode_getBlockLocations_return); pt.addTracepoint(client_protocols); pt.addTracepoint(stresstest_donextop); return pt; }
Get a client loaded with the example tracepoints
public static void execute(ExecutablePool pool,Instantiator[] instantiators,EventID eventId){ AbstractOp op=new RegisterInstantiatorsOpImpl(instantiators,eventId); pool.execute(op,Integer.MAX_VALUE); }
Register a bunch of instantiators on a server using connections from the given pool to communicate with the server.
@Override public int parse(char[] buf,int start,int end,T data){ if (subject != null) { return subject.parse(buf,start,end,data); } else { return NO_MATCH; } }
Delegates parsing responsibilties to <code>subject</code> if it is non-null, and returns <code>NO_MATCH</code> otherwise.
static LogWriterAppender createLogWriterAppender(final boolean appendToFile,final boolean isLoner,final boolean isSecurity,final LogConfig config,final boolean logConfig){ final boolean isDistributionConfig=config instanceof DistributionConfig; final DistributionConfig dsConfig=isDistributionConfig ? (DistributionConfig)config : null; File logFile=config.getLogFile(); String firstMsg=null; boolean firstMsgWarning=false; AlertAppender.getInstance().setAlertingDisabled(isLoner); if (isSecurity) { if (isDistributionConfig) { File tmpLogFile=dsConfig.getSecurityLogFile(); if (tmpLogFile != null && !tmpLogFile.equals(new File(""))) { logFile=tmpLogFile; } } else { throw new IllegalArgumentException("DistributionConfig is expected for SecurityLogWriter"); } } if (logFile == null || logFile.equals(new File(""))) { return null; } if (logFile.exists()) { final boolean useChildLogging=config.getLogFile() != null && !config.getLogFile().equals(new File("")) && config.getLogFileSizeLimit() != 0; final boolean statArchivesRolling=isDistributionConfig && dsConfig.getStatisticArchiveFile() != null && !dsConfig.getStatisticArchiveFile().equals(new File("")) && dsConfig.getArchiveFileSizeLimit() != 0 && dsConfig.getStatisticSamplingEnabled(); if (!appendToFile || useChildLogging || statArchivesRolling) { final File oldMain=ManagerLogWriter.getLogNameForOldMainLog(logFile,isSecurity || useChildLogging || statArchivesRolling); final boolean succeeded=LogFileUtils.renameAggressively(logFile,oldMain); if (succeeded) { firstMsg=LocalizedStrings.InternalDistributedSystem_RENAMED_OLD_LOG_FILE_TO_0.toLocalizedString(oldMain); } else { firstMsgWarning=true; firstMsg=LocalizedStrings.InternalDistributedSystem_COULD_NOT_RENAME_0_TO_1.toLocalizedString(new Object[]{logFile,oldMain}); } } } FileOutputStream fos; try { fos=new FileOutputStream(logFile,true); } catch ( FileNotFoundException ex) { String s=LocalizedStrings.InternalDistributedSystem_COULD_NOT_OPEN_LOG_FILE_0.toLocalizedString(logFile); throw new GemFireIOException(s,ex); } final PrintStream out=new PrintStream(fos); ManagerLogWriter mlw=null; String logWriterLoggerName=null; if (isSecurity) { mlw=new SecurityManagerLogWriter(dsConfig.getSecurityLogLevel(),out,config.getName()); logWriterLoggerName=LogService.SECURITY_LOGGER_NAME; } else { mlw=new ManagerLogWriter(config.getLogLevel(),out,config.getName()); logWriterLoggerName=LogService.MAIN_LOGGER_NAME; } mlw.setConfig(config); AppenderContext[] appenderContext=new AppenderContext[1]; if (isSecurity) { appenderContext[0]=LogService.getAppenderContext(LogService.SECURITY_LOGGER_NAME); } else { appenderContext[0]=LogService.getAppenderContext(); } final LogWriterAppender appender=LogWriterAppender.create(appenderContext,logWriterLoggerName,mlw,fos); if (!isSecurity && LogService.MAIN_LOGGER_NAME.equals(logWriterLoggerName) && LogService.isUsingGemFireDefaultConfig()) { LogService.removeConsoleAppender(); } final InternalLogWriter logWriter=mlw; if (firstMsg != null) { if (firstMsgWarning) { logWriter.warning(firstMsg); } else { logWriter.info(firstMsg); } } if (logConfig) { if (!isLoner) { logWriter.info(LocalizedStrings.InternalDistributedSystem_STARTUP_CONFIGURATIONN_0,config.toLoggerString()); } } if (ALLOW_REDIRECT) { if (ProcessLauncherContext.isRedirectingOutput()) { try { OSProcess.redirectOutput(config.getLogFile()); } catch ( IOException e) { logWriter.error(e); } } } return appender; }
Creates the log writer appender for a distributed system based on the system's parsed configuration. The initial banner and messages are also entered into the log by this method.
public static void encode(Configuration configuration,Movie movie,OutputStream out) throws IOException { final boolean useCompression=configuration.getCompilerConfiguration().useCompression(); TagEncoder encoder=configuration.generateSizeReport() ? new TagEncoderReporter() : new TagEncoder(); new MovieEncoder(encoder).export(movie,useCompression); encoder.writeTo(out); generateSizeReport(configuration,movie,encoder); if (ThreadLocalToolkit.getBenchmark() != null) { LocalizationManager l10n=ThreadLocalToolkit.getLocalizationManager(); if (l10n != null) ThreadLocalToolkit.getBenchmark().benchmark(l10n.getLocalizedTextString(new SWFEncoding())); } }
Encode movie; produce binary output
public boolean hasMasks(){ return (masks != null && !masks.isEmpty()); }
Indicates if there are any masks found for placement
public ASN1Primitive parsePublicKey() throws IOException { ASN1InputStream aIn=new ASN1InputStream(keyData.getBytes()); return aIn.readObject(); }
for when the public key is an encoded object - if the bitstring can't be decoded this routine throws an IOException.
public void onUpdate(Project.NameKey project,String oldValue,String newValue){ }
Called after a project config is updated.
public VisorNodeDataCollectorTaskArg(boolean taskMonitoringEnabled,String evtOrderKey,String evtThrottleCntrKey,int sample,boolean sysCaches){ this.taskMonitoringEnabled=taskMonitoringEnabled; this.evtOrderKey=evtOrderKey; this.evtThrottleCntrKey=evtThrottleCntrKey; this.sample=sample; this.sysCaches=sysCaches; }
Create task arguments with given parameters.
public T caseFeatureType(FeatureType object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Feature Type</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
public void initialize(){ TextureState ts=new TextureState(); ts.setEnabled(false); setRenderState(ts); for (int i=0; i < lineSetList.size(); ++i) { LineSetState state=lineSetList.get(i); addLineSet(state,false); } zBufferState=new ZBufferState(); zBufferState.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); zBufferState.setEnabled(true); setRenderState(zBufferState); }
Initialize this LineSets object
public static TileEntity loadTileEntityHook(NBTTagCompound data,Class<? extends TileEntity> clazz) throws Exception { if (FWTile.class.isAssignableFrom(clazz)) { return FWTileLoader.loadTile(data); } else { return clazz.newInstance(); } }
Used to inject forwarded TileEntites
private static Boolean isInsidePolygon(final GeoPoint point,final List<GeoPoint> polyPoints){ final double latitude=point.getLatitude(); final double longitude=point.getLongitude(); final double sinLatitude=Math.sin(latitude); final double cosLatitude=Math.cos(latitude); final double sinLongitude=Math.sin(longitude); final double cosLongitude=Math.cos(longitude); double arcDistance=0.0; Double prevAngle=null; for ( final GeoPoint polyPoint : polyPoints) { final Double angle=computeAngle(polyPoint,sinLatitude,cosLatitude,sinLongitude,cosLongitude); if (angle == null) { return null; } if (prevAngle != null) { double angleDelta=angle - prevAngle; if (angleDelta < -Math.PI) { angleDelta+=Math.PI * 2.0; } if (angleDelta > Math.PI) { angleDelta-=Math.PI * 2.0; } if (Math.abs(angleDelta - Math.PI) < Vector.MINIMUM_RESOLUTION) { return null; } arcDistance+=angleDelta; } prevAngle=angle; } if (prevAngle != null) { final Double lastAngle=computeAngle(polyPoints.get(0),sinLatitude,cosLatitude,sinLongitude,cosLongitude); if (lastAngle == null) { return null; } double angleDelta=lastAngle - prevAngle; if (angleDelta < -Math.PI) { angleDelta+=Math.PI * 2.0; } if (angleDelta > Math.PI) { angleDelta-=Math.PI * 2.0; } if (Math.abs(angleDelta - Math.PI) < Vector.MINIMUM_RESOLUTION) { return null; } arcDistance+=angleDelta; } if (Math.abs(arcDistance) < Vector.MINIMUM_RESOLUTION) { return null; } return arcDistance > 0.0; }
For a specified point and a list of poly points, determine based on point order whether the point should be considered in or out of the polygon.
public void transmit(Command c,Map h,String b){ _server.receive(c,h,b,this); }
Transmit a message to clients and listeners.
@Override protected void onCreate(Bundle savedInstanceState){ setContentView(R.layout.acronym_activity); mEditText=(EditText)findViewById(R.id.editText1); super.onCreate(savedInstanceState,AcronymOps.class,this); }
Hook method called when a new instance of Activity is created. One time initialization code goes here, e.g., storing Views.
private void expandOnCheck(){ if (chkExpand.isChecked()) expandAll(); else collapseAll(); }
On check event for the expand checkbox
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:09.123 -0500",hash_original_method="E6965F1E2FB321FAD1F4EA1126484F16",hash_generated_method="60C132B45E842D9C2697360FDDF75B00") public void copy1DRangeFrom(int off,int count,float[] d){ validateIsFloat32(); copy1DRangeFromUnchecked(off,count,d); }
Copy part of an allocation from an array. This variant is type checked and will generate exceptions if the Allocation type is not a 32 bit float type.
public List<String> findAllInContent(String content){ List<String> results=new LinkedList<String>(); for ( BoyerMooreMatcher matcher : strings) { if (matcher.findInContent(content) >= 0) results.add(matcher.getPattern()); } Matcher matcher; for ( Pattern pattern : patterns) { matcher=pattern.matcher(content); if (matcher.find()) { results.add(content); } } return results; }
Search for all possible occurrences inside a specific content
public static void saveDefaultsToProperties(Properties properties){ properties.setProperty("MapElement.CartesianGrid.defaultColor",StringUtil.colorToString(defaultColor)); properties.setProperty("MapElement.CartesianGrid.defaultRows",Integer.toString(defaultRows)); properties.setProperty("MapElement.CartesianGrid.defaultColumns",Integer.toString(defaultColumns)); properties.setProperty("MapElement.CartesianGrid.defaultLineWidth",Double.toString(defaultLineWidth)); properties.setProperty("MapElement.CartesianGrid.defaultLabelVisible",Boolean.toString(defaultLabelVisible)); properties.setProperty("MapElement.CartesianGrid.defaultActualCoordinates",Boolean.toString(defaultActualCoordinates)); }
Save defaults
public synchronized final void incrementProgressBy(int diff){ setProgress(mProgress + diff); }
<p>Increase the progress bar's progress by the specified amount.</p>
public void updateRegisterToClose(UseCaseConf useCaseConf,Integer bookId,List fields,List listIdsRegister) throws ValidationException, SecurityException, AttributesException, BookException, SessionException, ParseException { BookSession.preUpdateRegisterToClose(useCaseConf.getSessionID(),bookId,listIdsRegister,useCaseConf.getEntidadId()); Integer folderID=null; for (Iterator it=listIdsRegister.iterator(); it.hasNext(); ) { folderID=(Integer)it.next(); saveOrUpdateFolder(useCaseConf,bookId,folderID.intValue(),null,fields,null,null); } BookSession.postUpdateFields(useCaseConf.getSessionID(),bookId,listIdsRegister,useCaseConf.getEntidadId()); }
Metodo que prepara y actualiza el estado de los registros a CERRADO
public static byte[] encode(Object object){ String data=new JSONObject(object).toString(); data=filter(data); return data.getBytes(); }
exchange the api resource returns to a JSONObject
public GemFireHealthConfigImpl(String hostName){ this.hostName=hostName; }
Creates a new <code>GemFireHealthConfigImpl</code> that applies to the host with the given name.
public FunctionLibFunction(){ }
Geschuetzer Konstruktor ohne Argumente.
public void login(UseCaseConf useCaseConf,String login,String password) throws ValidationException, SecurityException, Exception { String sessionID=null; if (!useCaseConf.getEntidadId().equals("ISicres") && login.indexOf("##CODE##") != -1) { String decodedLogin=login.substring(0,login.indexOf("##CODE##")); decodedLogin=Base64Util.decodeToString(decodedLogin); sessionID=SecuritySession.login(decodedLogin,password,useCaseConf.getUserDn(),useCaseConf.getUseLdap(),useCaseConf.getUsingOSAuth(),useCaseConf.getLocale(),useCaseConf.getEntidadId()); } else { sessionID=SecuritySession.login(login,password,useCaseConf.getUserDn(),useCaseConf.getUseLdap(),useCaseConf.getUsingOSAuth(),useCaseConf.getLocale(),useCaseConf.getEntidadId()); } useCaseConf.setSessionID(sessionID); }
Public methods
protected static boolean isUserDefinedProperty(String propName){ return !standardPropNames.contains(propName); }
Is this property a Solr-standard property, or is it an extra property defined per-core by the user?
@SuppressWarnings("rawtypes") @Test public void testCustomStorageFormat() throws Exception { String resourceId="/schema/test/foo"; String storedResourceId="_schema_test_foo.bin"; MockAnalysisComponent observer=new MockAnalysisComponent(); List<ManagedResourceObserver> observers=Arrays.asList((ManagedResourceObserver)observer); Map<String,Object> storedData=new HashMap<>(); Map<String,Object> initArgs=new HashMap<>(); initArgs.put("someArg","someVal"); initArgs.put("arg2",Boolean.TRUE); List<String> arg3list=Arrays.asList("one","two","three"); initArgs.put("arg3",arg3list); initArgs.put("arg4",18L); initArgs.put("arg5",0.9); Map<String,Long> arg6map=new HashMap<>(); arg6map.put("uno",1L); arg6map.put("dos",2L); initArgs.put("arg6",arg6map); storedData.put("initArgs",initArgs); List<String> managedList=new ArrayList<>(); managedList.add("1"); managedList.add("2"); managedList.add("3"); storedData.put(ManagedResource.MANAGED_JSON_LIST_FIELD,managedList); ManagedResourceStorage.InMemoryStorageIO storageIO=new ManagedResourceStorage.InMemoryStorageIO(); storageIO.storage.put(storedResourceId,ser2bytes((Serializable)storedData)); CustomStorageFormatResource res=new CustomStorageFormatResource(resourceId,new SolrResourceLoader("./"),storageIO); res.loadManagedDataAndNotify(observers); assertTrue("Observer was not notified by ManagedResource!",observer.wasNotified); List<String> updatedData=new ArrayList<>(); updatedData.add("1"); updatedData.add("2"); updatedData.add("3"); updatedData.add("4"); res.storeManagedData(updatedData); Object stored=res.storage.load(resourceId); assertNotNull(stored); assertTrue(stored instanceof Map); Map storedMap=(Map)stored; assertNotNull(storedMap.get("initArgs")); List storedList=(List)storedMap.get(ManagedResource.MANAGED_JSON_LIST_FIELD); assertTrue(storedList.contains("4")); }
The ManagedResource storage framework allows the end developer to use a different storage format other than JSON, as demonstrated by this test.
private static String translateOperator(String operator,Locale locale){ String result=null; if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_EQUAL_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_EQUAL_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_NOT_EQUAL_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_NOT_EQUAL_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_GREATER_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_GREATER_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_GREATER_EQUAL_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_GREATER_EQUAL_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_LESSER_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LESSER_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_LESSER_EQUAL_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LESSER_EQUAL_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_BETWEEN_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_BETWEEN_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_LIKE_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LIKE_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_OR_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_OR_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_ABC_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_ABC_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_IN_AND_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_IN_AND_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_IN_OR_TEXT_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_IN_OR_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_DEPEND_OF_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_DEPEND_OF_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_BEGIN_BY_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LIKE_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_END_WITH_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LIKE_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_AFTER_TO_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_GREATER_TEXT_VALUE; } else if (operator.equals(RBUtil.getInstance(locale).getProperty(Keys.I18N_QUERY_BEFORE_TO_VALUE))) { result=com.ieci.tecdoc.common.isicres.Keys.QUERY_LESSER_TEXT_VALUE; } return result; }
Traducimos el operador de busqueda de texto a su simbolo correspondiente
public boolean isStopPlaying(){ return this.stopPlaying; }
Gets the stopPlaying attribute of the SoundInfo object
public List<List<Integer>> subsetsC(int[] nums){ List<List<Integer>> subset=new ArrayList<>(); subset.add(new ArrayList<>()); for (int i=0; i < nums.length; i++) { int n=subset.size(); for (int j=0; j < n; j++) { List<Integer> set=new ArrayList<>(subset.get(j)); set.add(nums[i]); subset.add(set); } } return subset; }
Iterative. Build from empty set to the next subsets. By add each subset the current num, new subsets are generated. Then add new subsets to all subsets and generate next round. Stop when we iterate through the array. <p> [] -> [] [1] [] [1] -> [] [1] [2] [1, 2]
public Object parse(String text) throws DataParseException { try { StringTokenizer st=new StringTokenizer(text,"\"[](){}, "); int[] array=new int[st.countTokens()]; for (int i=0; st.hasMoreTokens(); ++i) { String tok=st.nextToken(); array[i]=Integer.parseInt(tok); } return array; } catch ( NumberFormatException e) { throw new DataParseException(e); } }
Parse an int array from a text string.
private void revealChildrenThatNeedAttention(TreeViewer viewer,LogEntry<T> entry){ Data logData=entry.getLogData(); if (logData != null && logData.getNeedsAttention()) { viewer.reveal(entry); } List<LogEntry<T>> disclosedChildren=entry.getDisclosedChildren(); for ( LogEntry<T> logEntry : disclosedChildren) { revealChildrenThatNeedAttention(viewer,logEntry); } }
Reveal all children in the model that require attention.
public static ITypeBinding normalizeWildcardType(ITypeBinding wildcardType,boolean isBindingToAssign,AST ast){ ITypeBinding bound=wildcardType.getBound(); if (isBindingToAssign) { if (bound == null || !wildcardType.isUpperbound()) { return ast.resolveWellKnownType("java.lang.Object"); } } else { if (bound == null || wildcardType.isUpperbound()) { return null; } } return bound; }
Use this method before creating a type for a wildcard. Either to assign a wildcard to a new type or for a type to be assigned.
public Vector<SiftFeature> run(){ Vector<SiftFeature> features=new Vector<SiftFeature>(); for (int o=0; o < octaves.length; ++o) { if (octaves[o].state == FloatArray2DScaleOctave.State.EMPTY) continue; Vector<SiftFeature> more=runOctave(o); features.addAll(more); } return features; }
detect features in all scale octaves
protected AssociationResponse(ParameterList params){ super(params); }
Constructs an AssociationResponse message from a parameter list. <p> Useful for processing incoming messages.
private static <T>void siftDownComparable(int k,T x,Object[] array,int n){ if (n > 0) { Comparable<? super T> key=(Comparable<? super T>)x; int half=n >>> 1; while (k < half) { int child=(k << 1) + 1; Object c=array[child]; int right=child + 1; if (right < n && ((Comparable<? super T>)c).compareTo((T)array[right]) > 0) c=array[child=right]; if (key.compareTo((T)c) <= 0) break; array[k]=c; k=child; } array[k]=key; } }
Inserts item x at position k, maintaining heap invariant by demoting x down the tree repeatedly until it is less than or equal to its children or is a leaf.
public Boolean isForce(){ return force; }
Gets the value of the force property.
public ArrayLongCompressed(int size,int leadingClearBits,int trailingClearBits){ init(size,BIT_LENGTH - leadingClearBits - trailingClearBits,trailingClearBits); }
Create <code>LongArrayCompressed</code> from number of longs to be stored, the number of leading and trailing clear bits. Everything else is stored in the internal data structure.
@Override public byte readByte() throws IOException { LOG.warn("Should not be used!"); return inputStream.readByte(); }
This method should never be used!
public String toString(){ return m_Attributes.toString(); }
returns a string representation of this object
public X509v3CertificateBuilder copyAndAddExtension(ASN1ObjectIdentifier oid,boolean isCritical,X509CertificateHolder certHolder){ Certificate cert=certHolder.toASN1Structure(); Extension extension=cert.getTBSCertificate().getExtensions().getExtension(oid); if (extension == null) { throw new NullPointerException("extension " + oid + " not present"); } extGenerator.addExtension(oid,isCritical,extension.getExtnValue().getOctets()); return this; }
Add a given extension field for the standard extensions tag (tag 3) copying the extension value from another certificate.
public static boolean less(TMember left,TMember right){ return less(left.getMemberAccessModifier(),right.getMemberAccessModifier()); }
Convenience method, returns true if left member access modifier is less then right one.
public void testFloatValueNegativeInfinity2(){ byte[] a={0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; int aSign=-1; float aNumber=new BigInteger(aSign,a).floatValue(); assertTrue(aNumber == Float.NEGATIVE_INFINITY); }
Convert a negative number to a float value. The exponent is 1023 and the mantissa is all 0s. The rounding bit is 0. The result is Float.NEGATIVE_INFINITY.
private byte[] unpadOAEP(byte[] padded) throws BadPaddingException { byte[] EM=padded; boolean bp=false; int hLen=lHash.length; if (EM[0] != 0) { bp=true; } int seedStart=1; int seedLen=hLen; int dbStart=hLen + 1; int dbLen=EM.length - dbStart; mgf1(EM,dbStart,dbLen,EM,seedStart,seedLen); mgf1(EM,seedStart,seedLen,EM,dbStart,dbLen); for (int i=0; i < hLen; i++) { if (lHash[i] != EM[dbStart + i]) { bp=true; } } int padStart=dbStart + hLen; int onePos=-1; for (int i=padStart; i < EM.length; i++) { int value=EM[i]; if (onePos == -1) { if (value == 0x00) { } else if (value == 0x01) { onePos=i; } else { bp=true; } } } if (onePos == -1) { bp=true; onePos=EM.length - 1; } int mStart=onePos + 1; byte[] tmp=new byte[mStart - padStart]; System.arraycopy(EM,padStart,tmp,0,tmp.length); byte[] m=new byte[EM.length - mStart]; System.arraycopy(EM,mStart,m,0,m.length); BadPaddingException bpe=new BadPaddingException("Decryption error"); if (bp) { throw bpe; } else { return m; } }
PKCS#1 v2.1 OAEP unpadding (MGF1).
static int dp2px(Context context,float dp){ float px=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,context.getResources().getDisplayMetrics()); return Math.round(px); }
Convert a dp float value to pixels
private final boolean parkAndCheckInterrupt(){ LockSupport.park(this); return Thread.interrupted(); }
Convenience method to park and then check if interrupted
private void sendCommittedText(){ AttributedString as=new AttributedString(buffer.toString()); context.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,as.getIterator(),buffer.length(),TextHitInfo.leading(insertionPoint),null); buffer.setLength(0); insertionPoint=0; format=UNSET; }
Send the committed text to the client.
public static void CheckForDuplicateMacros(Vector macros) throws ParseAlgorithmException { int i=0; while (i < macros.size()) { String namei=((AST.Macro)macros.elementAt(i)).name; int j=i + 1; while (j < macros.size()) { if (namei.equals(((AST.Macro)macros.elementAt(j)).name)) { throw new ParseAlgorithmException("Multiple definitions of macro name `" + namei + "'"); } j=j + 1; } i=i + 1; } }
MACRO EXPANSION * Methods for expanding macros.
public SpaceHorizontalAction(final NetworkPanel networkPanel){ super(networkPanel,"Space Horizontal",EnablingCondition.NEURONS); putValue(SMALL_ICON,ResourceManager.getImageIcon("SpaceHorizontal.png")); putValue(SHORT_DESCRIPTION,"Space selected neurons horizontally"); }
Create a new space horizontal action with the specified network panel.
public static void create(DataSource ds,SQLDialect dialect,String... tables){ DSLContext dsl=DSL.using(ds,dialect); dsl.dropTableIfExists(USERS).execute(); dsl.createTable(USERS).column(UIDX,UIDX.getDataType().nullable(false)).column(USER_ID,USER_ID.getDataType().nullable(false)).execute(); dsl.alterTable(USERS).add(constraint("PK_USERS").primaryKey(UIDX)).execute(); dsl.dropSequenceIfExists(SEQ_UIDX).execute(); dsl.createSequence(SEQ_UIDX).execute(); dsl.dropTableIfExists(ITEMS).execute(); dsl.createTable(ITEMS).column(IIDX,IIDX.getDataType().nullable(false)).column(ITEM_ID,ITEM_ID.getDataType().nullable(false)).execute(); dsl.alterTable(ITEMS).add(constraint("PK_ITEMS").primaryKey(IIDX)).execute(); dsl.dropSequenceIfExists(SEQ_IIDX).execute(); dsl.createSequence(SEQ_IIDX).execute(); for ( String table : tables) { Table<Record> DATA=DSL.table(name(table.toUpperCase())); dsl.dropTableIfExists(DATA).execute(); dsl.createTable(DATA).column(UIDX,UIDX.getDataType().nullable(false)).column(IIDX,IIDX.getDataType().nullable(false)).column(V,V.getDataType().nullable(false)).execute(); dsl.alterTable(DATA).add(constraint("PK_" + table).primaryKey(UIDX,IIDX)).execute(); dsl.alterTable(DATA).add(constraint("FK_" + table + "_uidx").foreignKey(UIDX).references(USERS,UIDX).onDeleteCascade()).execute(); dsl.alterTable(DATA).add(constraint("FK_" + table + "_iidx").foreignKey(IIDX).references(ITEMS,IIDX).onDeleteCascade()).execute(); } }
Creates empty tables for their use in SQLPreferenceData
public static Calendar toCalendar(String datestring){ return parseGetCal(datestring,new SimpleDateFormat()); }
Returns a calendar from a given string using the default SimpleDateFormat for parsing.
private void append(StringBuilder result,String value,int[] index,String placeholder,MaskCharacter[] mask) throws ParseException { for (int counter=0, maxCounter=mask.length; counter < maxCounter; counter++) { mask[counter].append(result,value,index,placeholder); } }
Invokes <code>append</code> on the mask characters in <code>mask</code>.
public static _Fields findByThriftIdOrThrow(int fieldId){ _Fields fields=findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; }
Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public static String validateString(String string){ if (string == null) { return ""; } else { return string; } }
Checks if the given string is null and if it is, it returns an empty string
public SVGDescriptor toSVG(GraphicContext gc){ return toSVG(gc.getComposite()); }
Converts part or all of the input GraphicContext into a set of attribute/value pairs and related definitions
public static OrganizationAlreadyExistsException convertToApi(org.oscm.internal.types.exception.OrganizationAlreadyExistsException oldEx){ return convertExceptionToApi(oldEx,OrganizationAlreadyExistsException.class); }
Convert source version Exception to target version Exception
@Override public String toString(){ return "ResultProcessStartedResponse{" + "transactionId=" + transactionId + ", signature="+ signature+ "} "+ super.toString(); }
Returns a string representation of the object
public void destination(Object destination){ this.destination=Objects.requireNonNull(destination); }
Sets the destination directory, defaults to `build/p2asmaven`.
public static boolean isHdrOn(SettingsManager settingsManager){ return settingsManager.getBoolean(SettingsManager.SCOPE_GLOBAL,KEY_CAMERA_HDR); }
Returns whether hdr mode is set on.
public static List<String> enumConstantsOf(Column column){ return Stream.of(column.getEnumConstants().orElseThrow(null).split(",")).collect(toList()); }
Returns a list of all the enum constants in a particular column. The list is created each time this method is called and is therefore safe to edit without affecting the column. <p> If no enum constants was specified in the column, an exception is thrown.
@Override public boolean equals(Object obj){ if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof ConversationContext)) return false; ConversationContext other=(ConversationContext)obj; if (forMatching != other.forMatching) return false; if (ignoreIgnorable != other.ignoreIgnorable) return false; if (mergeExpressions != other.mergeExpressions) return false; if (state != other.state) return false; return true; }
Default implementation of equals()
@Override public void merge(Result<Map<ByteArrayWrapper,MeasureAggregator[]>,MeasureAggregator> result){ ByteArrayWrapper key; MeasureAggregator[] value; Map<ByteArrayWrapper,MeasureAggregator[]> otherResult=result.getResult(); if (otherResult != null) { while (resultIterator.hasNext()) { Entry<ByteArrayWrapper,MeasureAggregator[]> entry=resultIterator.next(); key=entry.getKey(); value=entry.getValue(); MeasureAggregator[] agg=otherResult.get(key); if (agg != null) { for (int j=0; j < agg.length; j++) { agg[j].merge(value[j]); } } else { otherResult.put(key,value); } } resulSize=otherResult.size(); this.resultIterator=otherResult.entrySet().iterator(); this.scannerResult=otherResult; } }
below method will be used to merge the scanned result, in case of map based the result we need to aggregate the result