code
stringlengths
10
174k
nl
stringlengths
3
129k
protected void unhandledMessage(Message msg){ if (mSmHandler.mDbg) loge(" - unhandledMessage: msg.what=" + msg.what); }
Called when message wasn't handled
public static byte[] decode(String s) throws Base64DecoderException { byte[] bytes=s.getBytes(); return decode(bytes,0,bytes.length); }
Decodes data from Base64 notation.
public String execute() throws Exception { String forward=RESULT_SEARCH_NO_DATA; try { this.createChart(); forward=SUCCESS; } catch ( ControllerException e) { this.setPageMessage(e.getMessage().toString()); } catch ( ServiceException e) { this.setPageMessage(e.getMessage().toString()); } catch ( Exception e) { e.printStackTrace(); this.setPageMessage(e.getMessage().toString()); } return forward; }
core.commonBarChartAction.action bsc.commonBarChartAction.action charts.commonBarChartAction.action
public boolean validateWithFillDefault() throws ParallelTaskInvalidException { if (this.targetHostMeta.getHosts().isEmpty()) { throw new ParallelTaskInvalidException("Empty targetHosts! Please set target hosts and try again...return.."); } if (requestProtocol == null) { requestProtocol=RequestProtocol.HTTP; logger.info("USE DEFAULT HTTP PROTOCOL: Missing Protocol HTTP/HTTPS. SET protocol as default HTTP"); } if (this.getConcurrency() <= 0 || this.getConcurrency() > ParallecGlobalConfig.maxCapacity) { logger.info("USE DEFAULT CONCURRENCY: User did not specify max concurrency " + "or its out of max allowed capacity: " + ParallecGlobalConfig.concurrencyDefault); this.setConcurrency(ParallecGlobalConfig.concurrencyDefault); } if (this.config == null) { logger.info("USE DEFAULT CONFIG: User did not specify" + " config for task/actor timeout etc. "); this.config=new ParallelTaskConfig(); } if (this.requestProtocol == RequestProtocol.SSH) { this.sshMeta.validation(); if (this.getConcurrency() > ParallecGlobalConfig.concurrencySshLimit) { logger.info("SSH CONCURRENCY LIMIT is lower. Apply value as: " + ParallecGlobalConfig.concurrencySshLimit); this.setConcurrency(ParallecGlobalConfig.concurrencySshLimit); } if (this.httpMeta.isPollable()) throw new ParallelTaskInvalidException("Not support pollable job with SSH."); this.httpMeta.initValuesNa(); this.tcpMeta=null; this.pingMeta=null; this.udpMeta=null; } else if (this.requestProtocol == RequestProtocol.PING) { if (this.httpMeta.isPollable()) throw new ParallelTaskInvalidException("Not support pollable job with PING."); this.httpMeta.initValuesNa(); this.pingMeta.validation(); this.sshMeta=null; this.tcpMeta=null; this.udpMeta=null; } else if (this.requestProtocol == RequestProtocol.TCP) { if (this.httpMeta.isPollable()) throw new ParallelTaskInvalidException("Not support pollable job with TCP."); this.httpMeta.initValuesNa(); this.tcpMeta.validation(); this.sshMeta=null; this.pingMeta=null; this.udpMeta=null; } else if (this.requestProtocol == RequestProtocol.UDP) { if (this.httpMeta.isPollable()) throw new ParallelTaskInvalidException("Not support pollable job with UDP."); this.httpMeta.initValuesNa(); this.udpMeta.validation(); this.tcpMeta=null; this.sshMeta=null; this.pingMeta=null; } else { this.httpMeta.validation(); this.sshMeta=null; this.tcpMeta=null; this.pingMeta=null; this.udpMeta=null; } return true; }
will do validation. for empty will either throw exception or fill with default values
public boolean isTable(long arc){ switch ((int)arc) { default : break; } return false; }
Returns true if "arc" identifies a table object.
public ImageEffectEvent(String image,boolean attached){ super(Events.IMAGE); put(IMAGE_ATTR,image); if (attached) { put(ATTACH_ATTR,""); } }
Create a new ImageEffectEvent.
public String invokeAPI(String path,String method,List<Pair> queryParams,Object body,Map<String,String> headerParams,Map<String,String> formParams,String accept,String contentType,String[] authNames) throws ApiException { updateParamsForAuth(authNames,queryParams,headerParams); Client client=getClient(); StringBuilder b=new StringBuilder(); b.append("?"); if (queryParams != null) { for ( Pair queryParam : queryParams) { if (!queryParam.getName().isEmpty()) { b.append(escapeString(queryParam.getName())); b.append("="); b.append(escapeString(queryParam.getValue())); b.append("&"); } } } String querystring=b.substring(0,b.length() - 1); Builder builder; if (accept == null) builder=client.resource(basePath + path + querystring).getRequestBuilder(); else builder=client.resource(basePath + path + querystring).accept(accept); for ( String key : headerParams.keySet()) { builder=builder.header(key,headerParams.get(key)); } for ( String key : defaultHeaderMap.keySet()) { if (!headerParams.containsKey(key)) { builder=builder.header(key,defaultHeaderMap.get(key)); } } ClientResponse response=null; if ("GET".equals(method)) { response=(ClientResponse)builder.get(ClientResponse.class); } else if ("POST".equals(method)) { if (contentType.startsWith("application/x-www-form-urlencoded")) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).post(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.post(ClientResponse.class,null); } else if (body instanceof FormDataMultiPart) { response=builder.type(contentType).post(ClientResponse.class,body); } else response=builder.type(contentType).post(ClientResponse.class,serialize(body)); } else if ("PUT".equals(method)) { if ("application/x-www-form-urlencoded".equals(contentType)) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).put(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.put(ClientResponse.class,serialize(body)); } else { response=builder.type(contentType).put(ClientResponse.class,serialize(body)); } } else if ("DELETE".equals(method)) { if ("application/x-www-form-urlencoded".equals(contentType)) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).delete(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.delete(ClientResponse.class); } else { response=builder.type(contentType).delete(ClientResponse.class,serialize(body)); } } else { throw new ApiException(500,"unknown method type " + method); } if (response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) { return null; } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { if (response.hasEntity()) { return (String)response.getEntity(String.class); } else { return ""; } } else { String message="error"; String respBody=null; if (response.hasEntity()) { try { respBody=String.valueOf(response.getEntity(String.class)); message=respBody; } catch ( RuntimeException e) { } } throw new ApiException(response.getStatusInfo().getStatusCode(),message,response.getHeaders(),respBody); } }
Invoke API by sending HTTP request with the given options.
@Override public String toString(){ StringBuffer buffer=new StringBuffer(); buffer.append("Normalizes all attributes proportional to their respective total sum. Attributes sums: \n"); for ( Entry<String,Double> entry : attributeSums.entrySet()) { buffer.append(entry.getKey() + ": " + entry.getValue().doubleValue()+ "\n"); } return buffer.toString(); }
Returns a string representation of this model.
public WriteMemoryReply(final int packetId,final int errorCode){ super(packetId,errorCode); }
Creates a new Write Memory reply object.
private boolean isQuoted(String text){ text=text.trim(); return text.length() > 1 && text.charAt(0) == '"' && text.charAt(text.length() - 1) == '"'; }
Returns <code>true</code> if the specified string is contained in double quotes, <code>false</code> otherwise
public long ramBytesUsed(){ return bytesUsed.get(); }
Return the memory usage of this object in bytes.
void write(ByteCodeWriter out) throws IOException { out.write(ConstantPool.CP_FLOAT); out.writeFloat(_value); }
Writes the contents of the pool entry.
protected void sequence_Access(ISerializationContext context,Access semanticObject){ genericSequencer.createSequence(context,semanticObject); }
Contexts: Expression returns Access Pair returns Access Pair.Pair_1_0_0 returns Access If returns Access If.If_1_0 returns Access Or returns Access Or.Expression_1_0 returns Access And returns Access And.Expression_1_0 returns Access Cast returns Access Cast.Cast_1_0_0 returns Access Comparison returns Access Comparison.Expression_1_0_0 returns Access Addition returns Access Addition.Expression_1_0_0 returns Access Multiplication returns Access Multiplication.Expression_1_0_0 returns Access Exponentiation returns Access Exponentiation.Expression_1_0_0 returns Access Binary returns Access Binary.Binary_1_0_0 returns Access Unit returns Access Unit.Unit_1_0_0 returns Access Unary returns Access Access returns Access Access.Access_1_0 returns Access Constraint: (left=Access_Access_1_0 ((op='[' args=ExpressionList?) | (op='.' right=AbstractRef) | (op='.' named_exp=STRING)))
public T caseModel(Model object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Model</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
public static void main(final String[] args){ DOMTestCase.doMain(isSupported11.class,args); }
Runs this test from the command line.
@Override public void delete(int operatorId,long windowId) throws IOException { if (!getStore().isConnected()) { getStore().connect(); } try { getStore().remove(generateKey(operatorId,windowId)); logger.debug("deleted object from store key {} region {}",generateKey(operatorId,windowId)); } catch ( Exception ex) { throw new RuntimeException(ex); } }
Removes stored operator object for given operatorId & windowId from store
final public boolean isTextIndex(){ return textIndex; }
<code>true</code> iff the (value centric) full text index is enabled.
private static int unitIndex(int bitIndex){ return bitIndex >> ADDRESS_BITS_PER_UNIT; }
Given a bit index return unit index containing it.
public static byte[] calculateDigest(String algorithm,InputStream data) throws OperatorCreationException, IOException { DigestCalculator dc=createDigestCalculator(algorithm); return calculateDigest(dc,data); }
Calculates message digest using the provided algorithm id.
public ClearCacheRequest(Cache cache,Runnable callback){ super(Method.GET,null,null); mCache=cache; mCallback=callback; }
Creates a synthetic request for clearing the cache.
public AnnotationVisitor visitAnnotation(String desc,boolean visible){ if (fv != null) { return fv.visitAnnotation(desc,visible); } return null; }
Visits an annotation of the field.
@Nullable @ObjectiveCName("findDownloadedDescriptorWithFileId:") public String findDownloadedDescriptor(long fileId){ return modules.getFilesModule().getDownloadedDescriptor(fileId); }
Get downloaded file descriptor
private void showMessage(String number,String order){ }
Display the message to user.
public static MultisigTransaction createMultisigTransferWithThreeSignatures(){ final MultisigTransaction multisig=createMultisigTransfer(); IntStream.range(0,3).forEach(null); return multisig; }
Creates a multisig transfer with three signatures.
public static String flagNames(long flags){ return Flags.toString(flags & ExtendedStandardFlags).trim(); }
Return flags as a string, separated by " ".
protected final void _configAndWriteValue(JsonGenerator jgen,Object value) throws IOException, JsonGenerationException, JsonMappingException { if (_prettyPrinter != null) { PrettyPrinter pp=_prettyPrinter; jgen.setPrettyPrinter((pp == NULL_PRETTY_PRINTER) ? null : pp); } else if (_config.isEnabled(SerializationConfig.Feature.INDENT_OUTPUT)) { jgen.useDefaultPrettyPrinter(); } if (_schema != null) { jgen.setSchema(_schema); } if (_config.isEnabled(SerializationConfig.Feature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) { _configAndWriteCloseable(jgen,value,_config); return; } boolean closed=false; try { if (_rootType == null) { _provider.serializeValue(_config,jgen,value,_serializerFactory); } else { _provider.serializeValue(_config,jgen,value,_rootType,_serializerFactory); } closed=true; jgen.close(); } finally { if (!closed) { try { jgen.close(); } catch ( IOException ioe) { } } } }
Method called to configure the generator as necessary and then call write functionality
public void removeAllPhotos(){ photos.clear(); }
Removes all photo's from this user
public void attrAdded(Attr node,String newv){ if (!changing) { valid=false; } fireBaseAttributeListeners(); if (!hasAnimVal) { fireAnimatedAttributeListeners(); } }
Called when an Attr node has been added.
public Value read(Type type,NodeMap node) throws Exception { Node entry=node.remove(label); Class expect=type.getType(); if (expect.isArray()) { expect=expect.getComponentType(); } if (entry != null) { String name=entry.getValue(); expect=loader.load(name); } return readInstance(type,expect,node); }
This is used to recover the object references from the document using the special attributes specified. This allows the element specified by the <code>NodeMap</code> to be used to discover exactly which node in the object graph the element represents.
private boolean isConnected(){ return (pclient == null ? false : pclient.isConnected()); }
Check if we are currently connected
public void write(OutStream out) throws IOException { int flags=0; if (noMultiplePlay) { flags+=1; } if (stopPlaying) { flags+=2; } out.writeUBits(4,flags); boolean hasEnvelope=(envelope != null && envelope.length > 0); boolean hasLoops=(loopCount > 1); boolean hasOutPoint=(outPoint >= 0); boolean hasInPoint=(inPoint >= 0); flags=0; if (hasEnvelope) { flags+=8; } if (hasLoops) { flags+=4; } if (hasOutPoint) { flags+=2; } if (hasInPoint) { flags+=1; } out.writeUBits(4,flags); if (hasInPoint) { out.writeUI32(inPoint); } if (hasOutPoint) { out.writeUI32(outPoint); } if (hasLoops) { out.writeUI16(loopCount); } if (hasEnvelope) { out.writeUI8(envelope.length); for (int i=0; i < envelope.length; i++) { out.writeUI32(envelope[i].mark44); out.writeUI16(envelope[i].level0); out.writeUI16(envelope[i].level1); } } }
Description of the Method
private void layoutMenu(){ if (mMenuSideEnum == MenuSideEnum.ARC_RIGHT) { cx=0 + menuMargin; cy=getMeasuredHeight() - fabMenu.getMeasuredHeight() - menuMargin; } else { cx=getMeasuredWidth() - fabMenu.getMeasuredWidth() - menuMargin; cy=getMeasuredHeight() - fabMenu.getMeasuredHeight() - menuMargin; } fabMenu.layout(cx,cy,cx + fabMenu.getMeasuredWidth(),cy + fabMenu.getMeasuredHeight()); }
Lays out the main fabMenu on the screen. Currently, the library only supports laying out the menu on the bottom right or bottom left of the screen. The proper layout position is directly dependent on the which side the radial arch menu will be show.
public void paintScrollBarTrackBorder(SynthContext context,Graphics g,int x,int y,int w,int h,int orientation){ paintBorder(context,g,x,y,w,h,orientation); }
Paints the border of the track of a scrollbar. The track contains the thumb. This implementation invokes the method of the same name without the orientation.
public ST createSingleton(Token templateToken){ String template; if (templateToken.getType() == GroupParser.BIGSTRING || templateToken.getType() == GroupParser.BIGSTRING_NO_NL) { template=Misc.strip(templateToken.getText(),2); } else { template=Misc.strip(templateToken.getText(),1); } CompiledST impl=compile(getFileName(),null,null,template,templateToken); ST st=createStringTemplateInternally(impl); st.groupThatCreatedThisInstance=this; st.impl.hasFormalArgs=false; st.impl.name=ST.UNKNOWN_NAME; st.impl.defineImplicitlyDefinedTemplates(this); return st; }
Create singleton template for use with dictionary values.
private static double calculate_MDEF_norm(Node sn,Node cg){ long sq=sn.getSquareSum(cg.getLevel() - sn.getLevel()); if (sq == sn.getCount()) { return 0.0; } long cb=sn.getCubicSum(cg.getLevel() - sn.getLevel()); double n_hat=(double)sq / sn.getCount(); double sig_n_hat=java.lang.Math.sqrt(cb * sn.getCount() - (sq * sq)) / sn.getCount(); if (sig_n_hat < Double.MIN_NORMAL) { return 0.0; } double mdef=n_hat - cg.getCount(); return mdef / sig_n_hat; }
Method for the MDEF calculation
protected S_DefinitionImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public int deleteAllRemoteFiles(){ if (!isDBAvailable()) return 0; SQLiteDatabase db=getOpenHelper().getWritableDatabase(); write.lock(); try { db.delete(TABLE_REMOTEFILE2ARTICLE,null,null); int count=db.delete(TABLE_REMOTEFILES,null,null); ContentValues cv=new ContentValues(); cv.putNull("cachedImages"); db.update(TABLE_ARTICLES,cv,"cachedImages IS NOT NULL",null); return count; } finally { write.unlock(); } }
delete all remote files
private static void reportHistogram(){ final Histogram histogram=registry.histogram(APP_PREFIX.tagged("what","response-size").tagged("endpoint","/v1/content")); final long responseSize=1000; histogram.update(responseSize); }
A histogram measures the statistical distribution of values in a stream of data. In addition to minimum, maximum, mean, etc., it also measures median, 75th, 90th, 95th, 98th, 99th, and 99.9th percentiles. This histogram will measure the size of responses in bytes.
public Shape createScrollButtonApart(int x,int y,int w,int h){ path.reset(); path.moveTo(x,y); path.lineTo(x,y + h); path.lineTo(x + w,y + h); addScrollGapPath(x,y,w,h,true); path.closePath(); return path; }
Return a path for a scroll bar button. This is used when the buttons are placed apart at opposite ends of the scroll bar. This is a common shape that is transformed to the appropriate button.
public void overrideDuration(int duration){ overriddenDuration=duration; }
Setting this will override the duration that the item may actually be. This method should only be used when the item doesn't return the correct duration such as with audio streams. This only overrides the current audio item.
public DcwCrossTileID(BinaryFile in) throws FormatException, EOFException { int format; try { format=in.read(); } catch ( IOException ioe) { throw new FormatException(ioe.getMessage()); } if (format == -1) { throw new EOFException(); } try { currentTileKey=readIntegerByKey(in,format >> 6); nextTileID=readIntegerByKey(in,format >> 4); nextTileKey=readIntegerByKey(in,format >> 2); readIntegerByKey(in,format); } catch ( EOFException e) { throw new FormatException("DcwCrossTileID: unexpected EOD " + e.getMessage()); } }
Construct a DcwCrossTileID from the specified input stream.
private static boolean areEquivalentParameters(final Class<?>[] expectedTypes,final Class<?>[] givenTypes){ if (expectedTypes.length == 0) { return givenTypes.length == 0; } if (givenTypes.length != expectedTypes.length) { return false; } for (int idx=0; idx < expectedTypes.length; idx++) { if (!isAssignableFrom(expectedTypes[idx],givenTypes[idx])) { return false; } } return true; }
This method evaluates if the parameters are equivalent / compatible. Null values in the givenTypes are treated as compatible.
@Override @Nullable public ECKey findKeyFromPubHash(byte[] pubkeyHash){ keyChainGroupLock.lock(); try { return keyChainGroup.findKeyFromPubHash(pubkeyHash); } finally { keyChainGroupLock.unlock(); } }
Locates a keypair from the basicKeyChain given the hash of the public key. This is needed when finding out which key we need to use to redeem a transaction output.
@Override public String toString(){ return String.format("Memory Section [%s - %s]",getStart().toHexString(),getEnd().toHexString()); }
Returns a string representation of the memory section.
public UTXO(Sha256Hash hash,long index,Coin value,int height,boolean coinbase,Script script,String address){ this(hash,index,value,height,coinbase,script); this.address=address; }
Creates a stored transaction output.
void error(String msg){ System.err.println("Error: " + msg); errors++; }
Report an error.
public static <T>T checkNotNull(T reference,String message){ if (reference == null) { throw new NullPointerException(message); } return reference; }
Ensures that an object reference passed as a parameter to the calling method is not null.
public void init(SecureRandom random) throws IllegalArgumentException { if (random != null) { this.random=random; } else { this.random=new SecureRandom(); } }
Initialise the padder.
public void clearParameters(){ synchronized (m_reentryGuard) { VariableStack varstack=new VariableStack(); m_xcontext.setVarStack(varstack); m_userParams=null; } }
Reset the parameters to a null list.
protected static void addNodeActionFormList(int id,String name,String code,String fullname,Element parent){ Element node=parent.addElement(XML_NODE_TEXT); node.addElement(XML_ID_TEXT).addText(Integer.toString(id)); node.addElement(XML_NAME_TEXT).add(DocumentHelper.createCDATA(name)); node.addElement(XML_CODELOWER_TEXT).add(DocumentHelper.createCDATA(code)); node.addElement(XML_FULLNAMELOWER_TEXT).add(DocumentHelper.createCDATA(fullname)); }
Protected methods
MultiplexInputStream(ConnectionMultiplexer manager,MultiplexConnectionInfo info,int bufferLength){ this.manager=manager; this.info=info; buffer=new byte[bufferLength]; waterMark=bufferLength / 2; }
Create a new MultiplexInputStream for the given manager.
private static boolean wasClicked(FacesContext context,UIComponent component,String clientId){ if (clientId == null) { clientId=component.getClientId(context); } if (context.getPartialViewContext().isAjaxRequest()) { return BEHAVIOR_SOURCE_PARAM.getValue(context).contains(clientId); } else { Map<String,String> requestParameterMap=context.getExternalContext().getRequestParameterMap(); if (requestParameterMap.get(clientId) == null) { if (RenderKitUtils.isPartialOrBehaviorAction(context,clientId)) { return true; } StringBuilder builder=new StringBuilder(clientId); String xValue=builder.append(".x").toString(); builder.setLength(clientId.length()); String yValue=builder.append(".y").toString(); return (requestParameterMap.get(xValue) != null && requestParameterMap.get(yValue) != null); } return true; } }
<p>Determine if this component was activated on the client side.</p>
public TypeDeclaration newTypeDeclaration(){ TypeDeclaration result=new TypeDeclaration(this); result.setInterface(false); return result; }
Creates an unparented class declaration node owned by this AST. The name of the class is an unspecified, but legal, name; no modifiers; no doc comment; no superclass or superinterfaces; and an empty class body. <p> To create an interface, use this method and then call <code>TypeDeclaration.setInterface(true)</code>. </p>
protected void drawTickMarksHorizontal(Graphics2D g2,AxisState state,Rectangle2D dataArea,RectangleEdge edge){ List ticks=new ArrayList(); double x0; double y0=state.getCursor(); double insideLength=getTickMarkInsideLength(); double outsideLength=getTickMarkOutsideLength(); RegularTimePeriod t=createInstance(this.majorTickTimePeriodClass,this.first.getStart(),getTimeZone(),this.locale); long t0=t.getFirstMillisecond(); Line2D inside=null; Line2D outside=null; long firstOnAxis=getFirst().getFirstMillisecond(); long lastOnAxis=getLast().getLastMillisecond() + 1; while (t0 <= lastOnAxis) { ticks.add(new NumberTick(Double.valueOf(t0),"",TextAnchor.CENTER,TextAnchor.CENTER,0.0)); x0=valueToJava2D(t0,dataArea,edge); if (edge == RectangleEdge.TOP) { inside=new Line2D.Double(x0,y0,x0,y0 + insideLength); outside=new Line2D.Double(x0,y0,x0,y0 - outsideLength); } else if (edge == RectangleEdge.BOTTOM) { inside=new Line2D.Double(x0,y0,x0,y0 - insideLength); outside=new Line2D.Double(x0,y0,x0,y0 + outsideLength); } if (t0 >= firstOnAxis) { g2.setPaint(getTickMarkPaint()); g2.setStroke(getTickMarkStroke()); g2.draw(inside); g2.draw(outside); } if (this.minorTickMarksVisible) { RegularTimePeriod tminor=createInstance(this.minorTickTimePeriodClass,new Date(t0),getTimeZone(),this.locale); long tt0=tminor.getFirstMillisecond(); while (tt0 < t.getLastMillisecond() && tt0 < lastOnAxis) { double xx0=valueToJava2D(tt0,dataArea,edge); if (edge == RectangleEdge.TOP) { inside=new Line2D.Double(xx0,y0,xx0,y0 + this.minorTickMarkInsideLength); outside=new Line2D.Double(xx0,y0,xx0,y0 - this.minorTickMarkOutsideLength); } else if (edge == RectangleEdge.BOTTOM) { inside=new Line2D.Double(xx0,y0,xx0,y0 - this.minorTickMarkInsideLength); outside=new Line2D.Double(xx0,y0,xx0,y0 + this.minorTickMarkOutsideLength); } if (tt0 >= firstOnAxis) { g2.setPaint(this.minorTickMarkPaint); g2.setStroke(this.minorTickMarkStroke); g2.draw(inside); g2.draw(outside); } tminor=tminor.next(); tminor.peg(this.calendar); tt0=tminor.getFirstMillisecond(); } } t=t.next(); t.peg(this.calendar); t0=t.getFirstMillisecond(); } if (edge == RectangleEdge.TOP) { state.cursorUp(Math.max(outsideLength,this.minorTickMarkOutsideLength)); } else if (edge == RectangleEdge.BOTTOM) { state.cursorDown(Math.max(outsideLength,this.minorTickMarkOutsideLength)); } state.setTicks(ticks); }
Draws the major and minor tick marks for an axis that lies at the top or bottom of the plot.
public ClassFactory(File dir,ClassLoader parent){ super(parent); this.output=dir; dir.mkdirs(); }
Create a given Class Factory with the given class loader.
public BurlapProtocolException(String message,Throwable rootCause){ super(message); this.rootCause=rootCause; }
Create the exception.
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.paint=SerialUtilities.readPaint(stream); this.stroke=SerialUtilities.readStroke(stream); }
Provides serialization support.
public int read(int bits) throws AccessException { int index=mPos >>> 3; int offset=16 - (mPos & 0x07) - bits; if ((bits < 0) || (bits > 8) || ((mPos + bits) > mEnd)) { throw new AccessException("illegal read " + "(pos " + mPos + ", end "+ mEnd+ ", bits "+ bits+ ")"); } int data=(mBuf[index] & 0xFF) << 8; if (offset < 8) data|=mBuf[index + 1] & 0xFF; data>>>=offset; data&=(-1 >>> (32 - bits)); mPos+=bits; return data; }
Read some data and increment the current position. The 8-bit limit on access to bitwise streams is intentional to avoid endianness issues.
private Set<StorageSystem> findMatchingSRDFPools(final VirtualArray srdfVarray,final Set<SRDFPoolMapping> srcDestPoolsList,final StoragePool recommendedPool,final StoragePool destinationPool){ Set<StorageSystem> storageDeviceList=new HashSet<StorageSystem>(); for ( SRDFPoolMapping srdfPoolMapping : srcDestPoolsList) { if (srdfPoolMapping.destVarray.getId().equals(srdfVarray.getId())) { _log.info("Comparison for SRDF target varray: " + srdfVarray.getLabel()); _log.info("recommended pool: " + recommendedPool.getLabel() + " vs. SRDF pool mapping source: "+ srdfPoolMapping.sourceStoragePool.getLabel()); _log.info("destination pool: " + destinationPool.getLabel() + " vs. SRDF pool mapping destination: "+ srdfPoolMapping.destStoragePool.getLabel()); if (srdfPoolMapping.sourceStoragePool.equals(recommendedPool) && srdfPoolMapping.destStoragePool.equals(destinationPool)) { if (!srdfPoolMapping.sourceStoragePool.getStorageDevice().equals(srdfPoolMapping.destStoragePool.getStorageDevice())) { StorageSystem storageSystem=_dbClient.queryObject(StorageSystem.class,srdfPoolMapping.destStoragePool.getStorageDevice()); storageDeviceList.add(storageSystem); _log.info("SRDF potentially will be recommended to array: " + storageSystem.getNativeGuid()); } } } } return storageDeviceList; }
Find the list of storage systems that have source and destination pools that are capable of SRDF protections to that target.
@POST @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @Path("/{id}/register") @CheckPermission(roles={Role.SYSTEM_ADMIN,Role.RESTRICTED_SYSTEM_ADMIN}) public ComputeSystemRestRep registerComputeSystem(@PathParam("id") URI id) throws ControllerException { ArgValidator.checkUri(id); ComputeSystem cs=_dbClient.queryObject(ComputeSystem.class,id); ArgValidator.checkEntity(cs,id,isIdEmbeddedInURL(id)); if (RegistrationStatus.UNREGISTERED.toString().equalsIgnoreCase(cs.getRegistrationStatus())) { cs.setRegistrationStatus(RegistrationStatus.REGISTERED.toString()); _dbClient.persistObject(cs); List<URI> cvpIds=_dbClient.queryByType(ComputeVirtualPool.class,true); Iterator<ComputeVirtualPool> iter=_dbClient.queryIterativeObjects(ComputeVirtualPool.class,cvpIds); while (iter.hasNext()) { ComputeVirtualPool cvp=iter.next(); if (cvp.getUseMatchedElements()) { _log.debug("Compute pool " + cvp.getLabel() + " configured to use dynamic matching -- refresh matched elements"); computeVirtualPoolService.getMatchingCEsforCVPAttributes(cvp); _dbClient.updateAndReindexObject(cvp); } } recordAndAudit(cs,OperationTypeEnum.REGISTER_COMPUTE_SYSTEM,true,null); } return getComputeSystem(id); }
Registers a previously de-registered Compute System. (Creation and Discovery of the Compute System marks the Compute System "Registered" by default)
protected SVGOMAnimateTransformElement(){ }
Creates a new SVGOMAnimateTransformElement object.
List<SubscriptionHistory> filterSubscriptionHistories(){ List<SubscriptionHistory> subscriptionHistories=filterIrrelevantSubscriptionHistories(billingInput.getSubscriptionHistoryEntries()); subscriptionHistories=filterSuspendedSubscriptionHistories(subscriptionHistories); return filterIrrelevantSubscriptionHistories(subscriptionHistories); }
Filter all subscription history entries that are not relevant for billing.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:43.547 -0500",hash_original_method="38A7A19069D4290FC9AB0139CD44ADE1",hash_generated_method="7007E02A81768D652D66865EF7A7DE15") public void fling(int startX,int startY,int velocityX,int velocityY,int minX,int maxX,int minY,int maxY,int overX,int overY){ if (mFlywheel && !isFinished()) { float oldVelocityX=mScrollerX.mCurrVelocity; float oldVelocityY=mScrollerY.mCurrVelocity; if (Math.signum(velocityX) == Math.signum(oldVelocityX) && Math.signum(velocityY) == Math.signum(oldVelocityY)) { velocityX+=oldVelocityX; velocityY+=oldVelocityY; } } mMode=FLING_MODE; mScrollerX.fling(startX,velocityX,minX,maxX,overX); mScrollerY.fling(startY,velocityY,minY,maxY,overY); }
Start scrolling based on a fling gesture. The distance traveled will depend on the initial velocity of the fling.
private Messages(){ }
Dis-allow construction ...
public IgniteFutureTimeoutException(Throwable cause){ this(cause.getMessage(),cause); }
Creates new exception with given throwable as a nested cause and source of error message.
void onAddToDatabase(Context context,ContentValues values){ values.put(LauncherSettings.BaseLauncherColumns.ITEM_TYPE,itemType); values.put(LauncherSettings.Favorites.CONTAINER,container); values.put(LauncherSettings.Favorites.SCREEN,screenId); values.put(LauncherSettings.Favorites.CELLX,cellX); values.put(LauncherSettings.Favorites.CELLY,cellY); values.put(LauncherSettings.Favorites.SPANX,spanX); values.put(LauncherSettings.Favorites.SPANY,spanY); values.put(LauncherSettings.Favorites.RANK,rank); long serialNumber=UserManagerCompat.getInstance(context).getSerialNumberForUser(user); values.put(LauncherSettings.Favorites.PROFILE_ID,serialNumber); if (screenId == Workspace.EXTRA_EMPTY_SCREEN_ID) { throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID"); } }
Write the fields of this item to the DB
public LibraryLocation(IPath libraryPath,IPath sourcePath,IPath packageRoot){ this(libraryPath,sourcePath,packageRoot,null); }
Creates a new library location.
public void testMoveFileSourceParentRoot() throws Exception { IgfsPath file=new IgfsPath("/" + FILE.name()); create(igfs,paths(DIR_NEW,SUBDIR_NEW),paths(file)); igfs.rename(file,SUBDIR_NEW); checkExist(igfs,igfsSecondary,new IgfsPath(SUBDIR_NEW,FILE.name())); checkNotExist(igfs,igfsSecondary,file); }
Test file move when source parent is the root.
protected void internalFrame(DockWrapper wrapper){ freeWrapper(wrapper); internalFrameWrappers.add(wrapper); wrapper.makeInternalFrame(); }
Set the component to an internal frame
public static boolean isLoginStatusAvailable(){ return OSUtils.isModernWindows(); }
Determines if we know how to set the login status.
public RaceControlPanel(){ add(goButton); add(stopButton); }
Creates a new instance of RaceControlPanel
private SQLDeArger parse(){ while (hasTokens()) { String token=getNextToken(); if (firstToken) { setSQLType(token); firstToken=false; } token=(isFloatString(token) || isQuotedString(token) || (token == null && isInString())) ? "?" : token; parsedSQL.append(token); } parseMatches(); return this; }
Parse the passed in where clause and break it along token lines.
@Override protected void acceptState(){ if (storedPrecision != precision.getParameterValue(0)) { mode=null; } }
This call specifies that the current state is accept. Most models will not need to do anything. Sub-models are handled automatically and do not need to be considered in this method.
public static boolean comparable(IOObject ioobject){ return ASSERTER_REGISTRY.getAsserterForObject(ioobject) != null; }
Returns <code>true</code> if the ioobjects class is supported for comparison in the test extension and <code>false</code> otherwise.
public int readBigUleb128(){ int end=offset; int currentByteValue; int result; byte[] buf=dexBuf.buf; result=buf[end++] & 0xff; if (result > 0x7f) { currentByteValue=buf[end++] & 0xff; result=(result & 0x7f) | ((currentByteValue & 0x7f) << 7); if (currentByteValue > 0x7f) { currentByteValue=buf[end++] & 0xff; result|=(currentByteValue & 0x7f) << 14; if (currentByteValue > 0x7f) { currentByteValue=buf[end++] & 0xff; result|=(currentByteValue & 0x7f) << 21; if (currentByteValue > 0x7f) { currentByteValue=buf[end++]; if (currentByteValue < 0) { throw new ExceptionWithContext("Invalid uleb128 integer encountered at offset 0x%x",offset); } result|=currentByteValue << 28; } } } } offset=end; return result; }
Reads a "big" uleb128 that can legitimately be > 2^31. The value is returned as a signed integer, with the expected semantics of re-interpreting an unsigned value as a signed value.
public int hashCode(){ if (!isHashValueSet) { hashValue=super.hashCode(); isHashValueSet=true; } return hashValue; }
Cache the hashCode value - calculating it with the standard method.
public int maxIndex(){ return tcount; }
The maximum indexable tuple value
public boolean isOneDotSix(){ return jdkVersion == JDK1_6 || jdkVersion == JDK1_6_U10_AND_AFTER; }
Checks if is one dot six.
@Override public void startMonitoring(StorageSystem storageDevice,WorkPool.Work work) throws StorageMonitorException { s_logger.debug("Connecting storage for event monitoring. {}",storageDevice.getSystemType()); if (storageDevice == null) { throw new StorageMonitorException("Passed storage device is null"); } s_logger.info("Attempting to connect to storage provider {} for event monitoring.",storageDevice.getSmisProviderIP()); if (_cimConnectionManager == null) { throw new StorageMonitorException("CIM adapter connection manager reference is null."); } CimConnectionInfo connectionInfo=new CimConnectionInfo(); connectionInfo.setHost(storageDevice.getSmisProviderIP()); connectionInfo.setPort(storageDevice.getSmisPortNumber()); connectionInfo.setUser(storageDevice.getSmisUserName()); connectionInfo.setPassword(storageDevice.getSmisPassword()); connectionInfo.setInteropNS(CimConstants.DFLT_CIM_CONNECTION_INTEROP_NS); connectionInfo.setUseSSL(storageDevice.getSmisUseSSL()); connectionInfo.setType(getConnectionTypeForDevice(storageDevice.getSystemType())); connectionInfo.setImplNS(getImplNamespaceForDevice(storageDevice.getSystemType())); try { _cimConnectionManager.addConnection(connectionInfo); } catch ( ConnectionManagerException cme) { throw new StorageMonitorException(MessageFormatter.format("Failed attempting to establish a connection to storage provider {}.",storageDevice.getSmisProviderIP()).getMessage(),cme); } s_logger.info("Connection established for storage provider {}.",storageDevice.getSmisProviderIP()); }
Starts event monitoring for the passed storage device by creating a connection to the SMI-S provider for the storage device.
public Object clone(){ OpenIntIntHashMap copy=(OpenIntIntHashMap)super.clone(); copy.table=(int[])copy.table.clone(); copy.values=(int[])copy.values.clone(); copy.state=(byte[])copy.state.clone(); return copy; }
Returns a deep copy of the receiver.
public void call(String name,Object... array) throws IOException { if (generator.isExcludingFieldsNamed(name)) { return; } writeName(name); writeArray(Arrays.asList(array)); }
Writes the name and a JSON array
public final void yyclose() throws java.io.IOException { zzAtEOF=true; zzEndRead=zzStartRead; if (zzReader != null) zzReader.close(); }
Closes the input stream.
ValueByteWrapper(byte[] value,byte userBit){ this.valueBytes=value; this.userBit=userBit; }
Constructs the wrapper object
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter,namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } }
Util method to write an attribute without the ns prefix
public NativeUnixDirectory(Path path,LockFactory lockFactory,Directory delegate) throws IOException { this(path,DEFAULT_MERGE_BUFFER_SIZE,DEFAULT_MIN_BYTES_DIRECT,lockFactory,delegate); }
Create a new NIOFSDirectory for the named location.
public HiveTableInputFormat(String fullQualifiedTableName){ String[] parts=HadoopUtil.parseHiveTableName(fullQualifiedTableName); dbName=parts[0]; tableName=parts[1]; }
Construct a HiveTableInputFormat to read hive table.
public PacketExtension parseExtension(XmlPullParser parser) throws Exception { XHTMLExtension xhtmlExtension=new XHTMLExtension(); boolean done=false; StringBuilder buffer=new StringBuilder(); int startDepth=parser.getDepth(); int depth=parser.getDepth(); String lastTag=""; while (!done) { int eventType=parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("body")) { buffer=new StringBuilder(); depth=parser.getDepth(); } lastTag=parser.getText(); buffer.append(parser.getText()); } else if (eventType == XmlPullParser.TEXT) { if (buffer != null) { buffer.append(StringUtils.escapeForXML(parser.getText())); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("body") && parser.getDepth() <= depth) { buffer.append(parser.getText()); xhtmlExtension.addBody(buffer.toString()); } else if (parser.getName().equals(xhtmlExtension.getElementName()) && parser.getDepth() <= startDepth) { done=true; } else { if (lastTag == null || !lastTag.equals(parser.getText())) { buffer.append(parser.getText()); } } } } return xhtmlExtension; }
Parses a XHTMLExtension packet (extension sub-packet).
private void assertReadResult(InputStream in,int size) throws IOException { byte[] readContent=new byte[size + 1]; int count=0; int total=0; while ((count=in.read(readContent,total,size + 1 - total)) != -1) { total=total + count; } assertEquals(size,total); for (int i=0; i < size; i++) { assertEquals((byte)i,readContent[i]); } }
Asserts read content. The read content should contain <code>size</code> bytes, and the value should be a sequence from 0 to size-1 ([0,1,...size-1]). Otherwise, the method throws Exception.
static protected void assertSameHTree(final AbstractHTree expected,final AbstractHTree actual){ assertTrue(((HTree)expected).nentries == ((HTree)actual).nentries); assertTrue(((HTree)expected).nleaves == ((HTree)actual).nleaves); assertTrue(((HTree)expected).nnodes == ((HTree)actual).nnodes); assertSameIterator(expected.getRoot().getTuples(),actual.getRoot().getTuples()); }
FIXME Write test helper assertSameHTree(). See the code below for a starting point.
public TypeRef[] collectLowerBounds(InferenceVariable infVar,boolean onlyProper,boolean resolveRawTypes){ return collectBounds(infVar,onlyProper,resolveRawTypes,null); }
Return all lower bounds of the given inference variable, i.e. all type references TR appearing as RHS of bounds of the form `infVar :> TR` or `infVar = TR`.
public DetailView makeDetailView(PlotItem it){ return new DetailView(context,it,ratio); }
Event triggered when a plot was selected.
private void expand(int i){ if (count + i <= buf.length) { return; } byte[] newbuf=mPool.getBuf((count + i) * 2); System.arraycopy(buf,0,newbuf,0,count); mPool.returnBuf(buf); buf=newbuf; }
Ensures there is enough space in the buffer for the given number of additional bytes.
public void tableChanged(TableModelEvent e){ boolean isUpdate=(e.getType() == TableModelEvent.UPDATE); if (!isUpdate) { calculate(); return; } int row=e.getFirstRow(); int col=e.getColumn(); boolean isInvoice=(e.getSource().equals(invoiceTable.getModel())); boolean isAutoWriteOff=autoWriteOff.isSelected(); String msg=writeOff(row,col,isInvoice,paymentTable,invoiceTable,isAutoWriteOff); if (msg != null && msg.length() > 0) ADialog.warn(m_WindowNo,panel,"AllocationWriteOffWarn"); calculate(); }
Table Model Listener. - Recalculate Totals
public static String toString(InputStream input,String encoding) throws IOException { return toString(input,Charsets.toCharset(encoding)); }
Get the contents of an <code>InputStream</code> as a String using the specified character encoding. <p> Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>.
public boolean isSetDeleteRequest(){ return this.deleteRequest != null; }
Returns true if field deleteRequest is set (has been assigned a value) and false otherwise
public static TVShowFragment newInstance(){ final TVShowFragment fragment=new TVShowFragment(); final Bundle args=new Bundle(); fragment.setArguments(args); return fragment; }
Returns a new instance of this fragment for the given section number.
protected boolean startsWithOpenQuote(Word w){ return w.form.startsWith("`") || w.form.startsWith("``") || w.form.startsWith("```")|| w.form.startsWith("\"")|| w.form.startsWith("\"`"); }
Determines whether the argument starts with any of the following varieties of open quote: ` `` ``` " "` .
private void updateDisplay(){ if (m_gui) { m_controlPanel.m_errorLabel.repaint(); m_controlPanel.m_epochsLabel.repaint(); } }
Call this function to update the control panel for the gui.
public int fontSize(){ return 0; }
Default font size to use is ok.
boolean isEnvelopeEnabled(){ return this.envelopeEnabled; }
Whether or not the document is wrapped in an envelope