code
stringlengths
10
174k
nl
stringlengths
3
129k
public TraceGraph(Collection<Span> spans){ this.spansByParent=new SpansByParent(spans); this.spansByTracerId=new SpansByTracerId(spans); }
Create a new TraceGraph
@Override public boolean isPrepared(){ return !dirty && (agent == null || !agent.isDone()); }
Checks whether simulation can be started.
public Bundler putChar(String key,char value){ bundle.putChar(key,value); return this; }
Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key.
public static void closeQuietly(AutoCloseable closeable){ if (closeable != null) { try { closeable.close(); } catch ( RuntimeException rethrown) { throw rethrown; } catch ( Exception ignored) { } } }
Closes 'closeable', ignoring any checked exceptions. Does nothing if 'closeable' is null.
@Override public void updateLong(int columnIndex,long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateLong(" + columnIndex + ", "+ x+ "L);"); } update(columnIndex,ValueLong.get(x)); } catch ( Exception e) { throw logAndConvert(e); } }
Updates a column in the current or insert row.
void andAction(NodeRepresentation nodeRep){ if (nodeRep.parentVector == null) { makeProof(nodeRep,true,false); } else { int idx=nodeRep.getParentIndex(); Decomposition decomp=nodeRep.decomposition; hasChanged=true; if (decomp.definedOp != null) { assumpDefinitions.add(decomp.definedOp); } Vector<SemanticNode> addedAssumps=decomp.children; Vector<NodeRepresentation> addedToAssumeReps=new Vector<NodeRepresentation>(); for (int i=0; i < addedAssumps.size(); i++) { NodeRepresentation rep=decompositionChildToNodeRep(nodeRep,i,this.assumeReps,null); rep.isCreated=true; addedToAssumeReps.add(rep); } this.assumeReps.remove(idx); for (int i=0; i < addedToAssumeReps.size(); i++) { this.assumeReps.add(idx + i,addedToAssumeReps.elementAt(i)); } if (andSplitBegin == -1) { andSplitBegin=idx; andSplitEnd=idx + addedAssumps.size() - 1; } else { andSplitEnd=andSplitEnd + addedAssumps.size() - 1; } raiseWindow(); } }
The /\ action, both for a goal (which generates the proof) and for an assumption (which splits the assumption). Precondition: if this is an AND-split of assumption assumeReps(i), then either andSplitBegin = -1 or andSplitBegin \leq i \leq andSplitEnd.
public PlaceshifterNATManager(){ }
Creates a new instance of PlaceshifterNATManager
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.openTickPaint=SerialUtilities.readPaint(stream); this.closeTickPaint=SerialUtilities.readPaint(stream); }
Provides serialization support.
public ScriptIO(final Script script,final Executor executor){ this.script=script; this.executor=executor; if (script != null) { scriptName=script.getName(); } }
Creates the ScriptIO.
public static String inputStreamToString(InputStream is) throws IOException { InputStreamReader isr=new InputStreamReader(is); BufferedReader br=new BufferedReader(isr); StringWriter sw=new StringWriter(); char c[]=new char[1024]; while (true) { int n=br.read(c,0,c.length); if (n < 0) break; sw.write(c,0,n); } isr.close(); return sw.toString(); }
Reads all content from a given InputStream into a String using the default platform encoding.
@Override public Pair<OperandSize,String> generate(final ITranslationEnvironment environment,final long offset,final List<ReilInstruction> instructions) throws InternalTranslationException { Preconditions.checkNotNull(environment,"Error: Argument environment can't be null"); Preconditions.checkNotNull(instructions,"Error: Argument instructions can't be null"); Preconditions.checkArgument(offset >= 0,"Error: Argument offset can't be less than 0"); return new Pair<OperandSize,String>(OperandSize.BYTE,Helpers.OVERFLOW_FLAG); }
Generates code for the Overflow condition.
public boolean rejectIt(){ log.info("rejectIt - " + toString()); setIsApproved(false); return true; }
Reject Approval
public int doStartTag(){ JspWriter out=pageContext.getOut(); select select=getRequestType(); select.output(out); return (SKIP_BODY); }
Start Tag
public static Volume prepareEmptyVolume(DbClient dbClient,long size,Project project,VirtualArray varray,VirtualPool vpool,String label,int volNumber,int volumesRequested){ Volume volume=new Volume(); volume.setId(URIUtil.createId(Volume.class)); String volumeLabel=AbstractBlockServiceApiImpl.generateDefaultVolumeLabel(label,volNumber,volumesRequested); List<Volume> volumeList=CustomQueryUtility.queryActiveResourcesByConstraint(dbClient,Volume.class,ContainmentPrefixConstraint.Factory.getFullMatchConstraint(Volume.class,"project",project.getId(),volumeLabel)); if (!volumeList.isEmpty()) { throw APIException.badRequests.duplicateLabel(volumeLabel); } volume.setLabel(volumeLabel); volume.setCapacity(size); volume.setThinlyProvisioned(VirtualPool.ProvisioningType.Thin.toString().equalsIgnoreCase(vpool.getSupportedProvisioningType())); volume.setVirtualPool(vpool.getId()); volume.setProject(new NamedURI(project.getId(),volume.getLabel())); volume.setTenant(new NamedURI(project.getTenantOrg().getURI(),volume.getLabel())); volume.setVirtualArray(varray.getId()); volume.setOpStatus(new OpStatusMap()); if (vpool.getDedupCapable() != null) { volume.setIsDeduplicated(vpool.getDedupCapable()); } dbClient.createObject(volume); return volume; }
Prepare a new volume object in the database that can be tracked and overridden as the volume goes through the placement process.
public static XContentType xContentType(byte[] data){ return xContentType(data,0,data.length); }
Guesses the content type based on the provided bytes.
@Override public void close() throws IOException { try { hashFile.close(); } finally { try { idFile.close(); } finally { dataFile.close(); } } }
Closes the DataStore, releasing any file references, etc. In case a transaction is currently open, it will be rolled back. Once closed, the DataStore can no longer be used.
public Composer coefficientRestitutionX(float coefficientRestitutionX){ mCoefficientRestitutionX=coefficientRestitutionX; return this; }
Set coefficient Of Restitution X, as a percentage of 1
protected RegionAttributes createRegionAttributesForPR(int redundancy,int localMaxMem){ AttributesFactory attr=new AttributesFactory(); PartitionAttributesFactory paf=new PartitionAttributesFactory(); PartitionAttributes prAttr=paf.setRedundantCopies(redundancy).setLocalMaxMemory(localMaxMem).setTotalNumBuckets(totalNumBuckets).create(); attr.setPartitionAttributes(prAttr); return attr.create(); }
This private methods sets the passed attributes and returns RegionAttribute object, which is used in create region
public StrBuilder replaceFirst(final StrMatcher matcher,final String replaceStr){ return replace(matcher,replaceStr,0,size,1); }
Replaces the first match within the builder with the replace string. <p> Matchers can be used to perform advanced replace behaviour. For example you could write a matcher to replace where the character 'a' is followed by a number.
public static String date(String dateTime){ if (dateTime == null) { return null; } int index=dateTime.indexOf(' '); if (index != -1) { return dateTime.substring(0,index); } return dateTime; }
See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date This function is dependent on the exact formatting of the MySQL date/time string.
public static int count(Iterator tuples,String field){ int i=0; for (; tuples.hasNext(); ++i, tuples.next()) ; return i; }
Get the number of values in a data column. Duplicates will be counted.
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 boolean hasPrevModifiedTime(){ return fieldSetFlags()[7]; }
Checks whether the 'prevModifiedTime' field has been set
public static String createResourceMatchString(final IResource resource){ String matchPath=resource.getProjectRelativePath().toString(); if (matchPath.startsWith("/") == false) { matchPath="/" + matchPath; } if ((resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) && matchPath.endsWith("/") == false) { matchPath=matchPath + "/"; } return matchPath; }
Gets the normalized matching string for a resource. The string always starts with a slash, then the Eclipse project-relative path, then a slash only if the resource is a folder or project.
private void loadSimulatedNormalData() throws Exception { setLowestMeasuredPercentile(1.0); setSampleCount(sentinelA,1000); setSampleCount(sentinelB,1000); setSampleCount(sentinelC,1000); setSampleCount(sentinelD,1000); setSampleCount(sentinelE,1000); when(mbeanServer.getAttribute(sentinelA,"50thPercentile")).thenReturn(1.0); when(mbeanServer.getAttribute(sentinelB,"75thPercentile")).thenReturn(1.0); when(mbeanServer.getAttribute(sentinelC,"75thPercentile")).thenReturn(1.0); when(mbeanServer.getAttribute(sentinelD,"75thPercentile")).thenReturn(1.0); when(mbeanServer.getAttribute(sentinelE,"75thPercentile")).thenReturn(1.0); when(mbeanServer.isRegistered(sentinelA)).thenReturn(Boolean.TRUE); when(mbeanServer.isRegistered(sentinelB)).thenReturn(Boolean.TRUE); when(mbeanServer.isRegistered(sentinelC)).thenReturn(Boolean.TRUE); when(mbeanServer.isRegistered(sentinelD)).thenReturn(Boolean.TRUE); when(mbeanServer.isRegistered(sentinelE)).thenReturn(Boolean.TRUE); System.out.println("Start manual evaluation ..."); qosHandler.evaluateQoSActions(); }
Creates a set of normal sentinel data.
private String xtoTitleString(DoubleMatrix3D matrix,String[] sliceNames,String[] rowNames,String[] columnNames,String sliceAxisName,String rowAxisName,String columnAxisName,String title){ if (matrix.size() == 0) return "Empty matrix"; StringBuffer buf=new StringBuffer(); for (int i=0; i < matrix.slices(); i++) { if (i != 0) buf.append(sliceSeparator); buf.append(toTitleString(matrix.viewSlice(i),rowNames,columnNames,rowAxisName,columnAxisName,title + "\n" + sliceAxisName+ "="+ sliceNames[i])); } return buf.toString(); }
Returns a string representation of the given matrix with axis as well as rows and columns labeled. Pass <tt>null</tt> to one or more parameters to indicate that the corresponding decoration element shall not appear in the string converted matrix.
public void foldToASCII(char[] input,int length){ final int maxSizeNeeded=4 * length; if (output.length < maxSizeNeeded) { output=new char[ArrayUtil.oversize(maxSizeNeeded,Character.BYTES)]; } outputPos=foldToASCII(input,0,output,0,length); if (preserveOriginal && needToPreserve(input,length)) { state=captureState(); } }
Converts characters above ASCII to their ASCII equivalents. For example, accents are removed from accented characters.
OutputStream writeChannel(int channel) throws IOException { while (os != null) { boolean canWrite=false; synchronized (WRITE_LOCK) { if (!isWriteLocked) { isWriteLocked=true; canWrite=true; } else { try { WRITE_LOCK.wait(5000); } catch ( Exception e) { } } } if (canWrite) { os.write('C'); os.write(channel >> 8); os.write(channel); return os; } } return null; }
Grabs the channel for writing.
private double[][] xPrime(int t){ double[][] x=new double[1][getNumLags() * numVars]; for (int i=0; i < getNumLags(); i++) { double[][] yPrime=yPrime(t - i - 1); System.arraycopy(yPrime[0],0,x[0],i * numVars,numVars); } return x; }
Constructs the x(t) vector.
public void add(final FieldDescriptor type,final Message defaultInstance){ if (type.getJavaType() != FieldDescriptor.JavaType.MESSAGE) { throw new IllegalArgumentException("ExtensionRegistry.add() provided a default instance for a " + "non-message extension."); } add(new ExtensionInfo(type,defaultInstance),Extension.ExtensionType.IMMUTABLE); }
Add a message-type extension to the registry by descriptor.
public SVGOMStopElement(String prefix,AbstractDocument owner){ super(prefix,owner); initializeLiveAttributes(); }
Creates a new SVGOMStopElement object.
public final double relativeAbsoluteError() throws Exception { if (m_NoPriors) { return Double.NaN; } return 100 * meanAbsoluteError() / meanPriorAbsoluteError(); }
Returns the relative absolute error.
public static void combinedLoadBarrier(){ if (VM.VerifyAssertions && VM.runningVM) { VM._assert(VM.NOT_REACHED); } }
Emits an instruction that provides both a LoadLoad and a LoadStore barrier. A LoadLoad barrier ensures that the data accessed by all load instructions before the barrier is loaded before any data from load instructions after the barrier. A LoadStore barrier ensures that the data accessed by all load instructions before the barrier is loaded before any data store instructions after the barrier are completed. <p> We don't provide separate methods for LoadStore and LoadLoad barriers because the appropriate instructions for IA32 and PPC provide both barriers.
@Override public void onSelectionChanged(TimePeriodSlider slider,int value){ DurationFieldType fieldType=mConversion.get(slider.getDateType()); mPeriod=mPeriod.withField(fieldType,value); updatePeriod(); }
This method is called when the selection in the view holder has changed
public int capacity(){ return value.length; }
Returns the number of characters that can be held without growing.
String destinationFilePath(){ return destinationFilePath; }
Get destination file path of this download request.
public void addURL(URL url){ if (!Arrays.asList(getURLs()).contains(url)) super.addURL(url); }
Appends the specified URL to the list of URLs to search for classes and resources.
public void destroy(){ super.destroy(); }
Destruction of the servlet. <br>
protected void additionalContext(VelocityContext context,String env){ }
Derived class may have some additional context properties to add
public ResourceException(String msg){ super(msg); }
Constructs an instance of <code>ResourceException</code> with the specified detail message.
public static org.oscm.vo.VOPricedEvent convertToApi(org.oscm.internal.vo.VOPricedEvent oldVO){ if (oldVO == null) { return null; } org.oscm.vo.VOPricedEvent newVO=new org.oscm.vo.VOPricedEvent(); newVO.setKey(oldVO.getKey()); newVO.setVersion(oldVO.getVersion()); newVO.setSteppedPrices(convertToApiVOSteppedPrice(oldVO.getSteppedPrices())); newVO.setEventDefinition(convertToApi(oldVO.getEventDefinition())); newVO.setEventPrice(oldVO.getEventPrice()); return newVO; }
Convert source version VO to target version VO.
public ParameterizationBuilder(){ this(new LinkedList<Parameterization>()); }
Creates a builder with no starting parameterizations.
public static boolean canReplacePart(World world,BlockPos pos,IMultipart oldPart,IMultipart newPart){ IMultipartContainer container=getPartContainer(world,pos); if (container == null) return false; return container.canReplacePart(oldPart,newPart); }
Checks whether or not the specified part can be replaced by another part to the world.
public boolean hasFromTag(){ return hasParameter(ParameterNames.FROM_TAG); }
Boolean function
@Override public void relocate(){ int w=360, h=245; int x=(this.getWidth() - w) / 2; int y=(this.getHeight() - h) / 2; outputLabel.setLocation(x,y); outputPathField.setLocation(x + 160,y); enableZipEncodingCompression.setLocation(x + 110,y + 40); outputCompression.setLocation(x + 110,y + 75); disableOutputCompression.setLocation(x + 110,y + 100); enableBZip2OutputCompression.setLocation(x + 110,y + 120); enable7ZipOutputCompression.setLocation(x + 110,y + 140); activateDataFileOutput.setLocation(x + 110,y + 160); enableMultipleOutputFiles.setLocation(x,y + 190); outputSizeLimitLabel.setLocation(x,y + 220); outputSizeLimitField.setLocation(x + 160,y + 220); }
A call of this method should validate the positions of the panels components.
public SynchronousLoginInteractor(){ }
An Interactor helps models cross application boundaries such as networks or serialization This LoginInteractor knows nothing about a UI or the LoginPresenter
public static byte[] xor(byte[] x1,byte[] x2){ byte[] out=new byte[x1.length]; for (int i=x1.length - 1; i >= 0; i--) { out[i]=(byte)(x1[i] ^ x2[i]); } return out; }
Compute the bitwise XOR of two arrays of bytes. The arrays have to be of same length. No length checking is performed.
public int position(){ return data.position(); }
Get the current position in the data.
synchronized void start(){ running=true; if (!dataPump.hasCachedTempo()) { long tickPos=getTickPosition(); dataPump.setTempoMPQ(tempoCache.getTempoMPQAt(tickPos)); } dataPump.checkPointMillis=0; dataPump.clearNoteOnCache(); dataPump.needReindex=true; dataPump.resetLoopCount(); synchronized (lock) { lock.notifyAll(); } if (Printer.debug) Printer.debug(" ->Started MIDI play thread"); }
start thread and pump. Requires up-to-date tempoCache
private void inqueueStubActivity(ActivityInfo ai,String realActivityClazz){ if (ai.launchMode == ActivityInfo.LAUNCH_MULTIPLE) return; if (mStubQueue == null) return; int countForMode=STUB_ACTIVITIES_COUNT; int offset=(ai.launchMode - 1) * countForMode; for (int i=0; i < countForMode; i++) { String stubClazz=mStubQueue[i + offset]; if (stubClazz != null && stubClazz.equals(realActivityClazz)) { mStubQueue[i + offset]=null; break; } } }
Unbind the stub activity from real activity
public ImmutableListMultimap<String,String> parameters(){ return parameters; }
Returns a multimap containing the parameters of this media type.
protected DateTimeConverter makeConverter(){ return new DateConverter(); }
Create the Converter with no default value.
public HorizontalLineDrawable(Resources res,int color,float lineWidthDp){ DisplayMetrics metrics=res.getDisplayMetrics(); mState=new HorizontalLineConstantState(metrics,color,lineWidthDp,0f); float lineWidth=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,lineWidthDp,metrics); mPaint=initPaint(color,lineWidth); }
Init with line width specified in DP.
public static int[][] rankMatrix(List<EvaluationStatistics> stats,String measurement){ double V[][]=valueMatrix(stats,measurement); int N=V.length; int k=V[0].length; int R[][]=new int[N][k]; for (int i=0; i < N; i++) { int indices[]=Utils.sort(V[i]); for (int j=0; j < k; j++) { R[i][indices[j]]=(j + 1); } } return R; }
Rank Matrix
public static void disconnect(Context context,ServiceConnection connection){ context.unbindService(connection); }
Connects to an already running QuasselService
public static XPath2FilterContainer04 newInstanceSubtract(Document doc,String xpath2filter){ return new XPath2FilterContainer04(doc,xpath2filter,XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT); }
Creates a new XPath2FilterContainer04 with the filter type "subtract".
public void step(SimState state){ }
This method is performed when the next step for the agent is computed. This agent does nothing, so nothing is inside the body of the method.
public DebugCommand(final int type,final int packetId){ this.arguments=new ArrayList<>(); this.type=type; this.packetId=packetId; }
Creates a new debug message.
public void reset(){ isFilling=false; isCompleted=false; }
Resets the buffer, clearing any data that it holds.
public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest) throws PaymentProtocolException { return new PaymentSession(paymentRequest,false,null); }
Parse a payment request.
public RestoreAction(){ super(UIManager.getString("BETitlePane.restoreButtonText",getLocale())); }
Instantiates a new restore action.
public DNetscapeSslServerName(JDialog parent,byte[] value) throws IOException { super(parent); setTitle(res.getString("DNetscapeSslServerName.Title")); initComponents(); prepopulateWithValue(value); }
Creates a new DNetscapeSslServerName dialog.
boolean isNameUsed(String name){ List<Integer> columnsWithName=columnNames.get(name); return columnsWithName != null && !columnsWithName.isEmpty(); }
Checks if the given column name is already in use.
private Chunk invokeViewMethod(final View rootView,final View targetView,ByteBuffer in){ int l=in.getInt(); String methodName=getString(in,l); Class<?>[] argTypes; Object[] args; if (!in.hasRemaining()) { argTypes=new Class<?>[0]; args=new Object[0]; } else { int nArgs=in.getInt(); argTypes=new Class<?>[nArgs]; args=new Object[nArgs]; for (int i=0; i < nArgs; i++) { char c=in.getChar(); switch (c) { case 'Z': argTypes[i]=boolean.class; args[i]=in.get() == 0 ? false : true; break; case 'B': argTypes[i]=byte.class; args[i]=in.get(); break; case 'C': argTypes[i]=char.class; args[i]=in.getChar(); break; case 'S': argTypes[i]=short.class; args[i]=in.getShort(); break; case 'I': argTypes[i]=int.class; args[i]=in.getInt(); break; case 'J': argTypes[i]=long.class; args[i]=in.getLong(); break; case 'F': argTypes[i]=float.class; args[i]=in.getFloat(); break; case 'D': argTypes[i]=double.class; args[i]=in.getDouble(); break; default : Log.e(TAG,"arg " + i + ", unrecognized type: "+ c); return createFailChunk(ERR_INVALID_PARAM,"Unsupported parameter type (" + c + ") to invoke view method."); } } } Method method=null; try { method=targetView.getClass().getMethod(methodName,argTypes); } catch (NoSuchMethodException e) { Log.e(TAG,"No such method: " + e.getMessage()); return createFailChunk(ERR_INVALID_PARAM,"No such method: " + e.getMessage()); } try { ViewDebug.invokeViewMethod(targetView,method,args); } catch (Exception e) { Log.e(TAG,"Exception while invoking method: " + e.getCause().getMessage()); String msg=e.getCause().getMessage(); if (msg == null) { msg=e.getCause().toString(); } return createFailChunk(ERR_EXCEPTION,msg); } return null; }
Invokes provided method on the view. The method name and its arguments are passed in as inputs via the byte buffer. The buffer contains:<ol> <li> len(method name) </li> <li> method name </li> <li> # of args </li> <li> arguments: Each argument comprises of a type specifier followed by the actual argument. The type specifier is a single character as used in JNI: (Z - boolean, B - byte, C - char, S - short, I - int, J - long, F - float, D - double). <p> The type specifier is followed by the actual value of argument. Booleans are encoded via bytes with 0 indicating false.</li> </ol> Methods that take no arguments need only specify the method name.
public Employee(String name,int age,int empId,String title,int salary,Set addresses){ this.name=name; this.age=age; this.empId=empId; this.title=title; this.salary=salary; this.addresses=addresses; this.phoneNo=new PhoneNo(111,222,333,444); }
Creates a new instance of Employee
public boolean intersects(Geometry geom){ boolean isInPrepGeomArea=isAnyTestComponentInTarget(geom); if (isInPrepGeomArea) return true; if (geom.getDimension() == 0) return false; List lineSegStr=SegmentStringUtil.extractSegmentStrings(geom); if (lineSegStr.size() > 0) { boolean segsIntersect=prepPoly.getIntersectionFinder().intersects(lineSegStr); if (segsIntersect) return true; } if (geom.getDimension() == 2) { boolean isPrepGeomInArea=isAnyTargetComponentInAreaTest(geom,prepPoly.getRepresentativePoints()); if (isPrepGeomInArea) return true; } return false; }
Tests whether this PreparedPolygon intersects a given geometry.
private NaviLogger(){ }
You are not supposed to instantiate this class.
@Override public int compare(T a,T b) throws ClassCastException { Double cla=Double.valueOf(a.getCloudletTotalLength()); Double clb=Double.valueOf(b.getCloudletTotalLength()); return cla.compareTo(clb); }
Compares two Cloudlets.
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { doPost(request,response); }
The doPost method of the servlet. <br> This method is called when a form has its tag value method equals to post.
public boolean hasTargetOffset(){ return hasAddress() && target.hasAddress(); }
Returns whether the target offset is known.
public StoredFluidStack addFluids(StoredFluidStack add,INetworkCache network,ActionType action){ return add; }
used for adding Fluids to the network
public final DD selfSubtract(DD y){ if (isNaN()) return this; return selfAdd(-y.hi,-y.lo); }
Subtracts the argument from the value of <tt>this</tt>. To prevent altering constants, this method <b>must only</b> be used on values known to be newly created.
private void updateVolumeRpJournalRefs(){ log.info("updateVolumeRpJournalRefs - Deprecated."); }
For all RP source/target volumes, identify the associated journal volumes and add the reference.
public static final Parameter base(){ return GPDefaults.base().push(P_BREED); }
Returns the default base, which is built off of the GPDefaults base.
private void becomeCoordinator(InternalDistributedMember oldCoordinator){ assert Thread.holdsLock(viewInstallationLock); if (isCoordinator) { return; } logger.info("This member is becoming the membership coordinator with address {}",localAddress); isCoordinator=true; if (currentView == null) { NetView newView=new NetView(this.localAddress); newView.setFailureDetectionPort(localAddress,services.getHealthMonitor().getFailureDetectionPort()); this.localAddress.setVmViewId(0); installView(newView); isJoined=true; createAndStartViewCreator(newView); startViewBroadcaster(); } else { NetView newView=addMemberToNetView(oldCoordinator); createAndStartViewCreator(newView); startViewBroadcaster(); } }
Transitions this member into the coordinator role. This must be invoked under a synch on viewInstallationLock that was held at the time the decision was made to become coordinator so that the decision is atomic with actually becoming coordinator.
protected Vertex createInput(String text,Network network){ Vertex sentence=network.createSentence(text); Vertex input=network.createInstance(Primitive.INPUT); input.setName(text); input.addRelationship(Primitive.SENSE,getPrimitive()); input.addRelationship(Primitive.INPUT,sentence); sentence.addRelationship(Primitive.INSTANTIATION,Primitive.TWEET); return input; }
Create an input based on the sentence.
private int primaryKey0(Ignite ignite,IgniteCache cache) throws Exception { ClusterNode locNode=ignite.cluster().localNode(); for (int i=0; i < Integer.MAX_VALUE; i++) { if (affinity(cache).isPrimary(locNode,i)) return i; } throw new Exception("Cannot determine affinity key."); }
Gets primary key for the given cache.
public ThumbnailParameterBuilder keepAspectRatio(boolean keep){ this.keepAspectRatio=keep; return this; }
Sets whether or not the thumbnail is to maintain the aspect ratio of the original image.
public void enableCurlLogging(String name,int level){ if (name == null) { throw new NullPointerException("name"); } if (level < Log.VERBOSE || level > Log.ASSERT) { throw new IllegalArgumentException("Level is out of range [" + Log.VERBOSE + ".."+ Log.ASSERT+ "]"); } curlConfiguration=new LoggingConfiguration(name,level); }
Enables cURL request logging for this client.
public JSONObject(JSONTokener x) throws JSONException { this(); char c; String key; if (x.nextClean() != '{') { throw x.syntaxError("A JSONObject text must begin with '{'"); } for (; ; ) { c=x.nextClean(); switch (c) { case 0: throw x.syntaxError("A JSONObject text must end with '}'"); case '}': return; default : x.back(); key=x.nextValue().toString(); } c=x.nextClean(); if (c != ':') { throw x.syntaxError("Expected a ':' after a key"); } this.putOnce(key,x.nextValue()); switch (x.nextClean()) { case ';': case ',': if (x.nextClean() == '}') { return; } x.back(); break; case '}': return; default : throw x.syntaxError("Expected a ',' or '}'"); } } }
Construct a JSONObject from a JSONTokener.
public boolean isSet(_Fields field){ if (field == null) { throw new IllegalArgumentException(); } switch (field) { case TYPE: return isSetType(); case HELLO: return isSetHello(); case ERROR: return isSetError(); case ECHO_REQUEST: return isSetEchoRequest(); case ECHO_REPLY: return isSetEchoReply(); case GET_REQUEST: return isSetGetRequest(); case GET_RESPONSE: return isSetGetResponse(); case PUT_REQUEST: return isSetPutRequest(); case PUT_RESPONSE: return isSetPutResponse(); case DELETE_REQUEST: return isSetDeleteRequest(); case DELETE_RESPONSE: return isSetDeleteResponse(); case SYNC_VALUE: return isSetSyncValue(); case SYNC_VALUE_RESPONSE: return isSetSyncValueResponse(); case SYNC_OFFER: return isSetSyncOffer(); case SYNC_REQUEST: return isSetSyncRequest(); case FULL_SYNC_REQUEST: return isSetFullSyncRequest(); case CURSOR_REQUEST: return isSetCursorRequest(); case CURSOR_RESPONSE: return isSetCursorResponse(); case REGISTER_REQUEST: return isSetRegisterRequest(); case REGISTER_RESPONSE: return isSetRegisterResponse(); case CLUSTER_JOIN_REQUEST: return isSetClusterJoinRequest(); case CLUSTER_JOIN_RESPONSE: return isSetClusterJoinResponse(); } throw new IllegalStateException(); }
Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
private static int correctErrors(int[] codewords,int[] erasures,int numECCodewords) throws ChecksumException { if (erasures != null && erasures.length > numECCodewords / 2 + MAX_ERRORS || numECCodewords < 0 || numECCodewords > MAX_EC_CODEWORDS) { throw ChecksumException.getChecksumInstance(); } return errorCorrection.decode(codewords,numECCodewords,erasures); }
<p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place.</p>
public static boolean isNumber(String str){ try { Integer.parseInt(str); return true; } catch ( NumberFormatException e) { return false; } }
Gets the number attribute of the Util class
@Override public void onModuleLoad(){ IDEInjector injector=GWT.create(IDEInjector.class); @SuppressWarnings("unused") BootstrapController bootstrap=injector.getBootstrapController(); }
This is the entry point method.
@Override public List<String> sort(final String key){ checkIsInMultiOrPipeline(); client.sort(key); return client.getMultiBulkReply(); }
Sort a Set or a List. <p> Sort the elements contained in the List, Set, or Sorted Set value at key. By default sorting is numeric with elements being compared as double precision floating point numbers. This is the simplest form of SORT.
public void testTaskAsync() throws Exception { U.sleep(3000); assertFalse(igfs.isAsync()); IgniteFileSystem igfsAsync=igfs.withAsync(); assertTrue(igfsAsync.isAsync()); for (int i=0; i < REPEAT_CNT; i++) { String arg=DICTIONARY[new Random(System.currentTimeMillis()).nextInt(DICTIONARY.length)]; generateFile(TOTAL_WORDS); Long genLen=igfs.info(FILE).length(); assertNull(igfsAsync.execute(new Task(),new IgfsStringDelimiterRecordResolver(" "),Collections.singleton(FILE),arg)); IgniteFuture<IgniteBiTuple<Long,Integer>> fut=igfsAsync.future(); assertNotNull(fut); IgniteBiTuple<Long,Integer> taskRes=fut.get(); assert F.eq(genLen,taskRes.getKey()); assert F.eq(TOTAL_WORDS,taskRes.getValue()); } igfsAsync.format(); IgniteFuture<?> fut=igfsAsync.future(); assertNotNull(fut); fut.get(); }
Test task.
@SuppressWarnings({"UnusedDeclaration"}) public static PartialCorrelationPdf serializableInstance(){ return new PartialCorrelationPdf(5,2); }
Generates a simple exemplar of this class to test serialization.
protected boolean isOutgoingDiscoveryAllowed(DatapathId sw,OFPort port,boolean isStandard,boolean isReverse){ if (isLinkDiscoverySuppressed(sw,port)) { return false; } IOFSwitch iofSwitch=switchService.getSwitch(sw); if (iofSwitch == null) { return false; } if (port == OFPort.LOCAL) return false; OFPortDesc ofpPort=iofSwitch.getPort(port); if (ofpPort == null) { if (log.isTraceEnabled()) { log.trace("Null physical port. sw={}, port={}",sw.toString(),port.getPortNumber()); } return false; } else { return true; } }
Check if outgoing discovery messages are enabled or not.
public static int uriType(String uri){ if (uri.indexOf(':') != -1) { return ABS_URI; } else if (uri.startsWith("/")) { return ROOT_REL_URI; } else { return NOROOT_REL_URI; } }
Returns the type of a URI: ABS_URI ROOT_REL_URI NOROOT_REL_URI
public static void main(String... a) throws Exception { TestBase test=TestBase.createCaller().init(); test.test(); }
Run just this test.
public GcsPath(@Nullable FileSystem fs,@Nullable String bucket,@Nullable String object){ if (bucket == null) { bucket=""; } checkArgument(!bucket.contains("/"),"GCS bucket may not contain a slash"); checkArgument(bucket.isEmpty() || bucket.matches("[a-z0-9][-_a-z0-9.]+[a-z0-9]"),"GCS bucket names must contain only lowercase letters, numbers, " + "dashes (-), underscores (_), and dots (.). Bucket names " + "must start and end with a number or letter. "+ "See https://developers.google.com/storage/docs/bucketnaming "+ "for more details. Bucket name: "+ bucket); if (object == null) { object=""; } checkArgument(object.indexOf('\n') < 0 && object.indexOf('\r') < 0,"GCS object names must not contain Carriage Return or " + "Line Feed characters."); this.fs=fs; this.bucket=bucket; this.object=object; }
Constructs a GcsPath.
public void fetch(){ throw new UnsupportedOperationException("Required method instantiateItem was not overridden"); }
for just download image
public void add(RecyclerDivider header){ this.myAppHeader=header; notifyBinderDataSetChanged(); }
Set the header and update the binder dataset
public <R>void visit(String key,Visitor<T,R> visitor){ if (root != null) { visit(key,visitor,null,root); } }
visit the node those key matches the given key
public double angle(){ return rect.angle; }
Get the angle of inclination of the ellipse
private static byte[] unwrapCalculatedValue(byte[] data){ if (data.length < CALC_DATA_OFFSET) { return data; } ByteBuffer buffer=PageChannel.wrap(data); buffer.position(CALC_DATA_LEN_OFFSET); int dataLen=buffer.getInt(); byte[] newData=new byte[Math.min(buffer.remaining(),dataLen)]; buffer.get(newData); return newData; }
Grabs the real data bytes from a calculated value.
void mousePressedInTrack(final MouseEvent e,final Hit part){ fScrollBar.setValueIsAdjusting(true); boolean shouldScrollToHere=(part != ScrollBarHit.THUMB) && JRSUIUtils.ScrollBar.useScrollToClick(); if (e.isAltDown()) shouldScrollToHere=!shouldScrollToHere; if (shouldScrollToHere) { final Point p=getScrollToHereStartPoint(e.getX(),e.getY()); fFirstMouseX=p.x; fFirstMouseY=p.y; fFirstValue=fScrollBar.getValue(); moveToMouse(e); fTrackHighlight=ScrollBarHit.THUMB; fIsDragging=true; return; } fCurrentMouseX=e.getX(); fCurrentMouseY=e.getY(); int direction=0; if (part == ScrollBarHit.TRACK_MIN) { fTrackHighlight=ScrollBarHit.TRACK_MIN; direction=-1; } else if (part == ScrollBarHit.TRACK_MAX) { fTrackHighlight=ScrollBarHit.TRACK_MAX; direction=1; } else { fFirstValue=fScrollBar.getValue(); fFirstMouseX=fCurrentMouseX; fFirstMouseY=fCurrentMouseY; fTrackHighlight=ScrollBarHit.THUMB; fIsDragging=true; return; } fIsDragging=false; fStillInTrack=true; scrollByBlock(direction); final Hit newPart=getPartHit(fCurrentMouseX,fCurrentMouseY); if (newPart == ScrollBarHit.TRACK_MIN || newPart == ScrollBarHit.TRACK_MAX) { fScrollTimer.stop(); fScrollListener.setDirection(((newPart == ScrollBarHit.TRACK_MAX) ? 1 : -1)); fScrollListener.setScrollByBlock(true); startTimer(true); } }
Adjust the fScrollBars value based on the result of hitTestTrack
public static boolean initDebug(){ return StaticHelper.initOpenCV(false); }
Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
public AbstractInternalTransition(State<S,E> source,Collection<Action<S,E>> actions,E event,Guard<S,E> guard,Trigger<S,E> trigger,SecurityRule securityRule){ super(source,source,actions,event,TransitionKind.INTERNAL,guard,trigger,securityRule); }
Instantiates a new abstract internal transition.
public static void jsonPayloadCompare(String expectedJsonPayload,String realPayload,boolean mustMatch){ JsonElement jsonElement=new JsonParser().parse(expectedJsonPayload); JsonObject expectedPayloadObject=jsonElement.getAsJsonObject(); jsonElement=new JsonParser().parse(realPayload); JsonObject realPayloadObject=jsonElement.getAsJsonObject(); if (mustMatch) { Assert.assertTrue(realPayloadObject.equals(expectedPayloadObject)); } else { Assert.assertFalse(realPayloadObject.equals(expectedPayloadObject)); } }
This can be used to compare if to json strings are matched or not.