code
stringlengths
10
174k
nl
stringlengths
3
129k
private boolean isCacheServerPortEquals(CacheServer other){ return (this.getPort() == 0) ? true : this.getPort() == other.getPort(); }
Compare configured cacheServer port against the running cacheServer port. If the current cacheServer port is set to 0 a random ephemeral port will be used so there is no need to compare returning <code>true</code>. If a port is specified, return the proper comparison.
Property(YearMonthDay partial,int fieldIndex){ super(); iYearMonthDay=partial; iFieldIndex=fieldIndex; }
Constructs a property.
public E push(E item){ top=new Node<>(item,top); return item; }
Pushes an item onto the top of this stack.
public static byte[] asByteArray(final List<Byte> l){ final byte[] a=new byte[l.size()]; for (int i=0; i < a.length; i++) { a[i]=l.get(i); } return a; }
Return list of boxed bytes as a primitive array.
public double nextDouble(double lambda){ return -Math.log(randomGenerator.raw()) / lambda; }
Returns a random number from the distribution; bypasses the internal state.
public void addObserver(AppMenuObserver observer){ mObservers.add(observer); }
Adds the observer to App Menu.
private static void initClamp(){ for (int i=0; i < 256; i++) { clamp[CLAMP_BASE + i]=i; } for (int i=0; i < CLAMP_BASE; i++) { clamp[i]=0; clamp[i + CLAMP_BASE + 256]=255; } }
Initialize array to clamp values in range [0..255]
public void detachDatastore(Datastore datastore){ for ( HostScsiDisk disk : listDisks(datastore)) { try { host.getHostStorageSystem().detachScsiLun(disk.getUuid()); } catch ( RemoteException e) { throw new VMWareException(e); } } }
Detach all of the disks associated with the datastore on this host
public static _Fields findByName(String name){ return byName.get(name); }
Find the _Fields constant that matches name, or null if its not found.
@SuppressWarnings("deprecation") public static Expression create(String expression,StatsCollector[] statsCollectors){ int paren=expression.indexOf('('); if (paren <= 0) { throw new SolrException(ErrorCode.BAD_REQUEST,"The expression [" + expression + "] has no arguments and is not supported."); } String topOperation=expression.substring(0,paren).trim(); String operands; try { operands=expression.substring(paren + 1,expression.lastIndexOf(')')).trim(); } catch ( Exception e) { throw new SolrException(ErrorCode.BAD_REQUEST,"Missing closing parenthesis in [" + expression + "]",e); } if (AnalyticsParams.ALL_STAT_SET.contains(topOperation)) { if (topOperation.equals(AnalyticsParams.STAT_PERCENTILE)) { operands=expression.substring(expression.indexOf(',') + 1,expression.lastIndexOf(')')).trim(); topOperation=topOperation + "_" + expression.substring(expression.indexOf('(') + 1,expression.indexOf(',')).trim(); } StatsCollector collector=null; for ( StatsCollector c : statsCollectors) { if (c.valueSourceString().equals(operands)) { collector=c; break; } } if (collector == null) { throw new SolrException(ErrorCode.BAD_REQUEST,"ValueSource [" + operands + "] in Expression ["+ expression+ "] not found."); } return new BaseExpression(collector,topOperation); } if (topOperation.equals(AnalyticsParams.CONSTANT_NUMBER)) { try { return new ConstantNumberExpression(Double.parseDouble(operands)); } catch ( NumberFormatException e) { throw new SolrException(ErrorCode.BAD_REQUEST,"The constant " + operands + " cannot be converted into a number.",e); } } else if (topOperation.equals(AnalyticsParams.CONSTANT_DATE)) { return new ConstantDateExpression(DateMathParser.parseMath(null,operands)); } else if (topOperation.equals(AnalyticsParams.CONSTANT_STRING)) { operands=expression.substring(paren + 1,expression.lastIndexOf(')')); return new ConstantStringExpression(operands); } String[] arguments=getArguments(operands); Expression[] expArgs=new Expression[arguments.length]; for (int count=0; count < arguments.length; count++) { expArgs[count]=create(arguments[count],statsCollectors); } if (expArgs.length == 1) { if (topOperation.equals(AnalyticsParams.NEGATE)) { return new NegateExpression(expArgs[0]); } if (topOperation.equals(AnalyticsParams.ABSOLUTE_VALUE)) { return new AbsoluteValueExpression(expArgs[0]); } else if (topOperation.equals(AnalyticsParams.REVERSE)) { return new ReverseExpression(expArgs[0]); } throw new SolrException(ErrorCode.BAD_REQUEST,topOperation + " does not have the correct number of arguments."); } else { if (topOperation.equals(AnalyticsParams.ADD)) { return new AddExpression(expArgs); } else if (topOperation.equals(AnalyticsParams.MULTIPLY)) { return new MultiplyExpression(expArgs); } else if (topOperation.equals(AnalyticsParams.DATE_MATH)) { return new DateMathExpression(expArgs); } else if (topOperation.equals(AnalyticsParams.CONCATENATE)) { return new ConcatenateExpression(expArgs); } else if (expArgs.length == 2 && (topOperation.equals(AnalyticsParams.DIVIDE) || topOperation.equals(AnalyticsParams.POWER) || topOperation.equals(AnalyticsParams.LOG))) { if (topOperation.equals(AnalyticsParams.DIVIDE)) { return new DivideExpression(expArgs[0],expArgs[1]); } else if (topOperation.equals(AnalyticsParams.POWER)) { return new PowerExpression(expArgs[0],expArgs[1]); } else if (topOperation.equals(AnalyticsParams.LOG)) { return new LogExpression(expArgs[0],expArgs[1]); } return null; } throw new SolrException(ErrorCode.BAD_REQUEST,topOperation + " does not have the correct number of arguments or is unsupported."); } }
Creates a single expression that contains delegate expressions and/or a StatsCollector. StatsCollectors are given as input and not created within the method so that expressions can share the same StatsCollectors, minimizing computation.
protected SystemMember createSystemMember(InternalDistributedMember member) throws org.apache.geode.admin.AdminException { return new SystemMemberImpl(this,member); }
Constructs & returns a SystemMember instance using the corresponding InternalDistributedMember object.
void writeData(int streamId,byte[] buffer,int offset,int length,int flags) throws IOException { WriteStream os=_os; if (os == null) { return; } if (offset >= 8) { offset-=8; BitsUtil.writeInt16(buffer,offset,length); buffer[offset + 2]=Http2Constants.FRAME_DATA; buffer[offset + 3]=(byte)flags; BitsUtil.writeInt(buffer,offset + 4,streamId); os.write(buffer,offset,length + 8); } else { os.write((byte)(length >> 16)); os.write((byte)(length >> 8)); os.write((byte)(length)); os.write(Http2Constants.FRAME_DATA); os.write(flags); BitsUtil.writeInt(os,streamId); if (length > 0) { os.write(buffer,offset,length); } } if ((flags & Http2Constants.END_STREAM) != 0) { closeWrite(streamId); } }
data (0)
private final void yybegin(int newState){ zzLexicalState=newState; }
Enters a new lexical state
private ShellUtil(){ throw new Error("Do not need instantiate!"); }
Don't let anyone instantiate this class.
private String preparePath(String path){ if (path.endsWith("/") || path.endsWith(pathSeparator)) { path+=DEFAULT_RAML_FILENAME; } return path; }
Checks the path and adds default file name if what was entered appears to be a directory
@Override public void configureZone(final StendhalRPZone zone,final Map<String,String> attributes){ buildhotdoglady(zone); }
Configure a zone.
public static Scs cs_multiply(Scs A,Scs B){ int p, j, nz=0, anz, Cp[], Ci[], Bp[], m, n, bnz, w[], Bi[]; float x[], Bx[], Cx[]; boolean values; Scs C; if (!Scs_util.CS_CSC(A) || !Scs_util.CS_CSC(B)) return (null); if (A.n != B.m) return (null); m=A.m; anz=A.p[A.n]; n=B.n; Bp=B.p; Bi=B.i; Bx=B.x; bnz=Bp[n]; w=new int[m]; values=(A.x != null) && (Bx != null); x=values ? new float[m] : null; C=Scs_util.cs_spalloc(m,n,anz + bnz,values,false); Cp=C.p; for (j=0; j < n; j++) { if (nz + m > C.nzmax) { Scs_util.cs_sprealloc(C,2 * (C.nzmax) + m); } Ci=C.i; Cx=C.x; Cp[j]=nz; for (p=Bp[j]; p < Bp[j + 1]; p++) { nz=Scs_scatter.cs_scatter(A,Bi[p],(Bx != null) ? Bx[p] : 1,w,x,j + 1,C,nz); } if (values) for (p=Cp[j]; p < nz; p++) Cx[p]=x[Ci[p]]; } Cp[n]=nz; Scs_util.cs_sprealloc(C,0); return C; }
Sparse matrix multiplication, C = A*B
@Override public void topologyChanged(List<LDUpdate> updateList){ Iterator<Device> diter=deviceMap.values().iterator(); if (updateList != null) { if (logger.isTraceEnabled()) { for ( LDUpdate update : updateList) { logger.trace("Topo update: {}",update); } } } while (diter.hasNext()) { Device d=diter.next(); if (d.updateAttachmentPoint()) { if (logger.isDebugEnabled()) { logger.debug("Attachment point changed for device: {}",d); } sendDeviceMovedNotification(d); } } debugEventService.flushEvents(); }
Topology listener method.
private TreePath findShallowestPath(TreePath[] paths){ int shallowest=-1; TreePath shallowestPath=null; for (int counter=paths.length - 1; counter >= 0; counter--) { if (paths[counter] != null) { if (shallowest != -1) { if (paths[counter].getPathCount() < shallowest) { shallowest=paths[counter].getPathCount(); shallowestPath=paths[counter]; if (shallowest == 1) { return shallowestPath; } } } else { shallowestPath=paths[counter]; shallowest=paths[counter].getPathCount(); } } } return shallowestPath; }
Returns the TreePath with the smallest path count in <code>paths</code>. Will return null if there is no non-null TreePath is <code>paths</code>.
public AppUser addNewUser(String username,String pwd,String priv,String email,boolean confirmed){ if (this.retrieveUserInfoFromMetaDB(username) != null) return null; AppUser newUser=new AppUser(); newUser.setName(username.trim().toLowerCase()); newUser.setPassword(pwd); newUser.setUserprivilege(AppUser.PRIV_USER_STANDARD); newUser.setEmail(email); newUser.setVerified(confirmed); try { int privInt=Integer.parseInt(priv); if (privInt == AppUser.PRIV_USER_POWER || privInt == AppUser.PRIV_USER_RESTRICTED) newUser.setUserprivilege(privInt); } catch ( Exception ex) { } newUser.setMd5Hash(newUser.calMd5(newUser.getPassword())); metaDb.upsertAppUser(newUser); this.addUser(newUser); return newUser; }
Add a new user. Return AppUser object if succeed. Otherwise null.
protected FinallyBlockImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private Compiler(){ }
Prevent this class from being instantiated.
public boolean initLogin(){ m_cc=CConnection.get(Adempiere.getCodeBaseHost()); hostField.setValue(m_cc); if (Ini.isPropertyBool(Ini.P_VALIDATE_CONNECTION_ON_STARTUP)) { validateConnection(); } userTextField.setText(Ini.getProperty(Ini.P_UID)); if (Ini.isPropertyBool(Ini.P_STORE_PWD)) passwordField.setText(Ini.getProperty(Ini.P_PWD)); else passwordField.setText(""); languageCombo.setSelectedItem(Ini.getProperty(Ini.P_LANGUAGE)); if (Ini.isPropertyBool(Ini.P_A_LOGIN)) { connectionOK(); defaultsOK(); if (m_connectionOK) m_okPressed=true; return m_connectionOK; } return false; }
Set Initial & Ini Parameters Optional Automatic login
public final double doOperation() throws OperatorFailedException { List<NodeRef> candidates=new ArrayList<NodeRef>(); for (int i=0; i < tree.getNodeCount(); i++) { NodeRef node=tree.getNode(i); if (tree.getNodeTrait(node,indicatorTrait) == 1.0) candidates.add(node); } if (candidates.size() == 0) throw new OperatorFailedException("No suitable bits!"); NodeRef node=candidates.get(MathUtils.nextInt(candidates.size())); NodeRef newNode=node; for (int i=0; i < k; i++) { int randomNode=MathUtils.nextInt(3); if (randomNode < 2) { if (!tree.isExternal(newNode)) { newNode=tree.getChild(newNode,randomNode); } } else if (!tree.isRoot(newNode)) { newNode=tree.getParent(newNode); } } if (node == newNode) throw new OperatorFailedException("Moving to same node!"); double nodeTrait, newTrait; double nodeRate, newRate; nodeTrait=tree.getNodeTrait(node,indicatorTrait); newTrait=tree.getNodeTrait(newNode,indicatorTrait); tree.setNodeTrait(node,indicatorTrait,newTrait); tree.setNodeTrait(newNode,indicatorTrait,nodeTrait); if (swapTrait2) { if (trait2 != null) { nodeTrait=tree.getNodeTrait(node,trait2); newTrait=tree.getNodeTrait(newNode,trait2); tree.setNodeTrait(node,trait2,newTrait); tree.setNodeTrait(newNode,trait2,nodeTrait); } else { nodeRate=tree.getNodeRate(node); newRate=tree.getNodeRate(newNode); tree.setNodeRate(node,newRate); tree.setNodeRate(newNode,nodeRate); } } return 0.0; }
Pick a parent-child node pair involving a single rate change and swap the rate change location and corresponding rate parameters.
public void serializationPerformanceRoutine(ShoppingCartStateSerializer serializer,int sampleSize,int skuCount,int giftCount,int couponCount) throws Exception { final List<ShoppingCart> carts=new ArrayList<ShoppingCart>(sampleSize); final List<byte[]> cartsB=new ArrayList<byte[]>(sampleSize); for (int i=0; i < sampleSize; i++) { carts.add(createRandomCart(skuCount,giftCount,couponCount,i)); } byte[] bytes=null; final long startSerializing=System.currentTimeMillis(); for ( final ShoppingCart cart : carts) { bytes=serializer.saveState(cart); cartsB.add(bytes); } final long finishSerializing=System.currentTimeMillis(); System.out.println("Serializing " + sampleSize + " carts took ~"+ (finishSerializing - startSerializing)+ "ms "+ "(size of cart is ~"+ new BigDecimal(((double)bytes.length) / 1024).setScale(1,RoundingMode.HALF_UP).toPlainString()+ "Kb)"); ShoppingCart cart=null; final long startDeserializing=System.currentTimeMillis(); for ( byte[] b : cartsB) { cart=serializer.restoreState(b); } final long finishDeserializing=System.currentTimeMillis(); System.out.println("Deserializing " + sampleSize + " carts took ~"+ (finishDeserializing - startDeserializing)+ "ms"); assertNotNull(cart.getGuid()); long totalMs=(finishSerializing - startSerializing + finishDeserializing - startDeserializing); System.out.println("Total to and back for " + sampleSize + " carts took ~"+ totalMs+ "ms (~"+ new BigDecimal(totalMs).divide(new BigDecimal(sampleSize),2,RoundingMode.HALF_UP).toPlainString()+ "ms per cart)"); }
This routine create sampleSize number of shopping carts with 25 SKU, 3 gifts serialises all of them then deserialises all of them to measure time it takes for both.
public void writeSample(MediaSample sample){ mRtpDummySender.incomingStarted(); VideoOrientation orientation=((VideoSample)sample).getVideoOrientation(); if (orientation != null) { this.videoOrientation=orientation; } int[] decodedFrame=NativeH264Decoder.DecodeAndConvert(sample.getData(),videoOrientation.getOrientation().getValue(),decodedFrameDimensions); if (NativeH264Decoder.getLastDecodeStatus() == 0) { if ((mSurface != null) && (decodedFrame.length > 0)) { if ((rgbFrame.getWidth() != decodedFrameDimensions[0]) || (rgbFrame.getHeight() != decodedFrameDimensions[1])) { rgbFrame=Bitmap.createBitmap(decodedFrameDimensions[0],decodedFrameDimensions[1],Bitmap.Config.RGB_565); mEventListener.onPlayerResized(decodedFrameDimensions[0],decodedFrameDimensions[1]); } rgbFrame.setPixels(decodedFrame,0,decodedFrameDimensions[0],0,0,decodedFrameDimensions[0],decodedFrameDimensions[1]); mSurface.setImage(rgbFrame); } } }
Write a media sample
public void save() throws IOException { try { final FileOutputStream fos=new FileOutputStream(new File(configfile.getFile())); final Document doc=new DocumentImpl(); final Element collections=doc.createElement(Subcollection.TAG_COLLECTIONS); final Iterator iterator=collectionMap.values().iterator(); while (iterator.hasNext()) { final Subcollection subCol=(Subcollection)iterator.next(); final Element collection=doc.createElement(Subcollection.TAG_COLLECTION); collections.appendChild(collection); final Element name=doc.createElement(Subcollection.TAG_NAME); name.setNodeValue(subCol.getName()); collection.appendChild(name); final Element whiteList=doc.createElement(Subcollection.TAG_WHITELIST); whiteList.setNodeValue(subCol.getWhiteListString()); collection.appendChild(whiteList); final Element blackList=doc.createElement(Subcollection.TAG_BLACKLIST); blackList.setNodeValue(subCol.getBlackListString()); collection.appendChild(blackList); } DomUtil.saveDom(fos,collections); fos.flush(); fos.close(); } catch ( FileNotFoundException e) { throw new IOException(e.toString()); } }
Save collections into file
public ModifierSlot(final String enumName,final String typeName){ super(enumName); this.typeName=typeName; }
Construct new ModifierSlot.
public int nnz(){ return st.size(); }
Returns the number of nonzero entries in this vector.
public InternalStatisticsDisabledException(String msg,Throwable cause){ super(msg,cause); }
Constructs an instance of <code>StatisticsDisabledException</code> with the specified detail message and cause.
public void tickSyncScheduler(){ this.syncScheduler.tick(); }
Ticks the synchronous scheduler.
@Override public boolean equals(Object o){ if (o == this) return true; if (!(o instanceof Set)) return false; Collection c=(Collection)o; if (c.size() != size()) return false; try { return containsAll(c); } catch ( ClassCastException unused) { return false; } catch ( NullPointerException unused) { return false; } }
Compares the specified object with this set for equality. Returns <tt>true</tt> if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set. This ensures that the <tt>equals</tt> method works properly across different implementations of the <tt>Set</tt> interface.<p> This implementation first checks if the specified object is this set; if so it returns <tt>true</tt>. Then, it checks if the specified object is a set whose size is identical to the size of this set; if not, it returns false. If so, it returns <tt>containsAll((Collection) o)</tt>.
public ProviderNotFoundException(String name,Throwable cause){ super(MessageFormat.format("no provider for {0}",name),cause); }
Constructs an exception indicating the specified provider was not found.
public static boolean fileCopy(String src,String dest){ SuperUserCommand superUserCommand=new SuperUserCommand(new String[]{"rm -f '" + dest + "'","cat '" + src + "' >> '"+ dest+ "'","chmod 0777 '" + dest + "'","echo 'done'"}); superUserCommand.setHideStandardOutput(true); superUserCommand.execute(); return superUserCommand.commandWasSuccessful(); }
Copy a file with root permissions
@Override public WeightVector train(SLProblem problem,SLParameters params) throws Exception { WeightVector init=new WeightVector(10000); return train(problem,params,init); }
To train with the default choice(zero vector) of initial weight vector. Often this suffices.
private void messageDeliveredAction(Bundle data){ IMqttToken token=removeMqttToken(data); if (token != null) { if (callback != null) { Status status=(Status)data.getSerializable(MqttServiceConstants.CALLBACK_STATUS); if (status == Status.OK && token instanceof IMqttDeliveryToken) { callback.deliveryComplete((IMqttDeliveryToken)token); } } } }
Process notification of a published message having been delivered
private static void initFont(String fontName){ GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment(); boolean needsLoading=true; for ( String font : ge.getAvailableFontFamilyNames()) { if (fontName.equals(font)) { needsLoading=false; break; } } if (needsLoading) { String resource="data/gui/" + fontName + ".ttf"; try { ge.registerFont(Font.createFont(Font.TRUETYPE_FONT,DataLoader.getResourceAsStream(resource))); } catch ( IOException|FontFormatException e) { logger.error("Error loading custom font '" + resource + '"',e); } } }
Load a custom font.
public void printMissingDeps(List<Map<String,Set<String>>> result){ assert result.size() == 2; @SuppressWarnings("unused") Map<String,Set<String>> deps=result.get(0); Map<String,Set<String>> missing=result.get(1); for ( String fqcn : missing.keySet()) { mLog.info("%s",fqcn); } }
Prints only a summary of the missing dependencies to the current logger.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public int size(){ return size; }
Returns the number of bytes in the backing array that are valid.
public static boolean usingLocalGraphics(Context context){ SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context); String sunshineArtPack=context.getString(R.string.pref_art_pack_sunshine); return prefs.getString(context.getString(R.string.pref_art_pack_key),sunshineArtPack).equals(sunshineArtPack); }
Helper method to return whether or not Sunshine is using local graphics.
private void findAllModifiedClasses(String name,PathImpl sourceDir,PathImpl classDir,String sourcePath,ArrayList<String> sources) throws IOException, ClassNotFoundException { String[] list; try { list=sourceDir.list(); } catch ( IOException e) { return; } for (int i=0; list != null && i < list.length; i++) { if (list[i].startsWith(".")) continue; if (_excludedDirectories.contains(list[i])) continue; PathImpl subSource=sourceDir.lookup(list[i]); if (subSource.isDirectory()) { findAllModifiedClasses(name + list[i] + "/",subSource,classDir.lookup(list[i]),sourcePath,sources); } else if (list[i].endsWith(_sourceExt)) { int tail=list[i].length() - _sourceExt.length(); String prefix=list[i].substring(0,tail); PathImpl subClass=classDir.lookup(prefix + ".class"); if (subClass.getLastModified() < subSource.getLastModified()) { sources.add(name + list[i]); } } } if (!_requireSource) return; try { list=classDir.list(); } catch ( IOException e) { return; } for (int i=0; list != null && i < list.length; i++) { if (list[i].startsWith(".")) continue; if (_excludedDirectories.contains(list[i])) continue; PathImpl subClass=classDir.lookup(list[i]); if (list[i].endsWith(".class")) { String prefix=list[i].substring(0,list[i].length() - 6); PathImpl subSource=sourceDir.lookup(prefix + _sourceExt); if (!subSource.exists()) { String tail=subSource.getTail(); boolean doRemove=true; if (tail.indexOf('$') > 0) { String subTail=tail.substring(0,tail.indexOf('$')) + _sourceExt; PathImpl subJava=subSource.getParent().lookup(subTail); if (subJava.exists()) doRemove=false; } if (doRemove) { log.finer(L.l("removing obsolete class '{0}'.",subClass.getPath())); subClass.remove(); } } } } }
Returns the classes which need compilation.
public static MethodTraceCoverageTestFitness createMethodTestFitness(String className,String method){ return new MethodTraceCoverageTestFitness(className,method.substring(method.lastIndexOf(".") + 1)); }
Create a fitness function for branch coverage aimed at covering the root branch of the given method in the given class. Covering a root branch means entering the method.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:59:50.439 -0500",hash_original_method="EB3E524D388CAA0001E918D3BE2E0050",hash_generated_method="F8904635ACB2C47E51F6597E693D3268") public static void start(){ if (!enabled) { return; } if (samplingProfiler != null) { Log.e(TAG,"SamplingProfilerIntegration already started at " + new Date(startMillis)); return; } ThreadGroup group=Thread.currentThread().getThreadGroup(); SamplingProfiler.ThreadSet threadSet=SamplingProfiler.newThreadGroupTheadSet(group); samplingProfiler=new SamplingProfiler(samplingProfilerDepth,threadSet); samplingProfiler.start(samplingProfilerMilliseconds); startMillis=System.currentTimeMillis(); }
Starts the profiler if profiling is enabled.
@Inject public NewMyFileAction(SampleActionsResources resources,DialogFactory dialogFactory,CoreLocalizationConstant coreLocalizationConstant,EventBus eventBus,AppContext appContext,NotificationManager notificationManager){ super("Create my file","Create a new file",resources.icon(),dialogFactory,coreLocalizationConstant,eventBus,appContext,notificationManager); }
Creates new action.
static String pathToCookiePath(String path){ if (path == null) { return "/"; } int lastSlash=path.lastIndexOf('/'); return path.substring(0,lastSlash + 1); }
Returns a cookie-safe path by truncating everything after the last "/". When request path like "/foo/bar.html" yields a cookie, that cookie's default path is "/foo/".
public void error(SourceLocator srcLctr,String msg,Exception e) throws TransformerException { error(srcLctr,msg,null,e); }
Tell the user of an error, and probably throw an exception.
public void destroy(){ EventBus.getDefault().post(new ControllerDestroyedEvent(this)); EventBus.getDefault().unregister(this); }
Call this from onDestroy() of an activity or fragment, or from an equivalent point in time, to tear down the entire controller. A fresh controller should be created if you want to use the camera again in the future.
public boolean equals(Object obj){ if (this == obj) return true; if (!(obj instanceof Path)) return false; Path target=(Path)obj; if ((separators & HASH_MASK) != (target.separators & HASH_MASK)) return false; String[] targetSegments=target.segments; int i=segments.length; if (i != targetSegments.length) return false; while (--i >= 0) if (!segments[i].equals(targetSegments[i])) return false; return device == target.device || (device != null && device.equals(target.device)); }
Returns whether this path equals the given object. <p> Equality for paths is defined to be: same sequence of segments, same absolute/relative status, and same device. Trailing separators are disregarded. Paths are not generally considered equal to objects other than paths. </p>
public ActiveMQRAMessageListener(final MessageListener listener,final ActiveMQRAMessageConsumer consumer){ if (ActiveMQRAMessageListener.trace) { ActiveMQRALogger.LOGGER.trace("constructor(" + listener + ", "+ consumer+ ")"); } this.listener=listener; this.consumer=consumer; }
Create a new wrapper
@Override protected void sendDispositionHeader(final OutputStream out) throws IOException { LOG.trace("enter sendDispositionHeader(OutputStream out)"); super.sendDispositionHeader(out); final String filename=source.getFileName(); if (filename != null) { out.write(FILE_NAME_BYTES); out.write(QUOTE_BYTES); out.write(EncodingUtil.getAsciiBytes(filename)); out.write(QUOTE_BYTES); } }
Write the disposition header to the output stream
void traceError(Throwable e){ if (trace) { e.printStackTrace(); } }
Write the stack trace if trace is enabled.
public void statistics(Statistic stats){ log(Level.STATISTICS,stats.getKey() + ": " + stats.formatValue()); }
Log a statistics object.
public LineView(Element elem){ super(elem); }
Creates a LineView object.
public void enableVM(String hostname) throws IllegalStateException { logger.info("Enabling VM " + hostname); assignableVMs.enableVM(hostname); }
Enable the VM with the specified host name. Hosts start in an enabled state, so you only need to call this method if you have previously explicitly disabled the host.
private List<StoragePool> returnMatchedVNXPoolsForGivenAutoTieringPolicy(List<StoragePool> pools,String auto_tier_policy_name){ if (AutoTieringPolicy.VnxFastPolicy.DEFAULT_NO_MOVEMENT.toString().equalsIgnoreCase(auto_tier_policy_name)) { _logger.info("Auto Tiering {} Matcher Ended {} :",auto_tier_policy_name,Joiner.on("\t").join(getNativeGuidFromPools(pools))); return pools; } if (AutoTieringPolicy.VnxFastPolicy.DEFAULT_AUTOTIER.toString().equalsIgnoreCase(auto_tier_policy_name) || AutoTieringPolicy.VnxFastPolicy.DEFAULT_START_HIGH_THEN_AUTOTIER.toString().equalsIgnoreCase(auto_tier_policy_name)) { return getMatchingPoolsForVNXAutoTier(pools,auto_tier_policy_name); } return runRankingAlgorithmToGetMatchedPoolsForHighAndLowTiers(auto_tier_policy_name,pools); }
Ranking Algorithm to find matched Pools NO_DATA_MOVEMENT : return all the Pools AUTO_TIER : Find Pools which contains more than one tier, if not found return all the Pools HIGHEST_TIER: Find Pools which contains max tierPercentage looping through each Derive Type starting from SSD,FC,SAS,NL_SAS,SATA. If a pool is being found with max tier Percentage for a given drive type, return the matched Pool back.If more than one pool is having the same max tier percentage, then pass matching pools to find max tier Percentage for the next Drive Type, and continues till we get a single matched Pool or the processing of all drive Types is done. LOWEST_TIER: The same logic works , by passing drive Types in reverse order.
final public boolean isInLayout(){ return mInLayout; }
Return true if the layout is included as part of an activity view hierarchy via the &lt;fragment&gt; tag. This will always be true when fragments are created through the &lt;fragment&gt; tag, <em>except</em> in the case where an old fragment is restored from a previous state and it does not appear in the layout of the current state.
public void traverse(int pos,int top) throws org.xml.sax.SAXException { while (DTM.NULL != pos) { startNode(pos); int nextNode=m_dtm.getFirstChild(pos); while (DTM.NULL == nextNode) { endNode(pos); if ((DTM.NULL != top) && top == pos) break; nextNode=m_dtm.getNextSibling(pos); if (DTM.NULL == nextNode) { pos=m_dtm.getParent(pos); if ((DTM.NULL == pos) || ((DTM.NULL != top) && (top == pos))) { nextNode=DTM.NULL; break; } } } pos=nextNode; } }
Perform a non-recursive pre-order/post-order traversal, operating as a Visitor. startNode (preorder) and endNode (postorder) are invoked for each node as we traverse over them, with the result that the node is written out to m_contentHandler.
public LatLng toLatLng(){ double OSGB_F0=0.9996012717; double N0=-100000.0; double E0=400000.0; double phi0=Math.toRadians(49.0); double lambda0=Math.toRadians(-2.0); double a=RefEll.AIRY_1830.getMaj(); double b=RefEll.AIRY_1830.getMin(); double eSquared=RefEll.AIRY_1830.getEcc(); double phi=0.0; double lambda=0.0; double E=this.easting; double N=this.northing; double n=(a - b) / (a + b); double M=0.0; double phiPrime=((N - N0) / (a * OSGB_F0)) + phi0; do { M=(b * OSGB_F0) * (((1 + n + ((5.0 / 4.0) * n * n)+ ((5.0 / 4.0) * n * n* n)) * (phiPrime - phi0)) - (((3 * n) + (3 * n * n) + ((21.0 / 8.0) * n * n* n)) * Math.sin(phiPrime - phi0) * Math.cos(phiPrime + phi0)) + ((((15.0 / 8.0) * n * n) + ((15.0 / 8.0) * n * n* n)) * Math.sin(2.0 * (phiPrime - phi0)) * Math.cos(2.0 * (phiPrime + phi0))) - (((35.0 / 24.0) * n * n* n) * Math.sin(3.0 * (phiPrime - phi0)) * Math.cos(3.0 * (phiPrime + phi0)))); phiPrime+=(N - N0 - M) / (a * OSGB_F0); } while ((N - N0 - M) >= 0.001); double v=a * OSGB_F0 * Math.pow(1.0 - eSquared * Util.sinSquared(phiPrime),-0.5); double rho=a * OSGB_F0 * (1.0 - eSquared)* Math.pow(1.0 - eSquared * Util.sinSquared(phiPrime),-1.5); double etaSquared=(v / rho) - 1.0; double VII=Math.tan(phiPrime) / (2 * rho * v); double VIII=(Math.tan(phiPrime) / (24.0 * rho * Math.pow(v,3.0))) * (5.0 + (3.0 * Util.tanSquared(phiPrime)) + etaSquared - (9.0 * Util.tanSquared(phiPrime) * etaSquared)); double IX=(Math.tan(phiPrime) / (720.0 * rho * Math.pow(v,5.0))) * (61.0 + (90.0 * Util.tanSquared(phiPrime)) + (45.0 * Util.tanSquared(phiPrime) * Util.tanSquared(phiPrime))); double X=Util.sec(phiPrime) / v; double XI=(Util.sec(phiPrime) / (6.0 * v * v* v)) * ((v / rho) + (2 * Util.tanSquared(phiPrime))); double XII=(Util.sec(phiPrime) / (120.0 * Math.pow(v,5.0))) * (5.0 + (28.0 * Util.tanSquared(phiPrime)) + (24.0 * Util.tanSquared(phiPrime) * Util.tanSquared(phiPrime))); double XIIA=(Util.sec(phiPrime) / (5040.0 * Math.pow(v,7.0))) * (61.0 + (662.0 * Util.tanSquared(phiPrime)) + (1320.0 * Util.tanSquared(phiPrime) * Util.tanSquared(phiPrime))+ (720.0 * Util.tanSquared(phiPrime) * Util.tanSquared(phiPrime)* Util.tanSquared(phiPrime))); phi=phiPrime - (VII * Math.pow(E - E0,2.0)) + (VIII * Math.pow(E - E0,4.0)) - (IX * Math.pow(E - E0,6.0)); lambda=lambda0 + (X * (E - E0)) - (XI * Math.pow(E - E0,3.0)) + (XII * Math.pow(E - E0,5.0)) - (XIIA * Math.pow(E - E0,7.0)); return new LatLng(Math.toDegrees(phi),Math.toDegrees(lambda)); }
Convert this OSGB grid reference to a latitude/longitude pair using the OSGB36 datum. Note that, the LatLng object may need to be converted to the WGS84 datum depending on the application.
public static String toSVG(Object... objects){ List<Object> flattened=new ArrayList<>(); for ( Object o : objects) { if (o instanceof Polygon[]) { flattened.addAll(Arrays.asList((Polygon[])o)); } else { flattened.add(o); } } double minLat=Double.POSITIVE_INFINITY; double maxLat=Double.NEGATIVE_INFINITY; double minLon=Double.POSITIVE_INFINITY; double maxLon=Double.NEGATIVE_INFINITY; for ( Object o : flattened) { final Rectangle r; if (o instanceof Polygon) { r=Rectangle.fromPolygon(new Polygon[]{(Polygon)o}); minLat=Math.min(minLat,r.minLat); maxLat=Math.max(maxLat,r.maxLat); minLon=Math.min(minLon,r.minLon); maxLon=Math.max(maxLon,r.maxLon); } } if (Double.isFinite(minLat) == false || Double.isFinite(maxLat) == false || Double.isFinite(minLon) == false || Double.isFinite(maxLon) == false) { throw new IllegalArgumentException("you must pass at least one polygon"); } double xpadding=(maxLon - minLon) / 64; double ypadding=(maxLat - minLat) / 64; double pointX=xpadding * 0.1; double pointY=ypadding * 0.1; StringBuilder sb=new StringBuilder(); sb.append("<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"640\" width=\"480\" viewBox=\""); sb.append(minLon - xpadding).append(" ").append(90 - maxLat - ypadding).append(" ").append(maxLon - minLon + (2 * xpadding)).append(" ").append(maxLat - minLat + (2 * ypadding)); sb.append("\">\n"); for ( Object o : flattened) { if (o instanceof double[]) { double point[]=(double[])o; sb.append("<!-- point: "); sb.append(point[0] + "," + point[1]); sb.append(" -->\n"); } else { sb.append("<!-- " + o.getClass().getSimpleName() + ": \n"); sb.append(o.toString()); sb.append("\n-->\n"); } final Polygon gon; final String style; final String opacity; if (o instanceof Rectangle) { gon=boxPolygon((Rectangle)o); style="fill:lightskyblue;stroke:black;stroke-width:0.2%;stroke-dasharray:0.5%,1%;"; opacity="0.3"; } else if (o instanceof double[]) { double point[]=(double[])o; gon=boxPolygon(new Rectangle(Math.max(-90,point[0] - pointY),Math.min(90,point[0] + pointY),Math.max(-180,point[1] - pointX),Math.min(180,point[1] + pointX))); style="fill:red;stroke:red;stroke-width:0.1%;"; opacity="0.7"; } else { gon=(Polygon)o; style="fill:lawngreen;stroke:black;stroke-width:0.3%;"; opacity="0.5"; } double polyLats[]=gon.getPolyLats(); double polyLons[]=gon.getPolyLons(); sb.append("<polygon fill-opacity=\"" + opacity + "\" points=\""); for (int i=0; i < polyLats.length; i++) { if (i > 0) { sb.append(" "); } sb.append(polyLons[i]).append(",").append(90 - polyLats[i]); } sb.append("\" style=\"" + style + "\"/>\n"); for ( Polygon hole : gon.getHoles()) { double holeLats[]=hole.getPolyLats(); double holeLons[]=hole.getPolyLons(); sb.append("<polygon points=\""); for (int i=0; i < holeLats.length; i++) { if (i > 0) { sb.append(" "); } sb.append(holeLons[i]).append(",").append(90 - holeLats[i]); } sb.append("\" style=\"fill:lightgray\"/>\n"); } } sb.append("</svg>\n"); return sb.toString(); }
Returns svg of polygon for debugging. <p> You can pass any number of objects: Polygon: polygon with optional holes Polygon[]: arrays of polygons for convenience Rectangle: for a box double[2]: as latitude,longitude for a point <p> At least one object must be a polygon. The viewBox is formed around all polygons found in the arguments.
@SuppressWarnings("deprecation") public void rewardMoney(Player player,int amount){ if (plugin.setUpEconomy(true)) { try { plugin.getEconomy().depositPlayer(player,amount); } catch ( NoSuchMethodError e) { plugin.getEconomy().depositPlayer(player.getName(),amount); } if (amount > 1) player.sendMessage(plugin.getChatHeader() + ChatColor.translateAlternateColorCodes('&',plugin.getPluginLang().getString("money-reward-received","You received: AMOUNT !").replace("AMOUNT",amount + " " + plugin.getEconomy().currencyNamePlural()))); else player.sendMessage(plugin.getChatHeader() + ChatColor.translateAlternateColorCodes('&',plugin.getPluginLang().getString("money-reward-received","You received: AMOUNT !").replace("AMOUNT",amount + " " + plugin.getEconomy().currencyNameSingular()))); } }
Give money reward to a player (specified in configuration file).
public boolean isSmallestMinY(final PlanetModel planetModel){ if (minY == null) return false; return minY - planetModel.getMinimumYValue() < Vector.MINIMUM_RESOLUTION; }
Return true if minY is as small as the planet model allows.
List<String> linesToStatements(List<String> lines){ List<String> statements=new ArrayList<>(); Delimiter nonStandardDelimiter=null; CqlStatementBuilder cqlStatementBuilder=new CqlStatementBuilder(); for (int lineNumber=1; lineNumber <= lines.size(); lineNumber++) { String line=lines.get(lineNumber - 1); if (cqlStatementBuilder.isEmpty()) { if (!StringUtils.hasText(line)) { continue; } Delimiter newDelimiter=cqlStatementBuilder.extractNewDelimiterFromLine(line); if (newDelimiter != null) { nonStandardDelimiter=newDelimiter; continue; } cqlStatementBuilder.setLineNumber(lineNumber); if (nonStandardDelimiter != null) { cqlStatementBuilder.setDelimiter(nonStandardDelimiter); } } cqlStatementBuilder.addLine(line); if (cqlStatementBuilder.isTerminated()) { String cqlStatement=cqlStatementBuilder.getCqlStatement(); statements.add(cqlStatement); LOG.debug("Found statement: " + cqlStatement); cqlStatementBuilder=new CqlStatementBuilder(); } else if (cqlStatementBuilder.canDiscard()) { cqlStatementBuilder=new CqlStatementBuilder(); } } if (!cqlStatementBuilder.isEmpty()) { statements.add(cqlStatementBuilder.getCqlStatement()); } return statements; }
Turns these lines in a series of statements.
public NSDate(String textRepresentation) throws ParseException { date=parseDateString(textRepresentation); }
Parses a date from its textual representation. That representation has the following pattern: <code>yyyy-MM-dd'T'HH:mm:ss'Z'</code>
public boolean textIsPresent(String courseWareErrorText,String text){ if (courseWareErrorText.equals(text)) { return true; } else { return false; } }
Verify that whether the text is present or not
public IssueMatcher equals(URI expectedValue){ return addPropertyMatcher(URIPropertyMatcher.Mode.Equals,expectedValue); }
Returns a URI property matcher that matches a URI property against the given URI.
boolean fitsIntoLong(boolean isPositive,boolean ignoreNegativeZero){ while (count > 0 && digits[count - 1] == '0') { --count; } if (count == 0) { return isPositive || ignoreNegativeZero; } if (decimalAt < count || decimalAt > MAX_COUNT) { return false; } if (decimalAt < MAX_COUNT) return true; for (int i=0; i < count; ++i) { char dig=digits[i], max=LONG_MIN_REP[i]; if (dig > max) return false; if (dig < max) return true; } if (count < decimalAt) return true; return !isPositive; }
Return true if the number represented by this object can fit into a long.
public LineIterator(final Reader reader) throws IllegalArgumentException { if (reader == null) { throw new IllegalArgumentException("Reader must not be null"); } if (reader instanceof BufferedReader) { bufferedReader=(BufferedReader)reader; } else { bufferedReader=new BufferedReader(reader); } }
Constructs an iterator of the lines for a <code>Reader</code>.
private Patterns(){ }
Do not create this static utility class.
public static double pdf(double x,double location,double shape){ final double v=(x - location) / shape; return 1. / (Math.PI * shape * (1 + v * v)); }
PDF function, static version.
@Deprecated public String templateName(){ return template == null ? null : template.getScript(); }
The name of the stored template
public final int allocateNodeNumber(){ return numberOfNodes++; }
Get the next node number
public ActivityMap(ActivityMap parent){ m_map=new HashMap(); m_parent=parent; }
Creates a new ActivityMap instance with the specified parent map.
void doVolunteerForPrimary(){ if (!beginVolunteering()) { return; } boolean dlsDestroyed=false; try { if (logger.isDebugEnabled()) { logger.debug("Begin volunteerForPrimary for {}",BucketAdvisor.this); } DistributedMemberLock thePrimaryLock=null; while (continueVolunteering()) { BucketAdvisor parentBA=parentAdvisor; BucketAdvisor.this.activePrimaryMoveLock.lock(); try { boolean acquiredLock=false; getAdvisee().getCancelCriterion().checkCancelInProgress(null); if (parentBA != null) { if (parentBA.isPrimary() && !isPrimary()) { acquiredLock=acquiredPrimaryLock(); } else { return; } } else { if (startingBucketAdvisor == null) { assignStartingBucketAdvisor(); } if (startingBucketAdvisor != null) { Assert.assertHoldsLock(this,false); synchronized (startingBucketAdvisor) { if (startingBucketAdvisor.isPrimary() && !isPrimary()) { acquiredLock=acquiredPrimaryLock(); } else { return; } } } else { if (thePrimaryLock == null) { thePrimaryLock=getPrimaryLock(true); if (thePrimaryLock == null) { return; } } Assert.assertTrue(!thePrimaryLock.holdsLock()); if (isAggressive()) { acquiredLock=thePrimaryLock.tryLock(Long.MAX_VALUE,TimeUnit.MILLISECONDS); } else { acquiredLock=thePrimaryLock.tryLock(); } if (acquiredLock) { acquiredLock=acquiredPrimaryLock(); } } } if (acquiredLock) { acquirePrimaryRecursivelyForColocated(); acquirePrimaryForRestOfTheBucket(); return; } } finally { BucketAdvisor.this.activePrimaryMoveLock.unlock(); } if (!continueVolunteering()) { return; } waitIfNoPrimaryMemberFound(); } } catch ( LockServiceDestroyedException e) { dlsDestroyed=true; handleException(e,true); } catch ( RegionDestroyedException e) { handleException(e,false); } catch ( CancelException e) { handleException(e,false); } catch ( InterruptedException e) { Thread.currentThread().interrupt(); handleException(e,false); } finally { if (logger.isDebugEnabled()) { logger.debug("Exit volunteerForPrimary for {}; dlsDestroyed={}",BucketAdvisor.this,dlsDestroyed); } endVolunteering(); } }
Invoked by the thread that performs the actual volunteering work.
public static byte[] decodeHex(String hexString){ int length=hexString.length(); if ((length & 0x01) != 0) { throw new IllegalArgumentException("Odd number of characters."); } boolean badHex=false; byte[] out=new byte[length >> 1]; for (int i=0, j=0; j < length; i++) { int c1=hexString.charAt(j++); if (c1 > 'f') { badHex=true; break; } final byte d1=DIGITS[c1]; if (d1 == -1) { badHex=true; break; } int c2=hexString.charAt(j++); if (c2 > 'f') { badHex=true; break; } final byte d2=DIGITS[c2]; if (d2 == -1) { badHex=true; break; } out[i]=(byte)(d1 << 4 | d2); } if (badHex) { throw new IllegalArgumentException("Invalid hexadecimal digit: " + hexString); } return out; }
Quickly converts a hexadecimal string to a byte array.
public boolean isSortingProperties(){ return sortingProperties; }
Get whether this model is currently sorting properties.
private void startQuest(){ setTimings(); getPhases().add(new InactivePhase(timings)); getPhases().add(new InvasionPhase(timings)); getPhases().add(new AwaitingPhase(timings)); setNewNotificationTime(getDefaultPhaseClass().getMinTimeOut(),getDefaultPhaseClass().getMaxTimeOut()); }
first start
public String toleranceTipText(){ return "tolerance parameter used for checking stopping criterion b.up < b.low + 2 tol"; }
Returns the tip text for this property
protected List<MemoryPoolMXBean> loadRawDatas(Map<Object,Object> userData){ return ManagementFactory.getMemoryPoolMXBeans(); }
Call ManagementFactory.getMemoryPoolMXBeans() to load the raw data of this table.
public static Schema load(final JSONObject schemaJson,final SchemaClient httpClient){ SchemaLoader loader=builder().schemaJson(schemaJson).httpClient(httpClient).build(); return loader.load().build(); }
Creates Schema instance from its JSON representation.
public static CommandResult execCommand(String command,boolean isRoot,boolean isNeedResultMsg){ return execCommand(new String[]{command},isRoot,isNeedResultMsg); }
execute shell command
public OMColor(int a,int r,int g,int b){ super(r,g,b); argb=(a << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8)| ((b & 0xFF) << 0); }
Create a color with the specified alpha, red, green, and blue components. The four arguments must each be in the range 0-255. //
public boolean merge(final Frame<? extends V> frame,final boolean[] access){ boolean changes=false; for (int i=0; i < locals; ++i) { if (!access[i] && !values[i].equals(frame.values[i])) { values[i]=frame.values[i]; changes=true; } } return changes; }
Merges this frame with the given frame (case of a RET instruction).
public static void assign(int[] n1,int n2[]){ int idx=n1.length - 1; int i; for (i=n2.length - 1; i >= 0; i--) { n1[idx--]=n2[i]; } while (idx > 0) { n1[idx--]=0; } }
Assign n1 to be the same value as n2. n1's length must be >= n2's length
@SuppressWarnings("unchecked") public static <K,V>Map<K,V> mapOf(Object... keyValPair){ if (keyValPair.length % 2 != 0) throw new IllegalArgumentException("Keys and values must be in pairs"); Map<K,V> map=new HashMap<K,V>(keyValPair.length / 2); for (int i=0; i < keyValPair.length; i+=2) { map.put((K)keyValPair[i],(V)keyValPair[i + 1]); } return map; }
Constructs a map of the key-value pairs, passed as parameters
@Deprecated @Override public boolean commit() throws InstantiationError { if (mEditor != null) { return mEditor.commit(); } throw new InstantiationError("\n ======================================== \nError : " + "Do not call " + tag + "'s `commit()`."+ "\n This method is not supported directly."+ " \n ======================================== \n"); }
<h1><u>Do not use this method</u></h1> <br>
private static double createSubscore(double value,double bestValue,double variance,double bias,boolean ignoreSign){ return Math.min(MathUtil.normalPDFNormalized((ignoreSign ? value - bestValue : Math.max((value - bestValue),0)) / bestValue,variance,0) * bias,bias); }
Create a normalized subscore around a current and expected value, using the normalized Normal CDF. <p/> This function is derived from the statistical probability of achieving the optimal value. Values that are less than the best value will return the best subscore, or the bias (unless ignoreSign = true).
public void append(StringBuffer buffer,String fieldName,boolean[] array,Boolean fullDetail){ appendFieldStart(buffer,fieldName); if (array == null) { appendNullText(buffer,fieldName); } else if (isFullDetail(fullDetail)) { appendDetail(buffer,fieldName,array); } else { appendSummary(buffer,fieldName,array); } appendFieldEnd(buffer,fieldName); }
<p>Append to the <code>toString</code> a <code>boolean</code> array.</p>
@CanIgnoreReturnValue @Override public boolean put(@Nullable K key,@Nullable V value){ addNode(key,value,null); return true; }
Stores a key-value pair in the multimap.
public void ReInit(SimpleCharStream stream,int lexState){ ReInit(stream); SwitchTo(lexState); }
Reinitialise parser.
public static RPairList create(int size){ return create(size,null); }
Creates a new pair list of given size > 0. Note: pair list of size 0 is NULL.
public WebgraphConfiguration(final File configurationFile,boolean lazy) throws IOException { super(configurationFile); this.lazy=lazy; if (this.isEmpty()) return; Iterator<Entry> it=this.entryIterator(); for (SchemaConfiguration.Entry etr=it.next(); it.hasNext(); etr=it.next()) { try { WebgraphSchema f=WebgraphSchema.valueOf(etr.key()); f.setSolrFieldName(etr.getValue()); } catch ( final IllegalArgumentException e) { ConcurrentLog.fine("SolrWebgraphWriter","solr schema file " + configurationFile.getAbsolutePath() + " defines unknown attribute '"+ etr.toString()+ "'"); it.remove(); } } for ( SchemaDeclaration field : WebgraphSchema.values()) { if (this.get(field.name()) == null) { ConcurrentLog.warn("SolrWebgraphWriter"," solr schema file " + configurationFile.getAbsolutePath() + " is missing declaration for '"+ field.name()+ "'"); } } }
initialize the schema with a given configuration file the configuration file simply contains a list of lines with keywords or keyword = value lines (while value is a custom Solr field name
public void testPingPongShortSegments(){ PseudoTcpTestPingPong test=new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setOptAckDelay(5000); test.setBytesPerSend(50); test.doTestPingPong(100,5); }
Test sending a ping as pair of short (non-full) segments. Should take ~1s, due to Delayed ACK interaction with Nagling.
protected void messageLoop(){ try { byte[] buffer=new byte[40000]; while (isConnected()) { int numRead=socket.getInputStream().read(buffer); if (numRead > 0) { if (LOG.isDebugEnabled()) { LOG.debug("TimesealSocketMessageProducer " + "Read " + numRead + " bytes."); } String text=isTimesealOn ? handleTimeseal(new String(buffer,0,numRead)) : new String(buffer,0,numRead); if (StringUtils.isNotBlank(text)) { inboundMessageBuffer.append(IcsUtils.cleanupMessage(text)); listener.messageArrived(inboundMessageBuffer); } } else { if (LOG.isDebugEnabled()) { LOG.debug("TimesealSocketMessageProducer " + "Read 0 bytes disconnecting."); } close(); break; } } LOG.debug("TimesealSocketMessageProducer " + "Not connected disconnecting."); } catch ( Throwable t) { if (t instanceof IOException) { LOG.debug("TimesealSocketMessageProducer " + "Connector " + "IOException occured in messageLoop (These are common when disconnecting and ignorable)",t); } else { listener.onError("TimesealSocketMessageProducer " + "Connector Error in DaemonRun Thwoable",t); } close(); } finally { LOG.debug("TimesealSocketMessageProducer Leaving readInput"); } }
The messageLoop. Reads the inputChannel and then invokes publishInput with the text read. Should really never be invoked.
public void useDropdownVisibleText(String locator,String option){ Select select=new Select(findElement(locator)); select.selectByVisibleText(option); }
useDropdownVisibleText -
public HdfsFileIO(URI uri,TungstenProperties props){ this.uri=uri; hdfsConfig=new Configuration(); for ( String key : props.keyNames()) { String value=props.get(key); hdfsConfig.set(key,value); } try { this.hdfs=FileSystem.get(uri,hdfsConfig); } catch ( IOException e) { throw new FileIOException("Unable to access HDFS: uri=" + uri + " message="+ e.getMessage(),e); } }
Creates a new instance with connection to HDFS.
public Constant(long value){ this(Long.class,value); }
Constructs a new node for defining a constant integer value.
public static ConversionMethod toConversionMethod(XmlConversion xmlConversion){ if (isEmpty(xmlConversion.name)) { xmlConversion.name="undefinedName"; throw new XmlConversionNameException("it's mandatory define a name"); } String name=xmlConversion.name; String conversionType=xmlConversion.type; boolean avoidSet=xmlConversion.avoidSet; Type type=conversionType == null ? JMapConversion.Type.STATIC : conversionType.equalsIgnoreCase("STATIC") ? Type.STATIC : conversionType.equalsIgnoreCase("DYNAMIC") ? Type.DYNAMIC : null; if (type == null) throw new XmlConversionTypeException("wrong type defined, only STATIC and DYNAMIC options are permitted"); String[] from=xmlConversion.from == null ? new String[]{ALL} : trim(xmlConversion.from.split(",")); String[] to=xmlConversion.to == null ? new String[]{ALL} : trim(xmlConversion.to.split(",")); String content=xmlConversion.content.trim(); if (!content.contains(source) && content.contains(destination)) throw new XmlConversionParameterException("the use of the destination isn't permitted without the use of the source"); ParameterNumber number=content.contains(source) ? content.contains(destination) ? TWO : ONE : ZERO; return new ConversionMethod(name,from,to,type,number,content,avoidSet); }
This method transforms a XmlConversion given in input, into a ConversionMethod.
public final int pop(){ m_firstFree--; int n=m_map[m_firstFree]; m_map[m_firstFree]=DTM.NULL; return n; }
Pop a node from the tail of the vector and return the result.
public static void main(String[] args) throws AdeException { final AdeExtRequestType requestType=AdeExtRequestType.CONTROL_DB; System.err.println("Running Ade: " + requestType); final AdeExtMessageHandler messageHandler=new AdeExtMessageHandler(); final ControlDB controlDB=new ControlDB(); try { controlDB.run(args); } catch ( AdeUsageException e) { messageHandler.handleUserException(e); } catch ( AdeInternalException e) { messageHandler.handleAdeInternalException(e); } catch ( AdeException e) { messageHandler.handleAdeException(e); } catch ( Throwable e) { messageHandler.handleUnexpectedException(e); } finally { controlDB.quietCleanup(); } }
The entry point of ControlDB