code
stringlengths
10
174k
nl
stringlengths
3
129k
public void remove(String name){ if (impl.formalArguments == null) { if (impl.hasFormalArgs) { throw new IllegalArgumentException("no such attribute: " + name); } return; } FormalArgument arg=impl.formalArguments.get(name); if (arg == null) { throw new IllegalArgumentException("no such attribute: " + name); } locals[arg.index]=EMPTY_ATTR; }
Remove an attribute value entirely (can't remove attribute definitions).
public final IntGrid2D add(int withThisMuch){ if (withThisMuch == 0.0) return this; int[] fieldx=null; final int width=this.width; final int height=this.height; for (int x=0; x < width; x++) { fieldx=field[x]; for (int y=0; y < height; y++) { assert sim.util.LocationLog.it(this,new Int2D(x,y)); fieldx[y]+=withThisMuch; } } return this; }
Sets each value in the grid to that value added to <i>withThisMuch</i> Returns the modified grid.
private boolean less(int i,int j){ return keys[pq[i]].compareTo(keys[pq[j]]) < 0; }
General helper functions.
@TransactionAttribute(TransactionAttributeType.MANDATORY) public void sendMail(Organization organization,EmailType type,Object[] params,Marketplace marketplace) throws MailOperationException { String mail=organization.getEmail(); if (mail == null || mail.trim().length() == 0) { logger.logInfo(Log4jLogger.SYSTEM_LOG,LogMessageIdentifier.INFO_NO_EMAIL_ADDRESS_SPECIFIED_ORGANIZATION,organization.getOrganizationId()); return; } final String locale=organization.getLocale(); String subject=getText(locale,type.toString() + RESOURCE_SUBJECT,params,marketplace); String text=getText(locale,RESOURCE_TEXT_HEADER,params,marketplace); text+=getText(locale,type.toString() + RESOURCE_TEXT,params,marketplace); text+=getText(locale,RESOURCE_TEXT_FOOTER,null,marketplace); List<String> to=new ArrayList<String>(); to.add(mail); sendMail(to,subject,text,locale); }
Send mail to organization.
public void enableDebugMode(boolean b){ renderer.enableDebugMode(b); viewChanged(MapViewEvent.Type.NEW_RENDERER); }
Controls whether kd-tree informations, node identifiers etc. are shown.
public HttpEntityWrapper(HttpEntity wrapped){ super(); if (wrapped == null) { throw new IllegalArgumentException("wrapped entity must not be null"); } wrappedEntity=wrapped; }
Creates a new entity wrapper.
public static void readAttributeSet(ObjectInputStream in,MutableAttributeSet a) throws ClassNotFoundException, IOException { int n=in.readInt(); for (int i=0; i < n; i++) { Object key=in.readObject(); Object value=in.readObject(); if (thawKeyMap != null) { Object staticKey=thawKeyMap.get(key); if (staticKey != null) { key=staticKey; } Object staticValue=thawKeyMap.get(value); if (staticValue != null) { value=staticValue; } } a.addAttribute(key,value); } }
Reads a set of attributes from the given object input stream that have been previously written out with <code>writeAttributeSet</code>. This will try to restore keys that were static objects to the static objects in the current virtual machine considering only those keys that have been registered with the <code>registerStaticAttributeKey</code> method. The attributes retrieved from the stream will be placed into the given mutable set.
private static JFreeChart createChart(){ Number[][] data=new Integer[][]{{new Integer(-3),new Integer(-2)},{new Integer(-1),new Integer(1)},{new Integer(2),new Integer(3)}}; CategoryDataset dataset=DatasetUtilities.createCategoryDataset("S","C",data); return ChartFactory.createStackedAreaChart("Stacked Area Chart","Domain","Range",dataset,PlotOrientation.HORIZONTAL,true,true,true); }
Create a stacked bar chart with sample data in the range -3 to +3.
public void rotate(float angle){ impl.rotate(nativeGraphics,angle); }
Rotates the coordinate system around a radian angle using the affine transform
public OutputLimitClause afterTimePeriodExpression(TimePeriodExpression afterTimePeriodExpression){ this.afterTimePeriodExpression=afterTimePeriodExpression; return this; }
Sets the after-keyword time period.
@Override public boolean hasDurableHandlerStore(){ return true; }
determine whether this allocator supports to store non-volatile handler or not. (it is a placeholder)
public void reset(){ Metamodel.resetModuleManager(); }
Resets the metamodel. This will impact any Ceylon code running on the same ClassLoader, across threads, and will crash them if they are not done running.
private void writeQNameAttribute(java.lang.String namespace,java.lang.String attName,javax.xml.namespace.QName qname,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace=qname.getNamespaceURI(); java.lang.String attributePrefix=xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix=registerPrefix(xmlWriter,attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue=attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue=qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attributeValue); } else { registerPrefix(xmlWriter,namespace); xmlWriter.writeAttribute(namespace,attName,attributeValue); } }
Util method to write an attribute without the ns prefix
public BoolStack(int size){ m_allocatedSize=size; m_values=new boolean[size]; m_index=-1; }
Construct a IntVector, using the given block size.
public Fraction invert(){ if (numerator == 0) { throw new ArithmeticException("Unable to invert zero."); } if (numerator == Integer.MIN_VALUE) { throw new ArithmeticException("overflow: can't negate numerator"); } if (numerator < 0) { return new Fraction(-denominator,-numerator); } return new Fraction(denominator,numerator); }
<p>Gets a fraction that is the inverse (1/fraction) of this one.</p> <p>The returned fraction is not reduced.</p>
public static void openURL(Component parent,String url,boolean showDialog){ String osName=System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class<?> fileMgr=Class.forName("com.apple.eio.FileManager"); Method openURL=fileMgr.getDeclaredMethod("openURL",new Class[]{String.class}); openURL.invoke(null,new Object[]{url}); } else if (osName.startsWith("Windows")) { Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); } else { String browser=null; for (int count=0; count < LINUX_BROWSERS.length && browser == null; count++) { if (Runtime.getRuntime().exec(new String[]{"which",LINUX_BROWSERS[count]}).waitFor() == 0) { browser=LINUX_BROWSERS[count]; break; } } if (browser == null) { throw new Exception("Could not find web browser"); } else { Runtime.getRuntime().exec(new String[]{browser,url}); } } } catch ( Exception e) { String errMsg="Error attempting to launch web browser:\n" + e.getMessage(); if (showDialog) { JOptionPane.showMessageDialog(parent,errMsg); } else { System.err.println(errMsg); } } }
opens the URL in a browser.
@Override public String generateToolTip(XYZDataset dataset,int series,int item){ return generateLabelString(dataset,series,item); }
Generates a tool tip text item for a particular item within a series.
public String encode(Token token){ if (iobBeginMap.containsKey(token.getBegin())) { return "B-" + iobBeginMap.get(token.getBegin()); } if (iobInsideMap.containsKey(token.getBegin())) { return "I-" + iobInsideMap.get(token.getBegin()); } return "O"; }
Returns the IOB tag for a given token.
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){ switch (featureID) { case N4JSPackage.PARAMETERIZED_CALL_EXPRESSION__TYPE_ARGS: return getTypeArgs(); case N4JSPackage.PARAMETERIZED_CALL_EXPRESSION__TARGET: return getTarget(); case N4JSPackage.PARAMETERIZED_CALL_EXPRESSION__ARGUMENTS: return getArguments(); } return super.eGet(featureID,resolve,coreType); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public String toVerboseString(){ StringBuffer result=new StringBuffer(); result.append("Database ["); result.append(getName()); result.append("] tables:"); for (int idx=0; idx < getTableCount(); idx++) { result.append(" "); result.append(getTable(idx).toVerboseString()); } return result.toString(); }
Returns a verbose string representation of this database.
synchronized void maybeThrowDeterministicException() throws IOException { if (failures != null) { for (int i=0; i < failures.size(); i++) { try { failures.get(i).eval(this); } catch ( Throwable t) { if (LuceneTestCase.VERBOSE) { System.out.println("MockDirectoryWrapper: throw exc"); t.printStackTrace(System.out); } IOUtils.reThrow(t); } } } }
Iterate through the failures list, giving each object a chance to throw an IOE
public void updateSunToCurrentTime(Time time,int canvasWidth,int canvasHeight){ calculateSunlightRatio(time); calculateSunRotation(0.0f,time,canvasWidth,canvasHeight); }
Updates the Sun Position to the current time.
public Wildcard createWildcard(){ WildcardImpl wildcard=new WildcardImpl(); return wildcard; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public Address zipCode(String zipCode){ this.zipCode=zipCode; return this; }
Sets the zip code as a string.
public DERSequence(ASN1EncodableVector v){ super(v); }
create a sequence containing a vector of objects.
public void writeTyped(int type,Xdrable item) throws IOException { int size; if (item == null) { writeInt(1); write(type); size=1; } else { size=item.getLength() + 1; writeInt(size); write(type); item.write(this); } writeAlignment(size); }
Write an <code>Xdrable</code> to this output stream.
public int read(InputStream in) throws IOException { ByteBuffer buffer=getByteBuffer(); int size=size(); int remaining=size - buffer.position(); if (remaining == 0) remaining=size; int alreadyRead=size - remaining; if (buffer.hasArray()) { int offset=buffer.arrayOffset() + getByteBufferPosition(); int bytesRead=in.read(buffer.array(),offset + alreadyRead,remaining); buffer.position(getByteBufferPosition() + alreadyRead + bytesRead - offset); return bytesRead; } else { synchronized (buffer) { if (_bytes == null) { _bytes=new byte[size()]; } int bytesRead=in.read(_bytes,0,remaining); buffer.position(getByteBufferPosition() + alreadyRead); buffer.put(_bytes,0,bytesRead); return bytesRead; } } }
Reads this struct from the specified input stream (convenience method when using Stream I/O). For better performance, use of Block I/O (e.g. <code>java.nio.channels.*</code>) is recommended. This method behaves appropriately when not all of the data is available from the input stream. Incomplete data is extremely common when the input stream is associated with something like a TCP connection. The typical usage pattern in those scenarios is to repeatedly call read() until the entire message is received.
public Rotate3dAnimation(float fromDegrees,float toDegrees,float centerX,float centerY,float depthZ,boolean reverse){ mFromDegrees=fromDegrees; mToDegrees=toDegrees; mCenterX=centerX; mCenterY=centerY; mDepthZ=depthZ; mReverse=reverse; }
Creates a new 3D rotation on the Y axis. The rotation is defined by its start angle and its end angle. Both angles are in degrees. The rotation is performed around a center point on the 2D space, definied by a pair of X and Y coordinates, called centerX and centerY. When the animation starts, a translation on the Z axis (depth) is performed. The length of the translation can be specified, as well as whether the translation should be reversed in time.
public static <T>T loadSpringBean(URL springXmlUrl,String beanName) throws IgniteCheckedException { A.notNull(springXmlUrl,"springXmlUrl"); A.notNull(beanName,"beanName"); IgniteSpringHelper spring=SPRING.create(false); return spring.loadBean(springXmlUrl,beanName); }
Loads spring bean by name.
public static boolean isApplicationInBackground(Context context){ ActivityManager am=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> taskList=am.getRunningTasks(1); if (taskList != null && !taskList.isEmpty()) { ComponentName topActivity=taskList.get(0).topActivity; if (topActivity != null && !topActivity.getPackageName().equals(context.getPackageName())) { return true; } } return false; }
whether application is in background <ul> <li>need use permission android.permission.GET_TASKS in Manifest.xml</li> </ul>
public boolean isVariable(long arc){ switch ((int)arc) { case 9: case 8: case 7: case 6: case 5: case 4: case 3: case 11: case 2: case 10: case 1: return true; default : break; } return false; }
Returns true if "arc" identifies a scalar object.
static void checkAccess(final int access,final int possibleAccess){ if ((access & ~possibleAccess) != 0) { throw new IllegalArgumentException("Invalid access flags: " + access); } int pub=(access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1; int pri=(access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1; int pro=(access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1; if (pub + pri + pro > 1) { throw new IllegalArgumentException("public private and protected are mutually exclusive: " + access); } int fin=(access & Opcodes.ACC_FINAL) == 0 ? 0 : 1; int abs=(access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1; if (fin + abs > 1) { throw new IllegalArgumentException("final and abstract are mutually exclusive: " + access); } }
Checks that the given access flags do not contain invalid flags. This method also checks that mutually incompatible flags are not set simultaneously.
@Override public void aggregateMeasure(AbstractScannedResult scannedResult,MeasureAggregator[] aggrgeator){ for (short i=0; i < measuresOrdinal.length; i++) { if (isMeasureExistsInCurrentBlock[i]) { aggrgeator[measureColumnStartIndex + i].agg(scannedResult.getMeasureChunk(measuresOrdinal[i]),scannedResult.getCurrenrRowId()); } else { aggrgeator[measureColumnStartIndex + i].agg(measureDefaultValue[i]); } } }
Below method will be used to aggregate the measure value
public void nextBytes(byte[] bytes,int start,int len){ doNextBytes(bytes,start,len); }
Fill part of bytes with random values.
public static boolean hasNestedExceptions(InvocationSequenceData data){ return (null != data.isNestedExceptions()) && data.isNestedExceptions().booleanValue(); }
Checks whether this data object has nested SQL statements.
protected boolean compare(Instance inst1,Instance inst2){ boolean result; int i; result=(inst1.numAttributes() == inst2.numAttributes()); if (result) { for (i=0; i < inst1.numAttributes(); i++) { if (Double.isNaN(inst1.value(i)) && (Double.isNaN(inst2.value(i)))) { continue; } if (inst1.value(i) != inst2.value(i)) { result=false; System.out.println("Values at position " + (i + 1) + " differ (Filter/Source code): "+ inst1.value(i)+ " != "+ inst2.value(i)); break; } } } return result; }
compares two Instance
protected void sequence_AnnotatedExportableElement_InterfaceImplementsList_Members_TypeVariables(ISerializationContext context,N4InterfaceDeclaration semanticObject){ genericSequencer.createSequence(context,semanticObject); }
Contexts: AnnotatedExportableElement<Yield> returns N4InterfaceDeclaration AnnotatedExportableElement returns N4InterfaceDeclaration Constraint: ( annotationList=AnnotatedExportableElement_N4InterfaceDeclaration_1_2_0_1_0 declaredModifiers+=N4Modifier* typingStrategy=TypingStrategyDefSiteOperator? name=BindingIdentifier (typeVars+=TypeVariable typeVars+=TypeVariable*)? (superInterfaceRefs+=ParameterizedTypeRefNominal superInterfaceRefs+=ParameterizedTypeRefNominal*)? ownedMembersRaw+=N4MemberDeclaration )
public static final HashMap<String,Integer> countCombinations(Instances D,int L){ HashMap<String,Integer> map=new HashMap<String,Integer>(); for (int i=0; i < D.numInstances(); i++) { String y=MLUtils.toBitString(D.instance(i),L); Integer c=map.get(y); map.put(y,c == null ? 1 : c + 1); } return map; }
CountCombinations - return a mapping of each distinct label combination and its count. NOTE: A sparse representation would be much better for many applications, i.e., instead of using toBitString(...), use toSparseRepresentation(...) instead.
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){ switch (featureID) { case UmplePackage.ORDINAL_OP___GREATER_OP_1: return ((InternalEList<?>)getGreaterOp_1()).basicRemove(otherEnd,msgs); case UmplePackage.ORDINAL_OP___LESS_OP_1: return ((InternalEList<?>)getLessOp_1()).basicRemove(otherEnd,msgs); case UmplePackage.ORDINAL_OP___MORE_OP_1: return ((InternalEList<?>)getMoreOp_1()).basicRemove(otherEnd,msgs); case UmplePackage.ORDINAL_OP___SMALLER_OP_1: return ((InternalEList<?>)getSmallerOp_1()).basicRemove(otherEnd,msgs); } return super.eInverseRemove(otherEnd,featureID,msgs); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void init(boolean forEncryption,CipherParameters param){ if (param instanceof ParametersWithRandom) { ParametersWithRandom rParam=(ParametersWithRandom)param; key=(RSAKeyParameters)rParam.getParameters(); } else { key=(RSAKeyParameters)param; } this.forEncryption=forEncryption; }
initialise the RSA engine.
public void writeRawBytes(final ByteString value,int offset,int length) throws IOException { if (limit - position >= length) { value.copyTo(buffer,offset,position,length); position+=length; totalBytesWritten+=length; } else { final int bytesWritten=limit - position; value.copyTo(buffer,offset,position,bytesWritten); offset+=bytesWritten; length-=bytesWritten; position=limit; totalBytesWritten+=bytesWritten; refreshBuffer(); if (length <= limit) { value.copyTo(buffer,offset,0,length); position=length; } else { value.writeTo(output,offset,length); } totalBytesWritten+=length; } }
Write part of a byte string.
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.
private void fireInvitationRejectionListeners(String invitee,String reason){ InvitationRejectionListener[] listeners; synchronized (invitationRejectionListeners) { listeners=new InvitationRejectionListener[invitationRejectionListeners.size()]; invitationRejectionListeners.toArray(listeners); } for ( InvitationRejectionListener listener : listeners) { listener.invitationDeclined(invitee,reason); } }
Fires invitation rejection listeners.
public Set<String> classNames(){ return element.classNames(); }
Gets the element's CSS classes.
public void add(E newObject){ list.add(newObject); int currentIndex=list.size() - 1; while (currentIndex > 0) { int parentIndex=(currentIndex - 1) / 2; if (comparator.compare(list.get(currentIndex),list.get(parentIndex)) > 0) { E temp=list.get(currentIndex); list.set(currentIndex,list.get(parentIndex)); list.set(parentIndex,temp); } else break; currentIndex=parentIndex; } }
Add a new object into the heap
public static Statement union(boolean distinct,Statement... subQueries){ QueryStatement stmt=new QueryStatement(); String unionOperator=distinct ? " UNION " : " UNION ALL "; for (int i=0; i < subQueries.length; i++) { if (i > 0) stmt.statement.append(unionOperator); stmt.statement.append(subQueries[i]); } return stmt; }
Producing an UNION statement that combine the results of two or more SELECT statements.
private GuacamoleProperties(){ }
GuacamoleProperties is a utility class and cannot be instantiated.
public void printStackTrace(PrintWriter s){ super.printStackTrace(s); }
Prints this <code>URIReferenceException</code>, its backtrace and the cause's backtrace to the specified print writer.
public static String decode(byte[] utf8) throws CharacterCodingException { return decode(ByteBuffer.wrap(utf8),true); }
Converts the provided byte array to a String using the UTF-8 encoding. If the input is malformed, replace by a default value.
public static ColorStateList valueOf(int color){ synchronized (sCache) { WeakReference<ColorStateList> ref=sCache.get(color); ColorStateList csl=ref != null ? ref.get() : null; if (csl != null) { return csl; } csl=new ColorStateList(EMPTY,new int[]{color}); sCache.put(color,new WeakReference<ColorStateList>(csl)); return csl; } }
Creates or retrieves a ColorStateList that always returns a single color.
public boolean contains(String user){ return getEntry(user) != null; }
Returns true if the specified XMPP address is an entry in this group.
@Override protected boolean isFrontierEmpty(){ return frontier.isEmpty(); }
Checks whether the frontier contains not yet expanded nodes.
public static OrderByClause create(){ return new OrderByClause(); }
Create an empty order-by clause.
public void clear(){ oredCriteria.clear(); orderByClause=null; distinct=false; }
This method was generated by MyBatis Generator. This method corresponds to the database table subscriber
public synchronized void clear(){ listeners=EmptyArray; }
Removes all listeners from this list.
public Token(int length,byte id){ this.length=length; this.id=id; }
Creates a new token.
@Override public void insertBack(int x){ if (size == items.length) { resize((int)(size * 1.01)); } items[size]=x; size=size + 1; }
Inserts X into the back of the list.
public void remove(BTDownload downloader){ super.remove(downloader); downloader.remove(); }
Overrides the default remove. <p/> Takes action upon downloaded theme files, asking if the user wants to apply the theme. <p/> Removes a download from the list if the user has configured their system to automatically clear completed download and if the download is complete.
private CDatabaseManager(){ }
Creates a new Database manager object.
public void handlePeriodicMaintenance(Operation post){ post.complete(); }
Invoked by the host periodically, if ServiceOption.PERIODIC_MAINTENANCE is set. ServiceMaintenanceRequest object is set in the operation body, with the reasons field indicating the maintenance reason. An implementation of this method that needs to interact with the state of this service must do so as if it were a client of this service. That is: the state of the service should be retrieved by requesting a GET; and the state of the service should be mutated by submitting a PATCH, PUT or DELETE.
protected byte[] engineDoFinal(byte[] input,int inputOffset,int inputLen) throws IllegalBlockSizeException, BadPaddingException { throw new IllegalStateException("Cipher has not been initialized"); }
This operation is not supported by this cipher. Since it's impossible to initialize this cipher given the current Cipher.engineInit(...) implementation, IllegalStateException will always be thrown upon invocation.
@Override public String toString(){ if (this.getObject() == null) { return this.getStyle().getNullText(); } Class<?> clazz=this.getObject().getClass(); this.appendFieldsIn(clazz); while (clazz.getSuperclass() != null && clazz != this.getUpToClass()) { clazz=clazz.getSuperclass(); this.appendFieldsIn(clazz); } return super.toString(); }
<p> Gets the String built by this builder. </p>
public Certificate[] engineGetCertificateChain(String alias){ Entry entry=entries.get(alias.toLowerCase(Locale.ENGLISH)); if (entry != null && entry instanceof PrivateKeyEntry) { if (((PrivateKeyEntry)entry).chain == null) { return null; } else { if (debug != null) { debug.println("Retrieved a " + ((PrivateKeyEntry)entry).chain.length + "-certificate chain at alias '"+ alias+ "'"); } return ((PrivateKeyEntry)entry).chain.clone(); } } else { return null; } }
Returns the certificate chain associated with the given alias.
public BuyClientBuilder httpTimeout(final long httpConnectionTimeoutMs,final long httpReadWriteTimeoutMs){ this.httpConnectionTimeoutMs=httpConnectionTimeoutMs; this.httpReadWriteTimeoutMs=httpReadWriteTimeoutMs; return this; }
Sets the default http timeouts for new connections. A value of 0 means no timeout, otherwise values must be between 1 and Long.MAX_VALUE.
public final boolean asXml(){ return markupMode == MarkupRenderMode.XML; }
True iff DOM tree nodes should be rendered as XML.
private void addExportSnapshotSteps(Workflow workflow,ProtectionSystem rpSystem,URI exportGroupID,Map<URI,Integer> snapshots,List<URI> initiatorURIs) throws InternalException { ExportGroup exportGroup=_dbClient.queryObject(ExportGroup.class,exportGroupID); String exportStep=workflow.createStepId(); initTaskStatus(exportGroup,exportStep,Operation.Status.pending,"create export"); Map<URI,Map<URI,Integer>> storageToBlockObjects=getStorageToBlockObjects(snapshots); for ( Map.Entry<URI,Map<URI,Integer>> entry : storageToBlockObjects.entrySet()) { _log.info(String.format("Adding workflow step to export RP bookmark and associated target volumes. ExportGroup: %s, Initiators: %s, Volume Map: %s",exportGroup.getId(),initiatorURIs,entry.getValue())); _exportWfUtils.generateExportGroupCreateWorkflow(workflow,null,STEP_ENABLE_IMAGE_ACCESS,entry.getKey(),exportGroupID,entry.getValue(),initiatorURIs); } _log.info("Finished adding export group create steps in workflow: " + exportGroup.getId()); }
Method that adds the export snapshot step.
public boolean isHeader(){ return isHeader(this.myHeader); }
Check that this HDU has a valid header.
public boolean execute(String action,JSONArray args,CallbackContext callbackContext) throws JSONException { if (this.cordova.getActivity().isFinishing()) return true; if (action.equals("beep")) { this.beep(args.getLong(0)); } else if (action.equals("alert")) { this.alert(args.getString(0),args.getString(1),args.getString(2),callbackContext); return true; } else if (action.equals("confirm")) { this.confirm(args.getString(0),args.getString(1),args.getJSONArray(2),callbackContext); return true; } else if (action.equals("prompt")) { this.prompt(args.getString(0),args.getString(1),args.getJSONArray(2),args.getString(3),callbackContext); return true; } else if (action.equals("activityStart")) { this.activityStart(args.getString(0),args.getString(1)); } else if (action.equals("activityStop")) { this.activityStop(); } else if (action.equals("progressStart")) { this.progressStart(args.getString(0),args.getString(1)); } else if (action.equals("progressValue")) { this.progressValue(args.getInt(0)); } else if (action.equals("progressStop")) { this.progressStop(); } else { return false; } callbackContext.success(); return true; }
Executes the request and returns PluginResult.
public void deleteSortLocationIfExists() throws CarbonSortKeyAndGroupByException { CarbonDataProcessorUtil.deleteSortLocationIfExists(this.tempFileLocation); }
This method will be used to delete sort temp location is it is exites
public TokenScanner(IDocument document,IJavaProject project){ String sourceLevel=project.getOption(JavaCore.COMPILER_SOURCE,true); String complianceLevel=project.getOption(JavaCore.COMPILER_COMPLIANCE,true); fScanner=ToolFactory.createScanner(true,false,false,sourceLevel,complianceLevel); fScanner.setSource(document.get().toCharArray()); fDocument=document; fEndPosition=fScanner.getSource().length - 1; }
Creates a TokenScanner
public void addDropItem(final String name,final double probability,final int amount){ dropsItems.add(new DropItem(name,probability,amount)); }
adds a named item to the List of Items that will be dropped on dead if clearDropItemList hasn't been called first, this will change all creatures of this kind.
public static <K,V>HashMap<K,V> hashMap(int initialCapacity){ return new HashMap<K,V>(initialCapacity); }
Create a new HashMap.
public ImageResizer(Context context,int imageWidth,int imageHeight){ super(context); setImageSize(imageWidth,imageHeight); }
Initialize providing a single target image size (used for both width and height);
public final boolean a1Castle(){ return (castleMask & (1 << A1_CASTLE)) != 0; }
Return true if white long castling right has not been lost.
public void initialize() throws NetworkDeviceControllerException { SSHPrompt[] prompts={SSHPrompt.POUND,SSHPrompt.GREATER_THAN}; StringBuilder buf=new StringBuilder(); SSHPrompt got=waitFor(prompts,defaultTimeout,buf,true); String[] lines=buf.toString().split("[\n\r]+"); String lastLine=lines[lines.length - 1]; String[] groups=new String[2]; if (match(lastLine,new String[]{MDSDialogProperties.getString("MDSDialog.initalize.match") + got.getRegex()},groups) == 0) { devname=groups[0]; } sendWaitFor(MDSDialogProperties.getString("MDSDialog.initialize.termlength.cmd"),5000,prompts,buf); _log.info(buf.toString()); }
This initializes a new session, gathering the prompts, and setting the terminal length.
protected Object processXmlHttpResponse(CloseableHttpResponse response,String actionDescription,Class<?>... responseClass){ StatusLine responseStatusLine=response.getStatusLine(); Object responseObject=null; String xmlResponse=""; HttpErrorResponseException errorException=null; try { if (responseStatusLine.getStatusCode() == 200) { xmlResponse=IOUtils.toString(response.getEntity().getContent(),StandardCharsets.UTF_8.name()); InputStream inputStream=new ByteArrayInputStream(xmlResponse.getBytes(StandardCharsets.UTF_8)); JAXBContext responseContext=JAXBContext.newInstance(responseClass); Unmarshaller responseUnmarshaller=responseContext.createUnmarshaller(); responseObject=responseUnmarshaller.unmarshal(inputStream); } else { xmlResponse=IOUtils.toString(response.getEntity().getContent(),StandardCharsets.UTF_8.name()); InputStream inputStream=new ByteArrayInputStream(xmlResponse.getBytes(StandardCharsets.UTF_8)); JAXBContext responseContext=JAXBContext.newInstance(ErrorInformation.class); Unmarshaller responseUnmarshaller=responseContext.createUnmarshaller(); ErrorInformation errorInfo=(ErrorInformation)responseUnmarshaller.unmarshal(inputStream); errorException=new HttpErrorResponseException("Failed to " + actionDescription,errorInfo.getStatusCode(),errorInfo.getStatusDescription(),errorInfo.getMessage()); } } catch ( IOException|JAXBException e) { LOGGER.warn("Failed to get or process HTTP response from the registration server.",e); LOGGER.warn(String.format(" HTTP Response Status: %s",responseStatusLine)); LOGGER.warn(String.format(" HTTP Response: %s",xmlResponse)); errorException=new HttpErrorResponseException("Failed to " + actionDescription,responseStatusLine.getStatusCode(),responseStatusLine.getReasonPhrase(),xmlResponse); } finally { try { response.close(); } catch ( Exception ex) { LOGGER.warn("Unable to close HTTP response.",ex); } } if (errorException != null) { throw errorException; } return responseObject; }
Extracts an instance of the specified object class from the registration server response.
private void ok(){ int keepalive; int timeout; Intent intent=new Intent(); if (resultData == null) { resultData=new Bundle(); resultData.putString(ActivityConstants.message,ActivityConstants.empty); resultData.putString(ActivityConstants.topic,ActivityConstants.empty); resultData.putInt(ActivityConstants.qos,ActivityConstants.defaultQos); resultData.putBoolean(ActivityConstants.retained,ActivityConstants.defaultRetained); } intent.putExtras(resultData); String username=((EditText)findViewById(R.id.uname)).getText().toString(); String password=((EditText)findViewById(R.id.password)).getText().toString(); String sslkey=null; boolean ssl=((CheckBox)findViewById(R.id.sslCheckBox)).isChecked(); if (ssl) { sslkey=((EditText)findViewById(R.id.sslKeyLocaltion)).getText().toString(); } try { timeout=Integer.parseInt(((EditText)findViewById(R.id.timeout)).getText().toString()); } catch ( NumberFormatException nfe) { timeout=ActivityConstants.defaultTimeOut; } try { keepalive=Integer.parseInt(((EditText)findViewById(R.id.keepalive)).getText().toString()); } catch ( NumberFormatException nfe) { keepalive=ActivityConstants.defaultKeepAlive; } intent.putExtra(ActivityConstants.username,username); intent.putExtra(ActivityConstants.password,password); intent.putExtra(ActivityConstants.timeout,timeout); intent.putExtra(ActivityConstants.keepalive,keepalive); intent.putExtra(ActivityConstants.ssl,ssl); intent.putExtra(ActivityConstants.ssl_key,sslkey); advanced.setResult(RESULT_OK,intent); advanced.finish(); }
Packs all the options the user has chosen, along with defaults the user has not chosen
public NonRepeatableRequestException(String message){ super(message); }
Creates a new NonRepeatableEntityException with the specified detail message.
@Override public GitClient git(){ return new DefaultGitClient(url,authenticationManager); }
Returns the Git API client.
static boolean isRegistered(final Object value){ final Map<Object,Object> m=getRegistry(); return m != null && m.containsKey(value); }
<p> Returns <code>true</code> if the registry contains the given object. Used by the reflection methods to avoid infinite loops. </p>
public void clear(){ if (mSize != 0) { freeArrays(mHashes,mArray,mSize); mHashes=EMPTY_INTS; mArray=EMPTY_OBJECTS; mSize=0; } }
Make the array map empty. All storage is released.
public NotificationChain basicSetInitSequence(Sequence newInitSequence,NotificationChain msgs){ Sequence oldInitSequence=initSequence; initSequence=newInitSequence; if (eNotificationRequired()) { ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,SexecPackage.EXECUTION_FLOW__INIT_SEQUENCE,oldInitSequence,newInitSequence); if (msgs == null) msgs=notification; else msgs.add(notification); } return msgs; }
<!-- begin-user-doc --> <!-- end-user-doc -->
protected S_ReflexImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public StrBuilder deleteFirst(final String str){ final int len=(str == null ? 0 : str.length()); if (len > 0) { final int index=indexOf(str,0); if (index >= 0) { deleteImpl(index,index + len,len); } } return this; }
Deletes the string wherever it occurs in the builder.
private form fillForm(WWindowStatus ws,String action,MLocation location,String targetBase,boolean addStart){ form myForm=null; myForm=new form(action).setName("WLocation"); myForm.setID("Location"); myForm.setTitle("Location"); myForm.addAttribute("selected","true"); myForm.setClass("panel"); myForm.setMethod("post"); myForm.addElement(new input(input.TYPE_HIDDEN,P_TARGET,targetBase)); myForm.addElement(new input(input.TYPE_HIDDEN,P_C_LOCATION_ID,location.getC_Location_ID())); fieldset fs=new fieldset(); fs.setID("WLocation"); div line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Address") + " 1")); input myInput=null; myInput=new input(input.TYPE_TEXT,P_ADDRESS1,location.getAddress1()); line.addElement(myInput); fs.addElement(line); line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Address") + " 2")); myInput=new input(input.TYPE_TEXT,P_ADDRESS2,location.getAddress2()); line.addElement(myInput); fs.addElement(line); line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Address") + " 3")); myInput=new input(input.TYPE_TEXT,P_ADDRESS3,location.getAddress3()); line.addElement(myInput); fs.addElement(line); line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Address") + " 4")); myInput=new input(input.TYPE_TEXT,P_ADDRESS4,location.getAddress4()); line.addElement(myInput); fs.addElement(line); line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"City"))); myInput=new input(input.TYPE_TEXT,P_CITY,location.getCity()); line.addElement(myInput); line=new div(); line.setClass("row"); if (location.getCountry().isHasRegion()) { line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Region"))); line.addElement(getRegion(location,ws)); } line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Postal"))); myInput=new input(input.TYPE_TEXT,P_POSTAL,location.getPostal()); myInput.setMaxlength(10).setSize(6); line.addElement(myInput); fs.addElement(line); line=new div(); line.setClass("row"); line.addElement(new label().addElement(Msg.getMsg(ws.ctx,"Country"))); line.addElement(this.getCountry(location,ws)); fs.addElement(line); line=new div(); line.setClass("row"); StringBuffer script=new StringBuffer(); script.append(targetBase).append("D.value='").append("temp").append("';").append(targetBase).append("F.value='").append("temp").append("';submit();closePopup();"); a button=new a("#","Submit"); button.addAttribute("type","submit"); button.setClass("whiteButton"); button.setOnClick(script.toString()); line.addElement(button); fs.addElement(line); myForm.addElement(fs); return myForm; }
Fill Address Form
public SynchronizedHardReferenceQueue(final HardReferenceQueueEvictionListener<T> listener,final int capacity,final int nscan){ this.queue=new InnerHardReferenceQueue(listener,capacity,DEFAULT_NSCAN); }
Core impl.
public FacetResult search() throws IOException { FacetsCollector fc=new FacetsCollector(); searcher.search(new MatchAllDocsQuery(),fc); Facets facets=new DoubleRangeFacetCounts("field",getDistanceValueSource(),fc,getBoundingBoxQuery(ORIGIN_LATITUDE,ORIGIN_LONGITUDE,10.0),ONE_KM,TWO_KM,FIVE_KM,TEN_KM); return facets.getTopChildren(10,"field"); }
User runs a query and counts facets.
@Override protected void overrideIdentifierData(EmaApiIdentifierType identifier) throws EmaException { identifier.setEmbedLevel(EmaApi.EMA_EMBED_LEVEL_EXTERNAL_STR); }
Set specific embed level for this event in CallHome Identifier section.
private static ThreadState convertThreadState(final int value){ switch (value) { case 0: return ThreadState.RUNNING; case 1: return ThreadState.SUSPENDED; default : throw new IllegalArgumentException(String.format("Received invalid thread state %d",value)); } }
Converts the numerical value of a thread state into the proper enumeration value.
public static QueryLanguage valueOf(String qlName){ for ( QueryLanguage ql : QUERY_LANGUAGES) { if (ql.getName().equalsIgnoreCase(qlName)) { return ql; } } return null; }
Returns the query language whose name matches the specified name.
static String primitiveTypeLabel(char typeChar){ switch (typeChar) { case 'B': return "byte"; case 'C': return "char"; case 'D': return "double"; case 'F': return "float"; case 'I': return "int"; case 'J': return "long"; case 'S': return "short"; case 'V': return "void"; case 'Z': return "boolean"; default : System.err.println("Unexpected class char " + typeChar); assert false; return "UNKNOWN"; } }
Converts a single-character primitive type into its human-readable equivalent.
public void removeMethod(SootMethod m){ checkLevel(SIGNATURES); if (!m.isDeclared() || m.getDeclaringClass() != this) throw new RuntimeException("incorrect declarer for remove: " + m.getName()); if (subSigToMethods.get(m.getNumberedSubSignature()) == null) { throw new RuntimeException("Attempt to remove method " + m.getSubSignature() + " which is not in class "+ this); } subSigToMethods.put(m.getNumberedSubSignature(),null); methodList.remove(m); m.isDeclared=false; }
Removes the given method from this class.
public static void reportPropertyDescriptor(PropertyDescriptor pd){ System.out.println("property name: " + pd.getName()); System.out.println(" type: " + pd.getPropertyType()); System.out.println(" read: " + pd.getReadMethod()); System.out.println(" write: " + pd.getWriteMethod()); if (pd instanceof IndexedPropertyDescriptor) { IndexedPropertyDescriptor ipd=(IndexedPropertyDescriptor)pd; System.out.println(" indexed type: " + ipd.getIndexedPropertyType()); System.out.println(" indexed read: " + ipd.getIndexedReadMethod()); System.out.println(" indexed write: " + ipd.getIndexedWriteMethod()); } }
Reports all the interesting information in an Indexed/PropertyDescrptor.
public void add(Value value){ Key subKey=makeSubKey(value); client.put(this.policy,subKey,new Bin(ListElementBinName,value)); client.operate(this.policy,this.key,ListOperation.append(this.binNameString,Value.get(subKey.digest))); }
Add value to list. Fail if value's key exists and list is configured for unique keys. If value is a map, the key is identified by "key" entry. Otherwise, the value is the key. If large list does not exist, create it. <p>
public int size(){ return counter.get(); }
return the size (i.e. Elements present in the Queue)
public void verifyIncludedAndExcludedSegments(SegmentedTimeline timeline,long n){ timeline.setExceptionSegments(new java.util.ArrayList()); SegmentedTimeline.Segment segment=timeline.getSegment(n); for (int i=0; i < 1000; i++) { int d=(i % timeline.getGroupSegmentCount()); if (d < timeline.getSegmentsIncluded()) { assertTrue(segment.inIncludeSegments()); assertTrue(!segment.inExcludeSegments()); assertTrue(!segment.inExceptionSegments()); } else { assertTrue(!segment.inIncludeSegments()); assertTrue(segment.inExcludeSegments()); assertTrue(!segment.inExceptionSegments()); } segment.inc(); } }
Tests that a timeline's included and excluded segments are being calculated correctly.
private boolean acquireDestroyReadLock(long millis) throws InterruptedException { boolean interrupted=Thread.interrupted(); try { if (interrupted && this.dlock.isInterruptibleLockRequest()) { throw new InterruptedException(); } while (true) { try { this.dm.getCancelCriterion().checkCancelInProgress(null); boolean acquired=this.destroyLock.readLock().tryLock(millis); return acquired; } catch ( InterruptedException e) { interrupted=true; throwIfInterruptible(e); } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Acquires a read lock on the destroy ReadWrite lock uninterruptibly using millis for try-lock attempt.
public Arg(QName qname,String expression,boolean isFromWithParam){ m_qname=qname; m_val=null; m_expression=expression; m_isFromWithParam=isFromWithParam; m_isVisible=!isFromWithParam; }
Construct a parameter argument that contains an expression.
private void startProtectionSystem(ProtectionSystem system) throws InternalException { ProtectionController controller=getProtectionController(system.getSystemType()); controller.connect(system.getId()); }
Invoke connect protection. Once system is verified to be registered. Statistics, Events will be collected for only registered systems.
public static void init(){ if (SecurityPolicy.get() != SecurityPolicy.NONE) { INSTANCE=new ToastSecurityManager(); System.setSecurityManager(INSTANCE); main=Thread.currentThread().getThreadGroup(); group=new ThreadGroup(Thread.currentThread().getThreadGroup(),"Toasted"); } }
Initialize the security manager. This is done by Toast during runtime and should NEVER be called by a module.