code
stringlengths
10
174k
nl
stringlengths
3
129k
@Override public void clear(){ this._map.clear(); }
Empties the map.
public boolean removeElement(int s){ if (null == m_map) return false; for (int i=0; i < m_firstFree; i++) { int node=m_map[i]; if (node == s) { if (i > m_firstFree) System.arraycopy(m_map,i + 1,m_map,i - 1,m_firstFree - i); else m_map[i]=DTM.NULL; m_firstFree--; return true; } } return false; }
Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.
private void addSingleton(TempCluster clus,DBIDRef id,double dist,boolean asCluster){ if (asCluster) { clus.addChild(makeSingletonCluster(id,dist)); } else { clus.add(id); } clus.depth=dist; }
Add a singleton object, as point or cluster.
public int size(){ return values.length; }
Returns the number of values in this kernel.
private void testServerJoinLate(Member.Type type,CopycatServer.State state) throws Throwable { createServers(3); CopycatClient client=createClient(); submit(client,0,1000); await(30000); CopycatServer joiner=createServer(nextMember(type)); joiner.onStateChange(null); joiner.join(members.stream().map(null).collect(Collectors.toList())).thenRun(null); await(30000,2); }
Tests joining a server after many entries have been committed.
public Shape createRadioButton(int x,int y,int diameter){ return createEllipseInternal(x,y,diameter,diameter); }
Return a path for a radio button's concentric sections.
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:11.638 -0500",hash_original_method="3CEC44303CC022BBEC9F119BC403FDBC",hash_generated_method="FD349EDA389F166F5AB5B32AD7B69928") public int size(){ return al.size(); }
Returns the number of elements in this set.
public static String formatRateString(float rate){ return String.format(java.util.Locale.US,"%.2fx",rate); }
Get the formatted current playback speed in the form of 1.00x
private static BitmapFactory.Options decodeImageForOption(ContentResolver resolver,Uri uri) throws FileNotFoundException { InputStream stream=null; try { stream=resolver.openInputStream(uri); BitmapFactory.Options options=new BitmapFactory.Options(); options.inJustDecodeBounds=true; BitmapFactory.decodeStream(stream,EMPTY_RECT,options); options.inJustDecodeBounds=false; return options; } finally { closeSafe(stream); } }
Decode image from uri using "inJustDecodeBounds" to get the image dimensions.
public FinalSQLString(BasicSQLString sqlstring){ this.delegate=sqlstring; }
Should only be called inside SQLString because this class essentially verifies that we've checked for updates.
public void loadArgArray(){ push(argumentTypes.length); newArray(OBJECT_TYPE); for (int i=0; i < argumentTypes.length; i++) { dup(); push(i); loadArg(i); box(argumentTypes[i]); arrayStore(OBJECT_TYPE); } }
Generates the instructions to load all the method arguments on the stack, as a single object array.
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { WebUtil.createLoginPage(request,response,this,null,null); }
Process the HTTP Get request
private DeferredFileOutputStream(int threshold,File outputFile,String prefix,String suffix,File directory){ super(threshold); this.outputFile=outputFile; memoryOutputStream=new ByteArrayOutputStream(); currentOutputStream=memoryOutputStream; this.prefix=prefix; this.suffix=suffix; this.directory=directory; }
Constructs an instance of this class which will trigger an event at the specified threshold, and save data either to a file beyond that point.
public final void testSetSystemScope(){ IdentityScope systemScope=IdentityScope.getSystemScope(); try { is=new IdentityScopeStub("Aleksei Semenov"); IdentityScopeStub.mySetSystemScope(is); assertSame(is,IdentityScope.getSystemScope()); } finally { IdentityScopeStub.mySetSystemScope(systemScope); } }
check that if permission given - set/get works if permission is denied than SecurityException is thrown
public static void main(String[] args){ runEvaluator(new WrapperSubsetEval(),args); }
Main method for testing this class.
public static void v(String tag,String msg,Object... args){ if (sLevel > LEVEL_VERBOSE) { return; } if (args.length > 0) { msg=String.format(msg,args); } Log.v(tag,msg); }
Send a VERBOSE log message.
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:04.267 -0500",hash_original_method="2CE5F24A4C571BEECB25C40400E44908",hash_generated_method="A3579B97578194B5EA0183D0F747142C") void computeNextElement(){ while (true) { if (currentBits != 0) { mask=currentBits & -currentBits; return; } else if (++index < bits.length) { currentBits=bits[index]; } else { mask=0; return; } } }
Assigns mask and index to the next available value, cycling currentBits as necessary.
public HierarchyEvent(Component source,int id,Component changed,Container changedParent,long changeFlags){ super(source,id); this.changed=changed; this.changedParent=changedParent; this.changeFlags=changeFlags; }
Constructs an <code>HierarchyEvent</code> object to identify a change in the <code>Component</code> hierarchy. <p> This method throws an <code>IllegalArgumentException</code> if <code>source</code> is <code>null</code>.
public void step(SimState state){ }
This method is performed when the next step for the agent is computed. This agent does nothing, so nothing is inside the body of the method.
public static void resetRuntime(){ currentTime=1392409281320L; wasTimeAccessed=false; hashKeys.clear(); restoreProperties(); needToRestoreProperties=false; }
Reset runtime to initial state
public ExpandCaseMultipliersAction(DataEditor editor){ super("Expand Case Multipliers"); if (editor == null) { throw new NullPointerException(); } this.dataEditor=editor; }
Creates a new action to split by collinear columns.
public ScaleFake(){ }
Creates a new instance of ScaleFake
protected ArrayElementImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public FilterRowIterator(IntIterator rows,Table t,Predicate p){ this.predicate=p; this.rows=rows; this.t=t; next=advance(); }
Create a new FilterRowIterator.
private void scanJar(JarURLConnection conn,List<String> tldNames,boolean isLocal) throws JasperException { String resourcePath=conn.getJarFileURL().toString(); TldInfo[] tldInfos=jarTldCacheLocal.get(resourcePath); if (tldInfos != null && tldInfos.length == 0) { try { conn.getJarFile().close(); } catch ( IOException ex) { } return; } if (tldInfos == null) { JarFile jarFile=null; ArrayList<TldInfo> tldInfoA=new ArrayList<TldInfo>(); try { jarFile=conn.getJarFile(); if (tldNames != null) { for ( String tldName : tldNames) { JarEntry entry=jarFile.getJarEntry(tldName); InputStream stream=jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath,tldName,stream)); } } else { Enumeration<JarEntry> entries=jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry=entries.nextElement(); String name=entry.getName(); if (!name.startsWith("META-INF/")) continue; if (!name.endsWith(".tld")) continue; InputStream stream=jarFile.getInputStream(entry); tldInfoA.add(scanTld(resourcePath,name,stream)); } } } catch ( IOException ex) { if (resourcePath.startsWith(FILE_PROTOCOL) && !((new File(resourcePath)).exists())) { if (log.isLoggable(Level.WARNING)) { log.log(Level.WARNING,Localizer.getMessage("jsp.warn.nojar",resourcePath),ex); } } else { throw new JasperException(Localizer.getMessage("jsp.error.jar.io",resourcePath),ex); } } finally { if (jarFile != null) { try { jarFile.close(); } catch ( Throwable t) { } } } tldInfos=tldInfoA.toArray(new TldInfo[tldInfoA.size()]); jarTldCacheLocal.put(resourcePath,tldInfos); if (!isLocal) { jarTldCache.put(resourcePath,tldInfos); } } for ( TldInfo tldInfo : tldInfos) { if (scanListeners) { addListener(tldInfo,isLocal); } mapTldLocation(resourcePath,tldInfo,isLocal); } }
Scans the given JarURLConnection for TLD files located in META-INF (or a subdirectory of it). If the scanning in is done as part of the ServletContextInitializer, the listeners in the tlds in this jar file are added to the servlet context, and for any TLD that has a <uri> element, an implicit map entry is added to the taglib map.
public static void cosft1(double[] y){ com.nr.fft.FFT.cosft1(y); }
Calculates the cosine transform of a set y[0..n] of real-valued data points. The transformed data replace the original data in array y. n must be a power of 2. This program, without changes, also calculates the inverse cosine transform, but in this case the output array should be multiplied by 2/n.
public void stop(){ mRunning=false; mStop=true; }
Stops the animation in place. It does not snap the image to its final translation.
public boolean hasNext(){ return cursor > 0; }
This is used to determine if the cursor has reached the start of the list. When the cursor reaches the start of the list then this method returns false.
@Override protected void onFinished(final Player player,final boolean successful){ if (successful) { final String itemName=items[Rand.rand(items.length)]; final Item item=SingletonRepository.getEntityManager().getItem(itemName); int amount=1; if (itemName.equals("dark dagger") || itemName.equals("horned golden helmet")) { item.setBoundTo(player.getName()); } else if (itemName.equals("money")) { amount=Rand.roll1D100(); ((StackableItem)item).setQuantity(amount); } player.equipOrPutOnGround(item); player.incObtainedForItem(item.getName(),item.getQuantity()); SingletonRepository.getAchievementNotifier().onObtain(player); player.sendPrivateText("You were lucky and found " + Grammar.quantityplnoun(amount,itemName,"a") + "."); } else { player.sendPrivateText("Your wish didn't come true."); } }
Called when the activity has finished.
public void saveWalletAndWalletInfoSimple(WalletData perWalletModelData,String walletFilename,String walletInfoFilename){ File walletFile=new File(walletFilename); WalletInfoData walletInfo=perWalletModelData.getWalletInfo(); FileOutputStream fileOutputStream=null; try { if (perWalletModelData.getWallet() != null) { if (walletInfo != null) { String walletDescriptionInInfoFile=walletInfo.getProperty(WalletInfoData.DESCRIPTION_PROPERTY); if (walletDescriptionInInfoFile != null) { perWalletModelData.getWallet().setDescription(walletDescriptionInInfoFile); } } log.debug("Saving wallet file '" + walletFile.getAbsolutePath() + "' ..."); if (MultiBitWalletVersion.SERIALIZED == walletInfo.getWalletVersion()) { throw new WalletSaveException("Cannot save wallet '" + walletFile.getAbsolutePath() + "'. Serialized wallets are no longer supported."); } else { boolean walletIsActuallyEncrypted=false; Wallet wallet=perWalletModelData.getWallet(); for ( ECKey key : wallet.getKeychain()) { if (key.isEncrypted()) { walletIsActuallyEncrypted=true; break; } } if (walletIsActuallyEncrypted) { walletInfo.setWalletVersion(MultiBitWalletVersion.PROTOBUF_ENCRYPTED); } if (MultiBitWalletVersion.PROTOBUF == walletInfo.getWalletVersion()) { perWalletModelData.getWallet().saveToFile(walletFile); } else if (MultiBitWalletVersion.PROTOBUF_ENCRYPTED == walletInfo.getWalletVersion()) { fileOutputStream=new FileOutputStream(walletFile); walletProtobufSerializer.writeWallet(perWalletModelData.getWallet(),fileOutputStream); } else { throw new WalletVersionException("Cannot save wallet '" + perWalletModelData.getWalletFilename() + "'. Its wallet version is '"+ walletInfo.getWalletVersion().toString()+ "' but this version of MultiBit does not understand that format."); } } log.debug("... done saving wallet file."); } } catch ( IOException ioe) { throw new WalletSaveException("Cannot save wallet '" + perWalletModelData.getWalletFilename(),ioe); } finally { if (fileOutputStream != null) { try { fileOutputStream.flush(); fileOutputStream.close(); } catch ( IOException e) { throw new WalletSaveException("Cannot save wallet '" + perWalletModelData.getWalletFilename(),e); } } } walletInfo.writeToFile(walletInfoFilename,walletInfo.getWalletVersion()); }
Simply save the wallet and wallet info files. Used for backup writes.
@Override public Object clone() throws CloneNotSupportedException { DefaultIntervalXYDataset clone=(DefaultIntervalXYDataset)super.clone(); clone.seriesKeys=new java.util.ArrayList(this.seriesKeys); clone.seriesList=new ArrayList(this.seriesList.size()); for (int i=0; i < this.seriesList.size(); i++) { double[][] data=(double[][])this.seriesList.get(i); double[] x=data[0]; double[] xStart=data[1]; double[] xEnd=data[2]; double[] y=data[3]; double[] yStart=data[4]; double[] yEnd=data[5]; double[] xx=new double[x.length]; double[] xxStart=new double[xStart.length]; double[] xxEnd=new double[xEnd.length]; double[] yy=new double[y.length]; double[] yyStart=new double[yStart.length]; double[] yyEnd=new double[yEnd.length]; System.arraycopy(x,0,xx,0,x.length); System.arraycopy(xStart,0,xxStart,0,xStart.length); System.arraycopy(xEnd,0,xxEnd,0,xEnd.length); System.arraycopy(y,0,yy,0,y.length); System.arraycopy(yStart,0,yyStart,0,yStart.length); System.arraycopy(yEnd,0,yyEnd,0,yEnd.length); clone.seriesList.add(i,new double[][]{xx,xxStart,xxEnd,yy,yyStart,yyEnd}); } return clone; }
Returns a clone of this dataset.
public EveningActivityMovement(Settings settings){ super(settings); super.backAllowed=false; pathFinder=new DijkstraPathFinder(null); mode=WALKING_TO_MEETING_SPOT_MODE; nrOfMeetingSpots=settings.getInt(NR_OF_MEETING_SPOTS_SETTING); minGroupSize=settings.getInt(MIN_GROUP_SIZE_SETTING); maxGroupSize=settings.getInt(MAX_GROUP_SIZE_SETTING); MapNode[] mapNodes=(MapNode[])getMap().getNodes().toArray(new MapNode[0]); String shoppingSpotsFile=null; try { shoppingSpotsFile=settings.getSetting(MEETING_SPOTS_FILE_SETTING); } catch ( Throwable t) { } List<Coord> meetingSpotLocations=null; if (shoppingSpotsFile == null) { meetingSpotLocations=new LinkedList<Coord>(); for (int i=0; i < mapNodes.length; i++) { if ((i % (mapNodes.length / nrOfMeetingSpots)) == 0) { startAtLocation=mapNodes[i].getLocation().clone(); meetingSpotLocations.add(startAtLocation.clone()); } } } else { try { meetingSpotLocations=new LinkedList<Coord>(); List<Coord> locationsRead=(new WKTReader()).readPoints(new File(shoppingSpotsFile)); for ( Coord coord : locationsRead) { SimMap map=getMap(); Coord offset=map.getOffset(); if (map.isMirrored()) { coord.setLocation(coord.getX(),-coord.getY()); } coord.translate(offset.getX(),offset.getY()); meetingSpotLocations.add(coord); } } catch ( Exception e) { e.printStackTrace(); } } this.id=nextID++; int scsID=settings.getInt(EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING); scs=EveningActivityControlSystem.getEveningActivityControlSystem(scsID); scs.setRandomNumberGenerator(rng); scs.addEveningActivityNode(this); scs.setMeetingSpots(meetingSpotLocations); maxPathLength=100; minPathLength=10; maxWaitTime=settings.getInt(MAX_WAIT_TIME_SETTING); minWaitTime=settings.getInt(MIN_WAIT_TIME_SETTING); }
Creates a new instance of EveningActivityMovement
protected Polygon makeHullComplex(double[][] pc){ GrahamScanConvexHull2D hull=new GrahamScanConvexHull2D(); double[] diag=new double[]{0,0}; for (int j=0; j < pc.length; j++) { hull.add(pc[j]); hull.add(times(pc[j],-1)); for (int k=j + 1; k < pc.length; k++) { double[] q=pc[k]; double[] ppq=timesEquals(plus(pc[j],q),MathUtil.SQRTHALF); double[] pmq=timesEquals(minus(pc[j],q),MathUtil.SQRTHALF); hull.add(ppq); hull.add(times(ppq,-1)); hull.add(pmq); hull.add(times(pmq,-1)); for (int l=k + 1; l < pc.length; l++) { double[] r=pc[k]; double[] ppqpr=timesEquals(plus(ppq,r),Math.sqrt(1 / 3.)); double[] pmqpr=timesEquals(plus(pmq,r),Math.sqrt(1 / 3.)); double[] ppqmr=timesEquals(minus(ppq,r),Math.sqrt(1 / 3.)); double[] pmqmr=timesEquals(minus(pmq,r),Math.sqrt(1 / 3.)); hull.add(ppqpr); hull.add(times(ppqpr,-1)); hull.add(pmqpr); hull.add(times(pmqpr,-1)); hull.add(ppqmr); hull.add(times(ppqmr,-1)); hull.add(pmqmr); hull.add(times(pmqmr,-1)); } } plusEquals(diag,pc[j]); } timesEquals(diag,1.0 / Math.sqrt(pc.length)); hull.add(diag); hull.add(times(diag,-1)); return hull.getHull(); }
Build a convex hull to approximate the sphere.
public void visitAnnotations(AnnotatedNode node){ super.visitAnnotations(node); for ( AnnotationNode annotation : node.getAnnotations()) { if (transforms.containsKey(annotation)) { targetNodes.add(new ASTNode[]{annotation,node}); } } }
Adds the annotation to the internal target list if a match is found.
Node(Node<K,V> next){ this.key=null; this.value=this; this.next=next; }
Creates a new marker node. A marker is distinguished by having its value field point to itself. Marker nodes also have null keys, a fact that is exploited in a few places, but this doesn't distinguish markers from the base-level header node (head.node), which also has a null key.
public void onDrawerClosed(View view){ super.onDrawerClosed(view); }
Called when a drawer has settled in a completely closed state.
public static List<String> deserializeAddressList(String serializedAddresses){ return Arrays.asList(serializedAddresses.split(",")); }
Deserialize a list of IP addresses from a string.
void challengeReceived(String challenge) throws IOException { currentMechanism.challengeReceived(challenge); }
The server is challenging the SASL authentication we just sent. Forward the challenge to the current SASLMechanism we are using. The SASLMechanism will send a response to the server. The length of the challenge-response sequence varies according to the SASLMechanism in use.
public boolean fitsType(Environment env,Context ctx,Type t){ if (this.type.isType(TC_CHAR)) { return super.fitsType(env,ctx,t); } switch (t.getTypeCode()) { case TC_BYTE: return value == (byte)value; case TC_SHORT: return value == (short)value; case TC_CHAR: return value == (char)value; } return super.fitsType(env,ctx,t); }
See if this number fits in the given type.
public ServiceManager(Iterable<? extends Service> services){ ImmutableList<Service> copy=ImmutableList.copyOf(services); if (copy.isEmpty()) { logger.log(Level.WARNING,"ServiceManager configured with no services. Is your application configured properly?",new EmptyServiceManagerWarning()); copy=ImmutableList.<Service>of(new NoOpService()); } this.state=new ServiceManagerState(copy); this.services=copy; WeakReference<ServiceManagerState> stateReference=new WeakReference<ServiceManagerState>(state); for ( Service service : copy) { service.addListener(new ServiceListener(service,stateReference),directExecutor()); checkArgument(service.state() == NEW,"Can only manage NEW services, %s",service); } this.state.markReady(); }
Constructs a new instance for managing the given services.
public boolean hasModule(String moduleName){ return moduleStore.containsKey(moduleName) || moduleStore.containsValue(moduleName); }
Looks up a module
private void removeUnusedTilesets(final Map map){ for (final Iterator<?> sets=map.getTileSets().iterator(); sets.hasNext(); ) { final TileSet tileset=(TileSet)sets.next(); if (!isUsedTileset(map,tileset)) { sets.remove(); } } }
Remove any tilesets in a map that are not actually in use.
public vec3 transformPoint(vec3 v){ vec3 result=new vec3(); result.m[0]=this.m[0] * v.m[0] + this.m[4] * v.m[1] + this.m[8] * v.m[2] + this.m[12]; result.m[1]=this.m[1] * v.m[0] + this.m[5] * v.m[1] + this.m[9] * v.m[2] + this.m[13]; result.m[2]=this.m[2] * v.m[0] + this.m[6] * v.m[1] + this.m[10] * v.m[2] + this.m[14]; return result; }
\fn transformPoint \brief Returns a transformed point \param v [vec3]
static AttrSessionID createFromString(final String str){ return new AttrSessionID(str); }
Creates a new attribute instance from the provided String.
Spinner(ListModel model,ListCellRenderer rendererInstance){ super(model); ios7Mode=UIManager.getInstance().isThemeConstant("ios7SpinnerBool",false); if (ios7Mode) { super.setMinElementHeight(6); } SpinnerRenderer.iOS7Mode=ios7Mode; setRenderer(rendererInstance); setUIID("Spinner"); setFixedSelection(FIXED_CENTER); setOrientation(VERTICAL); setInputOnFocus(false); setIsScrollVisible(false); initSpinnerRenderer(); quickType.setReplaceMenu(false); quickType.setInputModeOrder(new String[]{"123"}); quickType.setFocus(true); quickType.setRTL(false); quickType.setAlignment(LEFT); quickType.setConstraint(TextField.NUMERIC); setIgnoreFocusComponentWhenUnfocused(true); setRenderingPrototype(model.getItemAt(model.getSize() - 1)); if (getRenderer() instanceof DateTimeRenderer) { quickType.setColumns(2); } }
Creates a new spinner instance with the given spinner model
@SuppressWarnings("resource") @Override public void start(){ paused=false; log.info("Starting text-only user interface..."); log.info("Local address: " + system.getLocalAddress()); log.info("Press Ctrl + C to exit"); new Thread(null).start(); }
Starts the interface.
public static byte[] encodeBase64(byte[] binaryData){ return org.apache.commons.codec.binary.Base64.encodeBase64(binaryData); }
Encodes binary data using the base64 algorithm but does not chunk the output.
public int previousNode(){ if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE,null)); if ((m_next - 1) > 0) { m_next--; return this.elementAt(m_next); } else return DTM.NULL; }
Returns the previous node in the set and moves the position of the iterator backwards in the set.
public synchronized void decrease(Bitmap bitmap){ final int bitmapSize=BitmapUtil.getSizeInBytes(bitmap); Preconditions.checkArgument(mCount > 0,"No bitmaps registered."); Preconditions.checkArgument(bitmapSize <= mSize,"Bitmap size bigger than the total registered size: %d, %d",bitmapSize,mSize); mSize-=bitmapSize; mCount--; }
Excludes given bitmap from the count.
public void addExcludedName(String name){ Object obj=lookupQualifiedName(scope,name); if (!(obj instanceof Scriptable)) { throw new IllegalArgumentException("Object for excluded name " + name + " not found."); } table.put(obj,name); }
Adds a qualified name to the list of objects to be excluded from serialization. Names excluded from serialization are looked up in the new scope and replaced upon deserialization.
public void normalizeExcitatoryFanIn(){ double sum=0; double str=0; for (int i=0, n=fanIn.size(); i < n; i++) { str=fanIn.get(i).getStrength(); if (str > 0) { sum+=str; } } Synapse s=null; for (int i=0, n=fanIn.size(); i < n; i++) { s=fanIn.get(i); str=s.getStrength(); if (str > 0) { s.setStrength(s.getStrength() / sum); } } }
Normalizes the excitatory synaptic strengths impinging on this neuron, that is finds the sum of the exctiatory weights and divides each weight value by that sum;
@MethodDesc(description="Configure properties by either rereading them or setting all properties from outside.",usage="configure <properties>") public void configure(@ParamDesc(name="tp",description="Optional properties to replace replicator.properties") TungstenProperties tp) throws Exception { handleEventSynchronous(new ConfigureEvent(tp)); }
Local wrapper of configure to help with unit testing.
public boolean isArrayIndex(){ return true; }
Return true if variable is an array
public Object runSafely(Catbert.FastStack stack) throws Exception { return NetworkClient.getConnectedClients(); }
Returns a list of all the clients that are currently connected to this server.
public Debug(String filename){ this(filename,1000000,1); }
logs the output to the specified file (and stdout). Size is 1,000,000 bytes and 1 file.
private String createKeywordDisplayName(TaxonKeyword keyword){ String combined=null; if (keyword != null) { String scientificName=StringUtils.trimToNull(keyword.getScientificName()); String commonName=StringUtils.trimToNull(keyword.getCommonName()); if (scientificName != null && commonName != null) { combined=scientificName + " (" + commonName+ ")"; } else if (scientificName != null) { combined=scientificName; } else if (commonName != null) { combined=commonName; } } return combined; }
Construct display name from TaxonKeyword's scientific name and common name properties. It will look like: scientific name (common name) provided both properties are not null.
public static void w(String tag,String msg){ w(tag,msg,null); }
Prints a message at WARN priority.
public BehaviorEvent(FacesContext facesContext,UIComponent component,Behavior behavior){ super(facesContext,component); if (null == behavior) { throw new IllegalArgumentException("Behavior agrument cannot be null"); } this.behavior=behavior; }
<p class="changed_added_2_3">Construct a new event object from the Faces context, specified source component and behavior.</p>
public static Number intdiv(Number left,Character right){ return intdiv(left,Integer.valueOf(right)); }
Integer Divide a Number by a Character. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
public SQLDataException(String reason,Throwable cause){ super(reason,cause); }
Creates an SQLDataException object. The Reason string is set to the given and the cause Throwable object is set to the given cause Throwable object.
public boolean isSetHeader(){ return this.header != null; }
Returns true if field header is set (has been assigned a value) and false otherwise
public boolean increment(float key){ return adjustValue(key,1); }
Increments the primitive value mapped to key by 1
public boolean finish(){ if (!started) return false; boolean ok=true; started=false; try { out.write(0x3b); out.flush(); if (closeStream) { out.close(); } } catch ( IOException e) { ok=false; } transIndex=0; out=null; image=null; pixels=null; indexedPixels=null; colorTab=null; closeStream=false; firstFrame=true; return ok; }
Flushes any pending data and closes output file. If writing to an OutputStream, the stream is not closed.
public void initializeDefinition(String tableName,boolean isUnique){ m_table=tableName; m_isUnique=isUnique; s_logger.log(Level.FINEST,toString()); }
initialize detailed definitions forindex
private static String concatHeirTokens(SyntaxTreeNode stn){ SyntaxTreeNode[] heirs=stn.getHeirs(); if (heirs.length == 0) { if (stn.getKind() < SyntaxTreeConstants.NULL_ID) { return stn.getImage(); } else { return ""; } } String val=""; for (int i=0; i < heirs.length; i++) { val=val + concatHeirTokens(heirs[i]); } return val; }
Returns the concatenation of the images of all leaf nodes of the node stn that correspond to actual tokens
public Object jjtAccept(ParserVisitor visitor,Object data){ return visitor.visit(this,data); }
Accept the visitor.
public static Bitmap createImageThumbnail(String filePath,int kind){ boolean wantMini=(kind == Images.Thumbnails.MINI_KIND); int targetSize=wantMini ? TARGET_SIZE_MINI_THUMBNAIL : TARGET_SIZE_MICRO_THUMBNAIL; int maxPixels=wantMini ? MAX_NUM_PIXELS_THUMBNAIL : MAX_NUM_PIXELS_MICRO_THUMBNAIL; SizedThumbnailBitmap sizedThumbnailBitmap=new SizedThumbnailBitmap(); Bitmap bitmap=null; MediaFileType fileType=MediaFile.getFileType(filePath); if (fileType != null && fileType.fileType == MediaFile.FILE_TYPE_JPEG) { createThumbnailFromEXIF(filePath,targetSize,maxPixels,sizedThumbnailBitmap); bitmap=sizedThumbnailBitmap.mBitmap; } if (bitmap == null) { FileInputStream stream=null; try { stream=new FileInputStream(filePath); FileDescriptor fd=stream.getFD(); BitmapFactory.Options options=new BitmapFactory.Options(); options.inSampleSize=1; options.inJustDecodeBounds=true; BitmapFactory.decodeFileDescriptor(fd,null,options); if (options.mCancel || options.outWidth == -1 || options.outHeight == -1) { return null; } options.inSampleSize=computeSampleSize(options,targetSize,maxPixels); options.inJustDecodeBounds=false; options.inDither=false; options.inPreferredConfig=Bitmap.Config.ARGB_8888; bitmap=BitmapFactory.decodeFileDescriptor(fd,null,options); } catch ( IOException ex) { Log.e(TAG,"",ex); } catch ( OutOfMemoryError oom) { Log.e(TAG,"Unable to decode file " + filePath + ". OutOfMemoryError.",oom); } finally { try { if (stream != null) { stream.close(); } } catch ( IOException ex) { Log.e(TAG,"",ex); } } } if (kind == Images.Thumbnails.MICRO_KIND) { bitmap=extractThumbnail(bitmap,TARGET_SIZE_MICRO_THUMBNAIL,TARGET_SIZE_MICRO_THUMBNAIL,OPTIONS_RECYCLE_INPUT); } return bitmap; }
This method first examines if the thumbnail embedded in EXIF is bigger than our target size. If not, then it'll create a thumbnail from original image. Due to efficiency consideration, we want to let MediaThumbRequest avoid calling this method twice for both kinds, so it only requests for MICRO_KIND and set saveImage to true. This method always returns a "square thumbnail" for MICRO_KIND thumbnail.
public static <T extends Annotation>T checkAnnotationPresent(AnnotatedElement annotatedType,Class<T> annotationClass){ return getAnnotation(annotatedType,annotationClass); }
Check if the annotation is present and if not throws an exception, this is just an overload for more clear naming.
public Element store(Object o){ PortalIcon p=(PortalIcon)o; if (!p.isActive()) { return null; } Element element=new Element("PortalIcon"); storeCommonAttributes(p,element); element.setAttribute("scale",String.valueOf(p.getScale())); element.setAttribute("rotate",String.valueOf(p.getDegrees())); Portal portal=p.getPortal(); if (portal == null) { log.info("PortalIcon has no associated Portal."); return null; } element.setAttribute("portalName",portal.getName()); if (portal.getToBlock() != null) { element.setAttribute("toBlockName",portal.getToBlockName()); } if (portal.getFromBlockName() != null) { element.setAttribute("fromBlockName",portal.getFromBlockName()); } element.setAttribute("arrowSwitch","" + (p.getArrowSwitch() ? "yes" : "no")); element.setAttribute("arrowHide","" + (p.getArrowHide() ? "yes" : "no")); element.setAttribute("class","jmri.jmrit.display.controlPanelEditor.configurexml.PortalIconXml"); return element; }
Default implementation for storing the contents of a PortalIcon
public Address __rxor__(final Object rhs){ return new Address(m_value.xor(getBigInteger(rhs))); }
Used to support reverse XOR operations on addresses in Python scripts.
public SimpleUser(String username,Collection<String> userIdentifiers,Collection<String> connectionIdentifiers,Collection<String> connectionGroupIdentifiers){ this(username); addReadPermissions(userPermissions,userIdentifiers); addReadPermissions(connectionPermissions,connectionIdentifiers); addReadPermissions(connectionGroupPermissions,connectionGroupIdentifiers); }
Creates a new SimpleUser having the given username and READ access to the users, connections, and groups having the given identifiers.
public void startDocument() throws org.xml.sax.SAXException { }
Receive notification of the beginning of a document. <p>The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).</p>
protected AbstractIntSpliterator(long est,int additionalCharacteristics){ this.est=est; this.characteristics=((additionalCharacteristics & Spliterator.SIZED) != 0) ? additionalCharacteristics | Spliterator.SUBSIZED : additionalCharacteristics; }
Creates a spliterator reporting the given estimated size and characteristics.
private Set<DefUseCoverageTestFitness> preAnalyzeMethods(){ Set<DefUseCoverageTestFitness> r=new HashSet<DefUseCoverageTestFitness>(); LinkedList<ClassCallNode> toAnalyze=new LinkedList<ClassCallNode>(); toAnalyze.addAll(getInitialPreAnalyzeableMethods()); while (!toAnalyze.isEmpty()) { ClassCallNode currentMethod=toAnalyze.poll(); CCFGMethodEntryNode analyzeableEntry=ccfg.getMethodEntryNodeForClassCallNode(currentMethod); if (analyzedMethods.contains(analyzeableEntry)) continue; r.addAll(determineIntraInterMethodPairs(analyzeableEntry)); Set<ClassCallNode> parents=ccfg.getCcg().getParents(currentMethod); for ( ClassCallNode parent : parents) { if (toAnalyze.contains(parent)) continue; if (analyzedMethods.contains(ccfg.getMethodEntryNodeForClassCallNode(parent))) continue; Set<ClassCallNode> parentsChildren=ccfg.getCcg().getChildren(parent); boolean canAnalyzeNow=true; for ( ClassCallNode parentsChild : parentsChildren) { if (parentsChild == null) continue; if (!parentsChild.equals(parent) && !(toAnalyze.contains(parentsChild) || analyzedMethods.contains(ccfg.getMethodEntryNodeForClassCallNode(parentsChild)))) { canAnalyzeNow=false; break; } } if (canAnalyzeNow) { toAnalyze.offer(parent); } } } return r; }
Checks if there are methods in the CCG that dont call any other methods except for maybe itself. For these we can predetermine free uses and activeDefs prior to looking for inter_method_pairs. After that we can even repeat this process for methods we now have determined free uses and activeDefs! that way you can save a lot of computation. Map activeDefs and freeUses according to the variable so you can easily determine which defs will be active and which uses are free once you encounter a methodCall to that method without looking at its part of the CCFG
public SimpleProjectDescription createSimpleProjectDescription(){ SimpleProjectDescriptionImpl simpleProjectDescription=new SimpleProjectDescriptionImpl(); return simpleProjectDescription; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void writeAll(){ for (int row=0; row < _numRows; row++) { writeState[row]=WRITE; } issueNextOperation(); }
Start writing all rows out
public String str(){ return (m_obj != null) ? m_obj.toString() : ""; }
Cast result object to a string.
public int checkThreadIDAllow0(int uid){ if (uid == 0) { uid=currentThread.uid; } if (!threadMap.containsKey(uid)) { log.warn(String.format("checkThreadID not found thread 0x%08X",uid)); throw new SceKernelErrorException(ERROR_KERNEL_NOT_FOUND_THREAD); } if (!SceUidManager.checkUidPurpose(uid,"ThreadMan-thread",true)) { throw new SceKernelErrorException(ERROR_KERNEL_NOT_FOUND_THREAD); } return uid; }
Check the validity of the thread UID. Allow uid=0.
public boolean isPowerOfThreeB(int n){ return n > 0 && maxPow3 % n == 0; }
Find the max power of 3 within int range. It should be divisible by all power of 3s.
protected void addDefinitionRef(Element defRef){ String ref=defRef.getAttributeNS(null,XBL_REF_ATTRIBUTE); Element e=ctx.getReferencedElement(defRef,ref); if (!XBL_NAMESPACE_URI.equals(e.getNamespaceURI()) || !XBL_DEFINITION_TAG.equals(e.getLocalName())) { throw new BridgeException(ctx,defRef,ErrorConstants.ERR_URI_BAD_TARGET,new Object[]{ref}); } ImportRecord ir=new ImportRecord(defRef,e); imports.put(defRef,ir); NodeEventTarget et=(NodeEventTarget)defRef; et.addEventListenerNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,"DOMAttrModified",refAttrListener,false,null); XBLOMDefinitionElement d=(XBLOMDefinitionElement)defRef; String ns=d.getElementNamespaceURI(); String ln=d.getElementLocalName(); addDefinition(ns,ln,(XBLOMDefinitionElement)e,defRef); }
Adds a definition through its referring definition element (one with a 'ref' attribute).
public ActiveMQRATopicSubscriber(final TopicSubscriber consumer,final ActiveMQRASession session){ super(consumer,session); if (ActiveMQRATopicSubscriber.trace) { ActiveMQRALogger.LOGGER.trace("constructor(" + consumer + ", "+ session+ ")"); } }
Create a new wrapper
private void fieldInsn(final int opcode,final Type ownerType,final String name,final Type fieldType){ mv.visitFieldInsn(opcode,ownerType.getInternalName(),name,fieldType.getDescriptor()); }
Generates a get field or set field instruction.
@Override public void doFrame(long frameTimeNanos){ if (isPaused.get()) { return; } long frameTimeMillis=frameTimeNanos / 1000000; WritableArray timersToCall=null; synchronized (mTimerGuard) { while (!mTimers.isEmpty() && mTimers.peek().mTargetTime < frameTimeMillis) { Timer timer=mTimers.poll(); if (timersToCall == null) { timersToCall=Arguments.createArray(); } timersToCall.pushInt(timer.mCallbackID); if (timer.mRepeat) { timer.mTargetTime=frameTimeMillis + timer.mInterval; mTimers.add(timer); } else { mTimerIdsToTimers.remove(timer.mCallbackID); } } } if (timersToCall != null) { Assertions.assertNotNull(mJSTimersModule).callTimers(timersToCall); } Assertions.assertNotNull(mReactChoreographer).postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS,this); }
Calls all timers that have expired since the last time this frame callback was called.
protected void executeLogoutCommand(){ shoppingCartCommandFactory.execute(ShoppingCartCommand.CMD_LOGIN,cartMixin.getCurrentCart(),new HashMap<String,Object>(){ { put(ShoppingCartCommand.CMD_LOGOUT,ShoppingCartCommand.CMD_LOGOUT); } } ); }
Execute logout command.
public boolean equals(Object obj){ if (obj == this) { return true; } if (obj instanceof CharSet == false) { return false; } CharSet other=(CharSet)obj; return set.equals(other.set); }
<p>Compares two CharSet objects, returning true if they represent exactly the same set of characters defined in the same way.</p> <p>The two sets <code>abc</code> and <code>a-c</code> are <i>not</i> equal according to this method.</p>
private PlatformUtils(){ }
Creates a new PlatformUtils object.
@Override @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public InstanceStatus deleteInstance(String instanceId,ProvisioningSettings settings) throws APPlatformException { PropertyHandler paramHandler=new PropertyHandler(settings); paramHandler.setState(Status.DELETION_REQUESTED); InstanceStatus result=new InstanceStatus(); result.setChangedParameters(settings.getParameters()); return result; }
Starts the deletion of an application instance. <p> The internal status <code>DELETION_REQUESTED</code> is stored as a controller configuration setting. It is evaluated and handled by the status dispatcher, which is invoked at regular intervals by APP through the <code>getInstanceStatus</code> method.
public boolean isOnline(){ Object oo=get_Value(COLUMNNAME_IsOnline); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Online Access.
public EditSensorsAction(final VisionWorld visionWorld){ super("Edit selected sensor(s)..."); if (visionWorld == null) { throw new IllegalArgumentException("visionWorld must not be null"); } this.visionWorld=visionWorld; this.visionWorld.getSensorSelectionModel().addSensorSelectionListener(new SelectionListener()); }
Create a new edit sensors action.
@Override public final V replace(K key,V value){ long hash, allocIndex; Segment<K,V> segment; V oldValue; if ((allocIndex=(segment=segment(segmentIndex(hash=keyHashCode(key)))).find(this,hash,key)) > 0) { oldValue=segment.readValue(allocIndex); segment.writeValue(allocIndex,value); return oldValue; } return null; }
Replaces the entry for the specified key only if it is currently mapped to some value.
public UserResource user(){ return user; }
Get the subresource containing all of the commands related to a tenant's users.
private boolean isExportable(Step step){ return Exporter.class.getResource(String.format("/edu/wpi/grip/ui/codegeneration/%s/operations/%s.vm",lang.filePath,step.getOperationDescription().name().replace(' ','_'))) != null; }
Checks if a step is exportable to this exporter's language.
public static List<Long> view(long[] array,int length){ return new LongList(array,length); }
Creates and returns a view of the given long array that requires only a small object allocation.
final public MutableString insert(final int index,final Object o){ return insert(index,String.valueOf(o)); }
Inserts the string representation of an object in this mutable string, starting from index <code>index</code>.
public boolean checkAttributeValuesChanged(BlockVirtualPoolUpdateParam param,VirtualPool vpool){ return super.checkAttributeValuesChanged(param,vpool) || checkPathParameterModified(vpool.getNumPaths(),param.getMaxPaths()) || checkPathParameterModified(vpool.getMinPaths(),param.getMinPaths())|| checkPathParameterModified(vpool.getPathsPerInitiator(),param.getPathsPerInitiator())|| checkPathParameterModified(vpool.getHostIOLimitBandwidth(),param.getHostIOLimitBandwidth())|| checkPathParameterModified(vpool.getHostIOLimitIOPs(),param.getHostIOLimitIOPs())|| VirtualPoolUtil.checkRaidLevelsChanged(vpool.getArrayInfo(),param.getRaidLevelChanges())|| VirtualPoolUtil.checkForVirtualPoolAttributeModification(vpool.getDriveType(),param.getDriveType())|| VirtualPoolUtil.checkThinVolumePreAllocationChanged(vpool.getThinVolumePreAllocationPercentage(),param.getThinVolumePreAllocationPercentage())|| VirtualPoolUtil.checkProtectionChanged(vpool,param.getProtection())|| VirtualPoolUtil.checkHighAvailabilityChanged(vpool,param.getHighAvailability()); }
Check if any VirtualPool attribute values have changed.
@Override public Boolean visitIntersection_Intersection(final AnnotatedIntersectionType type1,final AnnotatedIntersectionType type2,final VisitHistory visited){ if (!arePrimeAnnosEqual(type1,type2)) { return false; } visited.add(type1,type2); return areAllEqual(type1.directSuperTypes(),type2.directSuperTypes(),visited); }
//TODO: SHOULD PRIMARY ANNOTATIONS OVERRIDE INDIVIDUAL BOUND ANNOTATIONS? //TODO: IF SO THEN WE SHOULD REMOVE THE arePrimeAnnosEqual AND FIX AnnotatedIntersectionType Two intersection types are equal if: 1) Their sets of primary annotations are equal 2) Their sets of bounds (the types being intersected) are equal
public void writeEnum(final int fieldNumber,final int value) throws IOException { writeTag(fieldNumber,WireFormat.WIRETYPE_VARINT); writeEnumNoTag(value); }
Write an enum field, including tag, to the stream. Caller is responsible for converting the enum value to its numeric value.
@Override protected char[] escape(int cp){ if (cp < safeOctets.length && safeOctets[cp]) { return null; } else if (cp == ' ' && plusForSpace) { return PLUS_SIGN; } else if (cp <= 0x7F) { char[] dest=new char[3]; dest[0]='%'; dest[2]=UPPER_HEX_DIGITS[cp & 0xF]; dest[1]=UPPER_HEX_DIGITS[cp >>> 4]; return dest; } else if (cp <= 0x7ff) { char[] dest=new char[6]; dest[0]='%'; dest[3]='%'; dest[5]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[4]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[2]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[1]=UPPER_HEX_DIGITS[0xC | cp]; return dest; } else if (cp <= 0xffff) { char[] dest=new char[9]; dest[0]='%'; dest[1]='E'; dest[3]='%'; dest[6]='%'; dest[8]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[7]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[5]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[4]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[2]=UPPER_HEX_DIGITS[cp]; return dest; } else if (cp <= 0x10ffff) { char[] dest=new char[12]; dest[0]='%'; dest[1]='F'; dest[3]='%'; dest[6]='%'; dest[9]='%'; dest[11]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[10]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[8]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[7]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[5]=UPPER_HEX_DIGITS[cp & 0xF]; cp>>>=4; dest[4]=UPPER_HEX_DIGITS[0x8 | (cp & 0x3)]; cp>>>=2; dest[2]=UPPER_HEX_DIGITS[cp & 0x7]; return dest; } else { throw new IllegalArgumentException("Invalid unicode character value " + cp); } }
Escapes the given Unicode code point in UTF-8.
public X509CRLImpl(InputStream inStrm) throws CRLException { try { parse(new DerValue(inStrm)); } catch ( IOException e) { signedCRL=null; throw new CRLException("Parsing error: " + e.getMessage()); } }
Unmarshals an X.509 CRL from an input stream. Only one CRL is expected at the end of the input stream.
protected boolean removeTurntable(LayoutTurntable o){ if (!noWarnTurntable) { int selectedValue=JOptionPane.showOptionDialog(this,rb.getString("Question4r"),Bundle.getMessage("WarningTitle"),JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,new Object[]{Bundle.getMessage("ButtonYes"),Bundle.getMessage("ButtonNo"),rb.getString("ButtonYesPlus")},Bundle.getMessage("ButtonNo")); if (selectedValue == 1) { return (false); } if (selectedValue == 2) { noWarnTurntable=true; } } if (selectedObject == o) { selectedObject=null; } if (prevSelectedObject == o) { prevSelectedObject=null; } for (int j=0; j < o.getNumberRays(); j++) { TrackSegment t=o.getRayConnectOrdered(j); if (t != null) { substituteAnchor(o.getRayCoordsIndexed(j),o,t); } } for (int i=0; i < turntableList.size(); i++) { LayoutTurntable lx=turntableList.get(i); if (lx == o) { turntableList.remove(i); o.remove(); setDirty(true); repaint(); return (true); } } return (false); }
Remove a Layout Turntable