code
stringlengths
10
174k
nl
stringlengths
3
129k
public void stopMonitorApiCnx(Activity activity){ mClientsToNotify.remove(activity); }
Stop monitoring the API connection
public String toString(){ return toXML(false); }
Devuelve una cadena con los datos de las acciones de multientidad.
@Inline @Entrypoint public static double doubleFieldRead(Object ref,Offset offset,int locationMetadata){ if (NEEDS_DOUBLE_GC_READ_BARRIER) { ObjectReference src=ObjectReference.fromObject(ref); return Selected.Mutator.get().doubleRead(src,src.toAddress().plus(offset),offset.toWord(),Word.fromIntZeroExtend(locationMetadata),INSTANCE_FIELD); } else if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); return 0; }
Barrier for loads of doubles from fields of instances (i.e. getfield).
public OperationWorker(final TaskRequest request,final AsyncHttpClient client,final HttpPollerProcessor httpPollerProcessor){ super(); this.client=client; this.request=request; this.trueTargetNode=(request.getHostUniform() == null) ? request.getHost() : request.getHostUniform(); if (request.isPollable()) { pollerData=new PollerData(); this.httpPollerProcessor=httpPollerProcessor; logger.info("Request is Pollable: poller info: " + httpPollerProcessor.toString()); } }
Instantiates a new operation worker.
public void addRow(Expression[] expr){ list.add(expr); }
Add a row to this merge statement.
public void send(final OutputStream os) throws IOException { PacketOutputStream writeBuffer=(PacketOutputStream)os; writeBuffer.startPacket(packetSeq); final byte[] authData; switch (plugin) { case "": case DefaultAuthenticationProvider.MYSQL_NATIVE_PASSWORD: try { authData=Utils.encryptPassword(password,seed); break; } catch ( NoSuchAlgorithmException e) { throw new RuntimeException("Could not use SHA-1, failing",e); } case DefaultAuthenticationProvider.MYSQL_CLEAR_PASSWORD: authData=password.getBytes(); break; default : authData=new byte[0]; } writeBuffer.writeInt((int)clientCapabilities).writeInt(1024 * 1024 * 1024).writeByte(serverLanguage); writeBuffer.writeBytes((byte)0,19).writeInt((int)(clientCapabilities >> 32)); if (username == null || "".equals(username)) username=System.getProperty("user.name"); writeBuffer.writeString(username).writeByte((byte)0); if ((clientCapabilities & MariaDbServerCapabilities.PLUGIN_AUTH_LENENC_CLIENT_DATA) != 0) { writeBuffer.writeFieldLength(authData.length).writeByteArray(authData); } else if ((clientCapabilities & MariaDbServerCapabilities.SECURE_CONNECTION) != 0) { writeBuffer.writeByte((byte)authData.length).writeByteArray(authData); } else { writeBuffer.writeByteArray(authData).writeByte((byte)0); } if ((clientCapabilities & MariaDbServerCapabilities.CONNECT_WITH_DB) != 0) { writeBuffer.writeString(database).writeByte((byte)0); } if ((clientCapabilities & MariaDbServerCapabilities.PLUGIN_AUTH) != 0) { writeBuffer.writeString(plugin).writeByte((byte)0); } if ((clientCapabilities & MariaDbServerCapabilities.CONNECT_ATTRS) != 0) { writeConnectAttributes(writeBuffer); } writeBuffer.finishPacketWithoutRelease(false); writeBuffer.releaseBuffer(); }
Send authentication stream.
public String toValue(){ return value; }
Returns the value used in the XML.
private static String[] norm(String path){ String[] elements=path.split("[/\\\\]"); ArrayList<String> stack=new ArrayList<String>(); for ( String e : elements) { if (e.isEmpty() || e.equals(".")) continue; if (e.equals("..")) { if (!stack.isEmpty()) stack.remove(stack.size() - 1); else return null; continue; } stack.add(e); } return stack.toArray(new String[stack.size()]); }
process a path into an array of folders
protected boolean[] canTakeOptions(){ boolean[] result=new boolean[2]; print("options..."); if (m_Clusterer instanceof OptionHandler) { println("yes"); if (m_Debug) { println("\n=== Full report ==="); Enumeration<Option> enu=((OptionHandler)m_Clusterer).listOptions(); while (enu.hasMoreElements()) { Option option=enu.nextElement(); print(option.synopsis() + "\n" + option.description()+ "\n"); } println("\n"); } result[0]=true; } else { println("no"); result[0]=false; } return result; }
Checks whether the scheme can take command line options.
public boolean testPowerOfTwo(int testValue){ int a=1; while (a < testValue) { a<<=1; } if (testValue == a) { return true; } return false; }
This method tests if an integer is a power of 2.
public MethodDeclaration createSetter(){ if (getVariables().size() != 1) throw new IllegalStateException("You can use this only when the field declares only 1 variable name"); ClassOrInterfaceDeclaration parentClass=getParentNodeOfType(ClassOrInterfaceDeclaration.class); EnumDeclaration parentEnum=getParentNodeOfType(EnumDeclaration.class); if ((parentClass == null && parentEnum == null) || (parentClass != null && parentClass.isInterface())) throw new IllegalStateException("You can use this only when the field is attached to a class or an enum"); VariableDeclarator variable=getVariables().get(0); String fieldName=variable.getId().getName(); String fieldNameUpper=fieldName.toUpperCase().substring(0,1) + fieldName.substring(1,fieldName.length()); final MethodDeclaration setter; if (parentClass != null) setter=parentClass.addMethod("set" + fieldNameUpper,PUBLIC); else setter=parentEnum.addMethod("set" + fieldNameUpper,PUBLIC); setter.setType(VOID_TYPE); setter.getParameters().add(new Parameter(variable.getType(),new VariableDeclaratorId(fieldName))); BlockStmt blockStmt2=new BlockStmt(); setter.setBody(blockStmt2); blockStmt2.addStatement(new AssignExpr(new NameExpr("this." + fieldName),new NameExpr(fieldName),Operator.assign)); return setter; }
Create a setter for this field, <b>will only work if this field declares only 1 identifier and if this field is already added to a ClassOrInterfaceDeclaration</b>
public final SpaceEffGraphNode lastNode(){ return _lastNode; }
Get the end of the list of nodes.
public static boolean isWindows81(){ return win81; }
Indicates whether current OS is Windows 8.1.
protected void terminate(){ hasTerminated=true; setEnabled(false); }
Terminate and set the action to disabled.
public void pushSAXLocatorNull(){ m_saxLocations.push(null); }
Push a slot on the locations stack so that setSAXLocator can be repeatedly called.
public Secret createSecret(String name,String content){ String hmac=cryptographer.computeHmac(content.getBytes(UTF_8)); if (hmac == null) { throw new ContentEncodingException("Error encoding content in SecretFixture!"); } String encryptedContent=cryptographer.encryptionKeyDerivedFrom(name).encrypt(content); long id=secretDAO.createSecret(name,encryptedContent,hmac,"creator",ImmutableMap.of(),0,"",null,ImmutableMap.of()); return transformer.transform(secretDAO.getSecretById(id).get()); }
Create a new secret.
private int count(Database conn) throws SQLException { Statement stmt=null; ResultSet res=null; int taskRows=0; try { stmt=conn.createStatement(); res=stmt.executeQuery(allSeqnoQuery); while (res.next()) { taskRows++; } } finally { connectionManager.close(res); connectionManager.close(stmt); } return taskRows; }
Returns the count of rows in the trep_commit_seqno table.
public static CmdLine defineCommand(final String nameArgs){ Validate.defineString(nameArgs).testNotNullEmpty().testMaxLength(CmdLine.MAX_LENGTH).throwExceptionOnFailedValidation().validate(); final String[] nameArgTokens=nameArgs.split(CmdLine.DEFINED_COMMAND_REGEX_PARSE_PATTERN); CmdLine.defineCommand(nameArgTokens); return (CmdLine.INSTANCE); }
This method defines the command definitions expected in the parser. Call this method for each command that will be defined. A token must use one of these symbols in order for it to be recognized as that type: # = The description of the command. There may be zero to one defined. ! = A required value for the command name. There can be zero to many defined. ? = An optional value for the command name. There can be zero to many defined. : = The regex value to match on for any values that are defined. There can be zero to one defined. ... = A value ends with ... and is a list for the command name. There can be zero to one defined. This can be used with the ! and ? symbols If a token does not start with one of these tokens, then it is considered a command name. Exmaples: "file, !fileName1, :file\\d.txt, #Load a files into the system" "-f, --file, !fileName1, ?fileName2, ?fileName3, :file\\d.txt, #Load a files into the system" "-f, --file, !fileName1, ?fileNames..., #Load a files into the system"
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:50.314 -0500",hash_original_method="28715ED51BABD0145D8C6E4EC8A7426B",hash_generated_method="A5AEC7C9FB9724C8F7496171A4624E6F") public boolean match(Object other){ if (!this.getClass().equals(other.getClass())) return false; GenericObjectList that=(GenericObjectList)other; ListIterator hisIterator=that.listIterator(); outer: while (hisIterator.hasNext()) { Object hisobj=hisIterator.next(); Object myobj=null; ListIterator myIterator=this.listIterator(); while (myIterator.hasNext()) { myobj=myIterator.next(); if (myobj instanceof GenericObject) System.out.println("Trying to match = " + ((GenericObject)myobj).encode()); if (GenericObject.isMySubclass(myobj.getClass()) && ((GenericObject)myobj).match(hisobj)) break outer; else if (GenericObjectList.isMySubclass(myobj.getClass()) && ((GenericObjectList)myobj).match(hisobj)) break outer; } System.out.println(((GenericObject)hisobj).encode()); return false; } return true; }
Match with a template (return true if we have a superset of the given template. This can be used for partial match (template matching of SIP objects). Note -- this implementation is not unnecessarily efficient :-)
public void trim(){ for ( String key : keyNames()) { String value=(String)properties.get(key); if (value != null) properties.put(key,value.trim()); } }
Trims all property values to remove leading and trailing whitespace.
public static void deleteDbFiles(File dbFile){ dbFile.delete(); new File(dbFile + "-journal").delete(); }
Deletes database and related journal file
public synchronized void clear(){ cookies.clear(); }
Clears all cookies.
private void showMainActivityActionItems(MenuInflater inflater,Menu menu){ getMenu().clear(); inflater=getMenuInflater(); inflater.inflate(R.menu.main_activity,menu); getActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); getActionBar().setDisplayShowTitleEnabled(true); getActionBar().setDisplayUseLogoEnabled(false); getActionBar().setHomeButtonEnabled(true); int actionBarTitleId=Resources.getSystem().getIdentifier("action_bar_title","id","android"); if (actionBarTitleId > 0) { TextView title=(TextView)findViewById(actionBarTitleId); if (title != null) { title.setTextColor(0xFFFFFFFF); } } }
Inflates the generic MainActivity ActionBar layout.
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); this.resource=ResourceBundle.getBundle(baseName,locale); }
Read object from ObjectInputStream and re-establish ResourceBundle.
public static void showAddressOnMap(Context mContext,String address){ address=address.replace(' ','+'); Intent geoIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?q=" + address)); mContext.startActivity(geoIntent); }
use to show address location pin on map.
protected void specificProcessing(StorageSystem storageSystem,DbClient dbClient,WBEMClient client,Volume volume,CIMInstance volumeInstance,CIMObjectPath volumePath){ String elementName=CIMPropertyFactory.getPropertyValue(volumeInstance,SmisConstants.CP_ELEMENT_NAME); volume.setDeviceLabel(elementName); volume.setCompressionRatio(SmisUtils.getCompressionRatioForVolume(volumeInstance)); }
This method can be implemented by the derived class for specific updates or processing for a derived class. Default behavior simply updates the deviceLabel name for the single volume that was created.
public static int[][] duplicateMatrix(int[][] src){ int[][] dest=new int[src.length][]; for (int r=0; r < src.length; r++) { dest[r]=new int[src[r].length]; System.arraycopy(src[r],0,dest[r],0,src[r].length); } return dest; }
Duplicates a matrix; handles different number of columns for each row
protected void encodeBasic(Element element,Object obj,Class<?> runtimeType){ element.setTextContent(obj == null ? NULL_VALUE : obj.toString()); }
Sets the given value element. The <code>type</code> is set to the given runtime type. String form of the given object is set as the text content.
public DefaultClientWebRequestBuilder header(String name,String... values){ Arrays.stream(values).forEach(null); return this; }
Add an HTTP request header
@Override public final boolean sendValues(){ return true; }
Values are required.
public static String escape(String string){ char c; String s=string.trim(); int length=s.length(); StringBuilder sb=new StringBuilder(length); for (int i=0; i < length; i+=1) { c=s.charAt(i); if (c < ' ' || c == '+' || c == '%' || c == '=' || c == ';') { sb.append('%'); sb.append(Character.forDigit((char)((c >>> 4) & 0x0f),16)); sb.append(Character.forDigit((char)(c & 0x0f),16)); } else { sb.append(c); } } return sb.toString(); }
Produce a copy of a string in which the characters '+', '%', '=', ';' and control characters are replaced with "%hh". This is a gentle form of URL encoding, attempting to cause as little distortion to the string as possible. The characters '=' and ';' are meta characters in cookies. By convention, they are escaped using the URL-encoding. This is only a convention, not a standard. Often, cookies are expected to have encoded values. We encode '=' and ';' because we must. We encode '%' and '+' because they are meta characters in URL encoding.
public static String encodeWithinPath(final String unescaped,final String charset) throws URIException { return encode(unescaped,URI.allowed_within_path,charset); }
Escape and encode a string regarded as within the path component of an URI with a given charset. The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved.
public static void atled(int[] a,int offset,int len){ a[offset]--; for (int i=offset + 1; i < offset + len; ++i) { a[i]+=a[i - 1]; } }
Restores a d-gap array into the original integers.
public static byte[] readFileAsByteArray(String absolutePath) throws IOException { return new FileReader(absolutePath).readFully().toByteArray(); }
Returns the contents of 'path' as a byte array.
public static Icon resize(Icon icon,int width,int height){ Image image=getImage(icon); if (image == null) return icon; image=image.getScaledInstance(width,height,Image.SCALE_SMOOTH); return new ImageIcon(image); }
Resizes an icon.
public void notifyFunctionLockableChanged(int functionNumber,boolean isLockable){ if (mThrottle == null) { if (log.isDebugEnabled()) { log.debug("throttle pointer null in notifyFunctionLockableChanged"); } return; } switch (functionNumber) { case 0: mThrottle.setF0Momentary(!isLockable); break; case 1: mThrottle.setF1Momentary(!isLockable); break; case 2: mThrottle.setF2Momentary(!isLockable); break; case 3: mThrottle.setF3Momentary(!isLockable); break; case 4: mThrottle.setF4Momentary(!isLockable); break; case 5: mThrottle.setF5Momentary(!isLockable); break; case 6: mThrottle.setF6Momentary(!isLockable); break; case 7: mThrottle.setF7Momentary(!isLockable); break; case 8: mThrottle.setF8Momentary(!isLockable); break; case 9: mThrottle.setF9Momentary(!isLockable); break; case 10: mThrottle.setF10Momentary(!isLockable); break; case 11: mThrottle.setF11Momentary(!isLockable); break; case 12: mThrottle.setF12Momentary(!isLockable); break; case 13: mThrottle.setF13Momentary(!isLockable); break; case 14: mThrottle.setF14Momentary(!isLockable); break; case 15: mThrottle.setF15Momentary(!isLockable); break; case 16: mThrottle.setF16Momentary(!isLockable); break; case 17: mThrottle.setF17Momentary(!isLockable); break; case 18: mThrottle.setF18Momentary(!isLockable); break; case 19: mThrottle.setF19Momentary(!isLockable); break; case 20: mThrottle.setF20Momentary(!isLockable); break; case 21: mThrottle.setF21Momentary(!isLockable); break; case 22: mThrottle.setF22Momentary(!isLockable); break; case 23: mThrottle.setF23Momentary(!isLockable); break; case 24: mThrottle.setF24Momentary(!isLockable); break; case 25: mThrottle.setF25Momentary(!isLockable); break; case 26: mThrottle.setF26Momentary(!isLockable); break; case 27: mThrottle.setF27Momentary(!isLockable); break; case 28: mThrottle.setF28Momentary(!isLockable); break; default : break; } }
Get notification that a function's lockable status has changed.
private Object executeExponent(PageContext pc,SQL sql,Query qr,ZExpression expression,int row) throws PageException { return Integer.valueOf(Caster.toIntValue(executeExp(pc,sql,qr,expression.getOperand(0),row)) ^ Caster.toIntValue(executeExp(pc,sql,qr,expression.getOperand(1),row))); }
execute a multiply operation
public void skipOptionalCall() throws IOException { int tag=read(); if (tag == 'c') { read(); read(); } else _peek=tag; }
For backward compatibility with HessianSkeleton
public static void createTable(SQLiteDatabase db,boolean ifNotExists){ String constraint=ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "'USER_DB' ("+ "'_id' INTEGER PRIMARY KEY NOT NULL ,"+ "'EMAIL' TEXT NOT NULL ,"+ "'KEY' TEXT NOT NULL ,"+ "'NAME' TEXT NOT NULL ,"+ "'IS_LAST_LOGIN' INTEGER NOT NULL );"); }
Creates the underlying database table.
public GetRequest id(String id){ this.id=id; return this; }
Sets the id of the document to fetch.
public void ignoreUser(InstagramAPIResponseCallback<IGRelationship> callback,String userId){ updateRelationShip(callback,InstagramKitConstants.kRelationshipActionIgnore,userId); }
Modify the relationship between the current user and the target user. Ignore a user. <p/> REQUIREMENTS : InstagramKitLoginScopeRelationships during authentication. <p/> To request access to this endpoint, please complete this form - https://help.instagram.com/contact/185819881608116
public boolean hasMuchoStuff(){ return fieldSetFlags()[2]; }
Checks whether the 'muchoStuff' field has been set
public static void sort(short[] array){ DualPivotQuicksort.sort(array); }
Sorts the specified array in ascending numerical order.
public static void rethrow(Throwable t){ Rethrow.<Error>rethrow0(t); }
Rethrows <code>t</code> (identical object).
private String validateEntriesParentsBeforeChildren(RequestAndResponse requestAndResponse,String[] idsToValidate,LinkedList<EntryAndIsFromList> validatedEntriesList) throws ServletException, IOException { final HashSet<String> validatedIdsSet=new HashSet<String>(); for (int i=idsToValidate.length - 1; i >= 0; --i) { final String[] idToValidateArray=idsToValidate[i].split(":"); final String idToValidate=idToValidateArray[idToValidateArray.length == 1 ? 0 : 1]; final boolean isFromList=idToValidateArray.length != 1; if (!dbLogic.getIdGenerator().isIdWellFormed(idToValidate)) { return servletText.errorIdIsInvalidFormat(); } final Entry movedEntry=dbLogic.getEntryById(idToValidate); if (movedEntry == null) { return servletText.errorEntryCouldNotBeFound(); } if (validatedIdsSet.contains(idToValidate)) { return servletText.errorDuplicateEntry(); } validatedIdsSet.add(idToValidate); final Entry oldParentOfMovedEntry=dbLogic.getEntryById(movedEntry.getParentId()); if (oldParentOfMovedEntry != null && validatedIdsSet.contains(oldParentOfMovedEntry.getId())) { servletText.errorParentMustBeMovedBeforeChild(); } validatedEntriesList.addFirst(new EntryAndIsFromList(movedEntry,isFromList)); } return null; }
Validates a list of entries, in that the IDs must be well formed, the entries must exist and the parents must be placed before the children. Put the validated Entries in the same order as the IDs in the validatedEntriesList parameter. Returns null if there was no error. God, how I long to code in a better language.
public Fits(String filename,boolean compressed) throws FitsException { if (filename == null) { throw new FitsException("Null FITS Identifier String"); } try { File fil=new File(filename); if (fil.exists()) { fileInit(fil,compressed); return; } } catch ( Exception e) { LOG.log(Level.FINE,"not a file " + filename,e); } try { InputStream str=Thread.currentThread().getContextClassLoader().getResourceAsStream(filename); if (str != null) { streamInit(str); return; } } catch ( Exception e) { LOG.log(Level.FINE,"not a resource " + filename,e); } try { InputStream is=FitsUtil.getURLStream(new URL(filename),0); streamInit(is); return; } catch ( Exception e) { LOG.log(Level.FINE,"not a url " + filename,e); } throw new FitsException("could not detect type of " + filename); }
Associate the FITS object with a file or URL. The string is assumed to be a URL if it begins one of the protocol strings. If the string ends in .gz it is assumed that the data is in a compressed format. All string comparisons are case insensitive.
public void contextualDecrementSelectedObjects(){ for ( PNode node : getSelection()) { if (node instanceof NeuronNode) { NeuronNode neuronNode=(NeuronNode)node; neuronNode.getNeuron().getUpdateRule().contextualDecrement(neuronNode.getNeuron()); } } }
Invoke contextual decrement (which respects neuron specific rules) on selected objects.
@Override public Message<?> preSend(Message<?> message,MessageChannel channel){ return MessageBuilder.fromMessage(message).setHeader(Span.SAMPLED_NAME,Span.SPAN_NOT_SAMPLED).build(); }
Don't trace the tracer (suppress spans originating from our own source)
@Override public String toString(){ return super.toString(); }
Returns the super class implementation of toString().
public void initWithContext(URI uri,Context ctx,SpeechConfiguration sc){ this.setHostURL(uri); this.appCtx=ctx; this.sConfig=sc; }
Init the shared instance with the context
public RaceGUI(String appName){ UIManager.put("swing.boldMetal",Boolean.FALSE); JFrame f=new JFrame(appName); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); track=new TrackView(); f.add(track,BorderLayout.CENTER); controlPanel=new RaceControlPanel(); f.add(controlPanel,BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Creates a new instance of RaceGUI
public SWFText tagDefineText2(int id,Rect bounds,Matrix matrix) throws IOException { return new TextDumper(); }
SWFTagTypes interface
@SuppressWarnings("unchecked") public synchronized E peek(){ try { return (E)elementData[elementCount - 1]; } catch ( IndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Returns the element at the top of the stack without removing it.
public static boolean noUpdates(){ if (Mekanism.latestVersionNumber.contains("null")) { return true; } if (Mekanism.versionNumber.comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) { return false; } for ( IModule module : Mekanism.modulesLoaded) { if (module.getVersion().comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) { return false; } } return true; }
Checks if the mod doesn't need an update.
public void testCertPathValidator03() throws NoSuchAlgorithmException { if (!PKIXSupport) { fail(NotSupportMsg); return; } CertPathValidator certPV; for (int i=0; i < validValues.length; i++) { certPV=CertPathValidator.getInstance(validValues[i]); assertEquals("Incorrect algorithm",certPV.getAlgorithm(),validValues[i]); } }
Test for <code>getInstance(String algorithm)</code> method Assertion: returns CertPathValidator object
private void resizeWidgetIfNeeded(boolean onDismiss){ int xThreshold=mCellLayout.getCellWidth() + mCellLayout.getWidthGap(); int yThreshold=mCellLayout.getCellHeight() + mCellLayout.getHeightGap(); int deltaX=mDeltaX + mDeltaXAddOn; int deltaY=mDeltaY + mDeltaYAddOn; float hSpanIncF=1.0f * deltaX / xThreshold - mRunningHInc; float vSpanIncF=1.0f * deltaY / yThreshold - mRunningVInc; int hSpanInc=0; int vSpanInc=0; int cellXInc=0; int cellYInc=0; int countX=mCellLayout.getCountX(); int countY=mCellLayout.getCountY(); if (Math.abs(hSpanIncF) > RESIZE_THRESHOLD) { hSpanInc=Math.round(hSpanIncF); } if (Math.abs(vSpanIncF) > RESIZE_THRESHOLD) { vSpanInc=Math.round(vSpanIncF); } if (!onDismiss && (hSpanInc == 0 && vSpanInc == 0)) return; CellLayout.LayoutParams lp=(CellLayout.LayoutParams)mWidgetView.getLayoutParams(); int spanX=lp.cellHSpan; int spanY=lp.cellVSpan; int cellX=lp.useTmpCoords ? lp.tmpCellX : lp.cellX; int cellY=lp.useTmpCoords ? lp.tmpCellY : lp.cellY; int hSpanDelta=0; int vSpanDelta=0; if (mLeftBorderActive) { cellXInc=Math.max(-cellX,hSpanInc); cellXInc=Math.min(lp.cellHSpan - mMinHSpan,cellXInc); hSpanInc*=-1; hSpanInc=Math.min(cellX,hSpanInc); hSpanInc=Math.max(-(lp.cellHSpan - mMinHSpan),hSpanInc); hSpanDelta=-hSpanInc; } else if (mRightBorderActive) { hSpanInc=Math.min(countX - (cellX + spanX),hSpanInc); hSpanInc=Math.max(-(lp.cellHSpan - mMinHSpan),hSpanInc); hSpanDelta=hSpanInc; } if (mTopBorderActive) { cellYInc=Math.max(-cellY,vSpanInc); cellYInc=Math.min(lp.cellVSpan - mMinVSpan,cellYInc); vSpanInc*=-1; vSpanInc=Math.min(cellY,vSpanInc); vSpanInc=Math.max(-(lp.cellVSpan - mMinVSpan),vSpanInc); vSpanDelta=-vSpanInc; } else if (mBottomBorderActive) { vSpanInc=Math.min(countY - (cellY + spanY),vSpanInc); vSpanInc=Math.max(-(lp.cellVSpan - mMinVSpan),vSpanInc); vSpanDelta=vSpanInc; } mDirectionVector[0]=0; mDirectionVector[1]=0; if (mLeftBorderActive || mRightBorderActive) { spanX+=hSpanInc; cellX+=cellXInc; if (hSpanDelta != 0) { mDirectionVector[0]=mLeftBorderActive ? -1 : 1; } } if (mTopBorderActive || mBottomBorderActive) { spanY+=vSpanInc; cellY+=cellYInc; if (vSpanDelta != 0) { mDirectionVector[1]=mTopBorderActive ? -1 : 1; } } if (!onDismiss && vSpanDelta == 0 && hSpanDelta == 0) return; if (onDismiss) { mDirectionVector[0]=mLastDirectionVector[0]; mDirectionVector[1]=mLastDirectionVector[1]; } else { mLastDirectionVector[0]=mDirectionVector[0]; mLastDirectionVector[1]=mDirectionVector[1]; } if (mCellLayout.createAreaForResize(cellX,cellY,spanX,spanY,mWidgetView,mDirectionVector,onDismiss)) { if (mStateAnnouncer != null && (lp.cellHSpan != spanX || lp.cellVSpan != spanY)) { mStateAnnouncer.announce(mLauncher.getString(R.string.widget_resized,spanX,spanY)); } lp.tmpCellX=cellX; lp.tmpCellY=cellY; lp.cellHSpan=spanX; lp.cellVSpan=spanY; mRunningVInc+=vSpanDelta; mRunningHInc+=hSpanDelta; if (!onDismiss) { updateWidgetSizeRanges(mWidgetView,mLauncher,spanX,spanY); } } mWidgetView.requestLayout(); }
Based on the current deltas, we determine if and how to resize the widget.
private static String executeCommand(String command) throws IOException, InterruptedException { StringBuilder output=new StringBuilder(); Process p; p=Runtime.getRuntime().exec(command); p.waitFor(); BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); String line=""; while ((line=reader.readLine()) != null) { output.append(line).append("\n"); } BufferedReader stdError=new BufferedReader(new InputStreamReader(p.getErrorStream())); String errorLine=""; while ((errorLine=stdError.readLine()) != null) { System.out.println(errorLine); } return output.toString(); }
Helper method to execute a shell command
public void onIceCandidate(String endpointName,String candidate,int sdpMLineIndex,String sdpMid,String participantId) throws RoomException { log.debug("Request [ICE_CANDIDATE] endpoint={} candidate={} " + "sdpMLineIdx={} sdpMid={} ({})",endpointName,candidate,sdpMLineIndex,sdpMid,participantId); Participant participant=getParticipant(participantId); participant.addIceCandidate(endpointName,new IceCandidate(candidate,sdpMid,sdpMLineIndex)); }
Request that carries info about an ICE candidate gathered on the client side. This information is required to implement the trickle ICE mechanism. Should be triggered or called whenever an icecandidate event is created by a RTCPeerConnection.
protected double measureCartesianAngularOverlap(ComplexVector other){ toCartesian(); other.toCartesian(); double cumulativeCosine=0; int nonZeroDimensionPairs=0; for (int i=0; i < dimension * 2; i+=2) { double resultThisPair=coordinates[i] * other.coordinates[i]; resultThisPair+=coordinates[i + 1] * other.coordinates[i + 1]; double norm1=coordinates[i] * coordinates[i]; norm1+=coordinates[i + 1] * coordinates[i + 1]; double norm2=other.coordinates[i] * other.coordinates[i]; norm2+=other.coordinates[i + 1] * other.coordinates[i + 1]; norm1=Math.sqrt(norm1); norm2=Math.sqrt(norm2); if (norm1 > 0 && norm2 > 0) { cumulativeCosine+=resultThisPair / (norm1 * norm2); ++nonZeroDimensionPairs; } } return (nonZeroDimensionPairs != 0) ? (cumulativeCosine / nonZeroDimensionPairs) : 0; }
Measure overlap, again using the sum of cosines of phase angle difference. Note that this is different from the Hermitian scalar product.
public static ConstantNode forFloatingStamp(Stamp stamp,double value){ return forFloatingKind(stamp.getStackKind(),value); }
Returns a node for a constant double that's compatible to a given stamp.
public GridifyArgumentAdapter(Class<?> cls,String mtdName,Class<?>[] types,Object[] params,Object target){ this.cls=cls; this.mtdName=mtdName; this.types=types; this.params=params; this.target=target; }
Creates a fully initialized gridify argument.
private Selectable doSelect(Selectable selectable,boolean multi){ if (!multi && !selectedItems.contains(selectable)) { selectedItems.clear(); } if (selectable != null) { selectedItems.add(selectable); } if (selectable instanceof Component) { ((Component)selectable).requestFocusInWindow(); } repaint(); return selectable; }
do select the item and repaint the diagram
public ProjectionComponent(final String name){ super(name); projectionModel=new ProjectionModel(); initializeConsumers(); addListener(); }
Create new Projection Component.
public final void clear(){ checkPoint=-1; if (current_item > 0) { for (int i=0; i < current_item; i++) { items[i]=null; } } else { for (int i=0; i < max_size; i++) { items[i]=null; } } current_item=0; }
clear the array
public Uri.Builder buildUponBaseHostUrl(String... paths){ final Uri.Builder builder=Uri.parse(getBaseHostUrl()).buildUpon(); if (paths != null) { for ( String p : paths) { builder.appendPath(p); } } return builder; }
Builds upon the base host url by appending paths to the url.
public static boolean checkIfInitiatorsForRP(List<Initiator> initiatorList){ if (initiatorList == null) { return false; } _log.debug("Checking Initiators to see if this is RP"); boolean isRP=true; for ( Initiator initiator : initiatorList) { if (!initiator.checkInternalFlags(Flag.RECOVERPOINT)) { isRP=false; break; } } _log.debug("Are these RP initiators? " + (isRP ? "Yes!" : "No!")); return isRP; }
Check the list of passed in initiators and check if the RP flag is set.
@PostConstruct public void init(){ super.init("label.configuration.auth.header"); configurationEnabled=isConfigEnabled(); detailLayout=new VerticalLayout(); detailLayout.setImmediate(true); final HorizontalLayout caRootAuthorityLayout=new HorizontalLayout(); caRootAuthorityLayout.setSpacing(true); final Label caRootAuthorityLabel=new LabelBuilder().name("SSL Issuer Hash:").buildLabel(); caRootAuthorityLabel.setDescription("The SSL Issuer iRules.X509 hash, to validate against the controller request certifcate."); caRootAuthorityLabel.setWidthUndefined(); caRootAuthorityTextField=new TextFieldBuilder().immediate(true).maxLengthAllowed(160).buildTextComponent(); caRootAuthorityTextField.setWidth("100%"); caRootAuthorityTextField.addTextChangeListener(null); caRootAuthorityLayout.addComponent(caRootAuthorityLabel); caRootAuthorityLayout.setExpandRatio(caRootAuthorityLabel,0); caRootAuthorityLayout.addComponent(caRootAuthorityTextField); caRootAuthorityLayout.setExpandRatio(caRootAuthorityTextField,1); caRootAuthorityLayout.setWidth("100%"); detailLayout.addComponent(caRootAuthorityLayout); if (isConfigEnabled()) { caRootAuthorityTextField.setValue(getCaRootAuthorityValue()); setDetailVisible(true); } }
Init mehotd called by spring.
public void debug(String msg,Throwable t){ log(Log.VERBOSE,msg,t); }
Log an exception (throwable) at level DEBUG with an accompanying message.
public void loadStreamConf(Optional<DistributedLogConfiguration> streamConfiguration){ if (!streamConfiguration.isPresent()) { return; } ArrayList<Object> ignoredSettings=new ArrayList<Object>(); Iterator iterator=streamConfiguration.get().getKeys(); while (iterator.hasNext()) { Object setting=iterator.next(); if (setting instanceof String && streamSettings.contains(setting)) { String settingStr=(String)setting; setProperty(settingStr,streamConfiguration.get().getProperty(settingStr)); } else { ignoredSettings.add(setting); } } if (LOG.isWarnEnabled() && !ignoredSettings.isEmpty()) { LOG.warn("invalid stream configuration override(s): {}",StringUtils.join(ignoredSettings,";")); } }
Load whitelisted stream configuration from another configuration object
public int search(char[] text){ int m=pattern.length; int n=text.length; int skip; for (int i=0; i <= n - m; i+=skip) { skip=0; for (int j=m - 1; j >= 0; j--) { if (pattern[j] != text[i + j]) { skip=Math.max(1,j - right[text[i + j]]); break; } } if (skip == 0) return i; } return n; }
Returns the index of the first occurrrence of the pattern string in the text string.
public static final Parameter base(){ return new Parameter(P_EC); }
Returns the default base.
public static double computeInterpolationFactor(double v,double x,double y){ return clamp((v - x) / (y - x),0d,1d); }
Returns the interpolation factor for <code>v</code> given the specified range <code>[x, y]</code>. The interpolation factor is a number between 0 and 1 (inclusive), representing the value's relative position between <code>x</code> and <code>y</code>. For example, 0 corresponds to <code>x</code>, 1 corresponds to <code>y</code>, and anything in between corresponds to a linear combination of <code>x</code> and <code>y</code>.
private Round(Round prev,Set<JavaFileObject> newSourceFiles,Map<String,JavaFileObject> newClassFiles){ this(prev.nextContext(),prev.number + 1,prev.compiler.log.nerrors,prev.compiler.log.nwarnings,null); this.genClassFiles=prev.genClassFiles; List<JCCompilationUnit> parsedFiles=compiler.parseFiles(newSourceFiles); roots=cleanTrees(prev.roots).appendList(parsedFiles); if (unrecoverableError()) return; enterClassFiles(genClassFiles); List<ClassSymbol> newClasses=enterClassFiles(newClassFiles); genClassFiles.putAll(newClassFiles); enterTrees(roots); if (unrecoverableError()) return; topLevelClasses=join(getTopLevelClasses(parsedFiles),getTopLevelClassesFromClasses(newClasses)); packageInfoFiles=join(getPackageInfoFiles(parsedFiles),getPackageInfoFilesFromClasses(newClasses)); findAnnotationsPresent(); }
Create a new round.
Item newNameTypeItem(final String name,final String desc){ key2.set(NAME_TYPE,name,desc,null); Item result=get(key2); if (result == null) { put122(NAME_TYPE,newUTF8(name),newUTF8(desc)); result=new Item(index++,key2); put(result); } return result; }
Adds a name and type to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item.
protected void onPostExecute(Uri imagePath){ Intent intent=MainActivity.makeDownloadCompleteIntent(imagePath); LocalBroadcastManager.getInstance(DownloadImageActivity.this).sendBroadcast(intent); Log.d(TAG,"onPostExecute() finishing activity"); DownloadImageActivity.this.finish(); }
This method runs in the UI thread.
protected void blockDrawerFromOpening(){ DrawerLayout drawerLayout=(DrawerLayout)findViewById(R.id.drawer_layout); if (drawerLayout != null) { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } }
Call this function if you do not want to allow opening/showing the drawer(Navigation Fragment) on swiping left to right
public void addSequence(GenericClass clazz,TestCase sequence){ ObjectSequence seq=new ObjectSequence(clazz,sequence); addSequence(seq); }
Insert a new sequence for given Type
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException { int[] leftTopBlack=image.getTopLeftOnBit(); int[] rightBottomBlack=image.getBottomRightOnBit(); if (leftTopBlack == null || rightBottomBlack == null) { throw NotFoundException.getNotFoundInstance(); } int moduleSize=moduleSize(leftTopBlack,image); int top=leftTopBlack[1]; int bottom=rightBottomBlack[1]; int left=leftTopBlack[0]; int right=rightBottomBlack[0]; int matrixWidth=(right - left + 1) / moduleSize; int matrixHeight=(bottom - top + 1) / moduleSize; if (matrixWidth <= 0 || matrixHeight <= 0) { throw NotFoundException.getNotFoundInstance(); } int nudge=moduleSize >> 1; top+=nudge; left+=nudge; BitMatrix bits=new BitMatrix(matrixWidth,matrixHeight); for (int y=0; y < matrixHeight; y++) { int iOffset=top + y * moduleSize; for (int x=0; x < matrixWidth; x++) { if (image.get(left + x * moduleSize,iOffset)) { bits.set(x,y); } } } return bits; }
This method detects a code in a "pure" image -- that is, pure monochrome image which contains only an unrotated, unskewed, image of a code, with some white border around it. This is a specialized method that works exceptionally fast in this special case.
public boolean replace(int key,E oldValue,E newValue){ if (oldValue == null || newValue == null || array.length <= key) { return false; } E prev=(E)array[key]; if (prev.equals(oldValue)) { array[key]=newValue; size++; return true; } return false; }
Replaces the entry for the specified key only if currently mapped to the specified value.
public OneVSOne(Classifier baseClassifier,boolean concurrentTrain){ this.baseClassifier=baseClassifier; this.concurrentTrain=concurrentTrain; }
Creates a new One-vs-One classifier
@Override @Pure public void instantiate(){ }
Cause instantiation to take place. This is a no-op for unboxed types.
protected void parseDefineSound(InStream in) throws IOException { int id=in.readUI16(); int format=(int)in.readUBits(4); int frequency=(int)in.readUBits(2); boolean bits16=in.readUBits(1) != 0; boolean stereo=in.readUBits(1) != 0; int sampleCount=(int)in.readUI32(); byte[] soundData=in.read(); tagtypes.tagDefineSound(id,format,frequency,bits16,stereo,sampleCount,soundData); }
Description of the Method
public PdfBitmap(Bitmap image,int width,int height,int pdfX,int pdfY,int page,Type type){ this.image=image; this.height=height; this.width=width; this.pdfX=pdfX; this.pdfY=pdfY; this.pageNumber=page; this.type=type; this.isRemovable=true; this.metadata=new HashMap<>(); }
This class is used to store the information of each stamp and annotation on the PDF.
public static TextUtils.TruncateAt parse(String ellipsizeName){ return parse(ellipsizeName,TextUtils.TruncateAt.END); }
parse ellipsize
public SmoothOverScroller(Context context){ this(context,null); }
Creates an OverScroller with a viscous fluid scroll interpolator and flywheel.
private static boolean isURIString(String p_uric){ if (p_uric == null) { return false; } int end=p_uric.length(); char testChar='\0'; for (int i=0; i < end; i++) { testChar=p_uric.charAt(i); if (testChar == '%') { if (i + 2 >= end || !isHex(p_uric.charAt(i + 1)) || !isHex(p_uric.charAt(i + 2))) { return false; } else { i+=2; continue; } } if (isReservedCharacter(testChar) || isUnreservedCharacter(testChar)) { continue; } else { return false; } } return true; }
Determine whether a given string contains only URI characters (also called "uric" in RFC 2396). uric consist of all reserved characters, unreserved characters and escaped characters.
void _addChild(final AbstractPage child){ assert isOverflowDirectory(); assert !isReadOnly(); final MutableDirectoryPageData pdata=(MutableDirectoryPageData)data; for (int i=0; i < pdata.childAddr.length; i++) { final AbstractPage aChild=childRefs[i] == null ? null : childRefs[i].get(); if (aChild == null && pdata.childAddr[i] == NULL) { childRefs[i]=(Reference<AbstractPage>)child.self; assert !child.isPersistent(); child.parent=(Reference<DirectoryPage>)self; return; } } final DirectoryPage pd=getParentDirectory(); if (pd.isOverflowDirectory()) { assert false; } else { final DirectoryPage blob=new DirectoryPage((HTree)htree,getOverflowKey(),getOverflowPageDepth()); blob._addChild(this); blob._addChild(child); pd.replaceChildRef(this.self,blob); if (INFO) log.info("New Overflow Level: " + getLevel()); } }
This method should only be called when using a DirectoryPage as a BucketPage Blob. The final child in the blob is used for insert by default.
protected SVGOMFEFuncRElement(){ }
Creates a new Element object.
public EdgeNGramTokenFilter(TokenStream input,int minGram,int maxGram){ super(input); if (minGram < 1) { throw new IllegalArgumentException("minGram must be greater than zero"); } if (minGram > maxGram) { throw new IllegalArgumentException("minGram must not be greater than maxGram"); } this.minGram=minGram; this.maxGram=maxGram; }
Creates EdgeNGramTokenFilter that can generate n-grams in the sizes of the given range
public void addActionListener(ActionListener l){ dispatcher.addListener(l); }
Allows binding a listener to user selection actions
@Override public final int read() throws IOException { return Util.readSingleByte(this); }
read() is implemented using read(byte[], int, int) so subclasses only need to override the latter.
@Override protected void initViews(Bundle savedInstanceState){ ButterKnife.bind(this); }
Initialize the view in the layout
public void init(Controller c){ super.init(c); display=new Display2D(ForagingHoneyBeeSimulation.WIDTH,ForagingHoneyBeeSimulation.HEIGHT,this,1); displayFrame=display.createFrame(); displayFrame.setTitle("Honey bee playground"); c.registerFrame(displayFrame); displayFrame.setVisible(true); display.attach(vidPortrayal,"Agents"); display.setInterval(1); initGraphDisplays(c); }
Setting up the visuals.
public void drawLegendShape(Canvas canvas,SimpleSeriesRenderer renderer,float x,float y,int seriesIndex,Paint paint){ XYChart chart=getXYChart(seriesIndex); chart.drawLegendShape(canvas,renderer,x,y,getChartSeriesIndex(seriesIndex),paint); }
The graphical representation of the legend shape.
public void unregisterGatewayEventListener(AsyncEventListener listener){ synchronized (eventLock) { List<AsyncEventListener> oldListeners=this.eventListeners; if (oldListeners.contains(listener)) { List<AsyncEventListener> newListeners=new ArrayList<AsyncEventListener>(oldListeners); if (newListeners.remove(listener)) { this.eventListeners=newListeners; } } } }
Removes registration of a previously registered <code>AsyncEventListener</code>.
public TextFieldBorder(SeaglassUI ui,Insets insets){ super(ui,insets); }
Creates a new TextFieldBorder object.
private void showFeedback(String message){ if (myHost != null) { myHost.showFeedback(message); } else { System.out.println(message); } }
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
public void mousePress(int x,int y,int mouseButton){ mouseX=x; mouseY=y; timestamp=System.currentTimeMillis(); velocity=0; amplitude=0; }
Mouse button was pressed
public void show(RenameRefactoringSession renameRefactoringSession){ this.renameRefactoringSession=renameRefactoringSession; prepareWizard(); switch (renameRefactoringSession.getWizardType()) { case COMPILATION_UNIT: view.setTitle(locale.renameCompilationUnitTitle()); view.setVisiblePatternsPanel(true); view.setVisibleFullQualifiedNamePanel(true); view.setVisibleSimilarlyVariablesPanel(true); break; case PACKAGE: view.setTitle(locale.renamePackageTitle()); view.setVisiblePatternsPanel(true); view.setVisibleFullQualifiedNamePanel(true); view.setVisibleRenameSubpackagesPanel(true); break; case TYPE: view.setTitle(locale.renameTypeTitle()); view.setVisiblePatternsPanel(true); view.setVisibleFullQualifiedNamePanel(true); view.setVisibleSimilarlyVariablesPanel(true); break; case FIELD: view.setTitle(locale.renameFieldTitle()); view.setVisiblePatternsPanel(true); break; case ENUM_CONSTANT: view.setTitle(locale.renameEnumTitle()); view.setVisiblePatternsPanel(true); break; case TYPE_PARAMETER: view.setTitle(locale.renameTypeVariableTitle()); break; case METHOD: view.setTitle(locale.renameMethodTitle()); view.setVisibleKeepOriginalPanel(true); break; case LOCAL_VARIABLE: view.setTitle(locale.renameLocalVariableTitle()); break; default : } view.show(); }
Show Rename window with the special information.
public Message(String content,double priority){ this.content=content; this.priority=priority; }
Create a new message with the given content and priority.