code
stringlengths
10
174k
nl
stringlengths
3
129k
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:42.914 -0500",hash_original_method="6FDFDCFB7822F2E4E0EEE4A5AC1F1A39",hash_generated_method="B99B627752C96BA487CE34ACFF331411") public static boolean isValid(String address){ return isValidIPv4(address) || isValidIPv6(address); }
Validate the given IPv4 or IPv6 address.
public boolean hasMetadata(){ return fieldSetFlags()[0]; }
Checks whether the 'metadata' field has been set
public static List<Key<DomainBase>> queryDomainsUsingResource(Class<? extends EppResource> clazz,Key<? extends EppResource> key,DateTime now,int limit){ checkArgument(ContactResource.class.equals(clazz) || HostResource.class.equals(clazz)); return ofy().load().type(DomainBase.class).filter(clazz.equals(ContactResou...
Find keys of domains or applications that reference a specified contact or host. <p>This is an eventually consistent query.
public void testSetHostnameVerifier() throws Throwable { setUpStoreProperties(); SSLServerSocket ss=(SSLServerSocket)getContext().getServerSocketFactory().createServerSocket(0); TestHostnameVerifier hnv=new TestHostnameVerifier(); HttpsURLConnection.setDefaultHostnameVerifier(hnv); URL url=new URL("https://lo...
Tests if setHostnameVerifier() method replaces default verifier.
public boolean checkListOptions(){ boolean result; print("ListOptions..."); try { Enumeration<Option> enu=getOptionHandler().listOptions(); if (getDebug() && enu.hasMoreElements()) { println(""); } while (enu.hasMoreElements()) { Option option=enu.nextElement(); if (getDebug()) {...
checks whether the listOptions method works
public Target createTarget(){ TargetImpl target=new TargetImpl(); return target; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public int addStringValue(String value){ if (!isString()) { return -1; } Object store=value; if (value.length() > STRING_COMPRESS_THRESHOLD) { try { store=new SerializedObject(value,true); } catch ( Exception ex) { System.err.println("Couldn't compress string attribute value -" + " s...
Adds a string value to the list of valid strings for attributes of type STRING and returns the index of the string.
public void testBoundedLongs(){ AtomicInteger fails=new AtomicInteger(0); ThreadLocalRandom r=ThreadLocalRandom.current(); long size=123L; for (long least=-86028121; least < MAX_LONG_BOUND; least+=1982451653L) { for (long bound=least + 2; bound > least && bound < MAX_LONG_BOUND; bound+=Math.abs(bound * 7919...
Each of a parallel sized stream of bounded longs is within bounds
public void addConfiguredSysproperty(Environment.Variable property){ addSysproperty(property); }
Called by Ant when the Variable object has been properly initialized.
public static List propertyDescriptors(int apiLevel){ return PROPERTY_DESCRIPTORS; }
Returns a list of structural property descriptors for this node type. Clients must not modify the result.
public void writeRawVarint64(long value) throws IOException { while (true) { if ((value & ~0x7FL) == 0) { writeRawByte((int)value); return; } else { writeRawByte(((int)value & 0x7F) | 0x80); value>>>=7; } } }
Encode and write a varint.
private static OFAction decode_set_dst_port(String actionToDecode,OFVersion version,Logger log){ Matcher n=Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); if (n.matches()) { if (n.group(1) != null) { try { TransportPort portnum=TransportPort.of(get_short(n.group(1))); OFActionSet...
Parse set_tp_dst actions. The key and delimiter for the action should be omitted, and only the data should be presented to this decoder. A leading 0x is permitted.
public ArrayConverter(final Class defaultType,final Converter elementConverter){ super(); if (defaultType == null) { throw new IllegalArgumentException("Default type is missing"); } if (!defaultType.isArray()) { throw new IllegalArgumentException("Default type must be an array."); } if (elementConve...
Construct an <b>array</b> <code>Converter</code> with the specified <b>component</b> <code>Converter</code> that throws a <code>ConversionException</code> if an error occurs.
public ProtocolCodecException(Throwable cause){ super(cause); }
Constructs a new instance with the specified cause.
public boolean isDistinct(){ return distinct; }
This method was generated by MyBatis Generator. This method corresponds to the database table permission
public boolean canSetDouble(){ return canSet(double.class); }
Indicates if convenience set method can be called without an exception being thrown for the double type.
public boolean containsValue(Object value){ return contains(value); }
<p>Returns <code>true</code> if this HashMap maps one or more keys to this value.</p> <p>Feeder that this method is identical in functionality to contains (which predates the Map interface).</p>
@Override public void add(Activity newOne){ super.add(newOne); applyEditsOnActivity(newOne); }
Should be called whenever a new Activity appears in the application.
private void returnData(Object ret){ if (myHost != null) { myHost.returnData(ret); } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
private void executeCommand(HttpServletRequest request,String p_cmd,WebSessionCtx wsc,WWindowStatus ws){ String p_tab=WebUtil.getParameter(request,P_Tab); String p_row=WebUtil.getParameter(request,P_MR_RowNo); log.config(p_cmd + " - Tab=" + p_tab+ " - Row="+ p_row); if (p_row != null && p_row.length() > 0) { ...
Execute Command.
private static boolean unwanted(Symbol s){ return s == null || (s.flags() & SYNTHETIC) != 0; }
Tests whether this is a symbol that should never be seen by clients, such as a synthetic class. Returns true for null.
public void broadcastGroupChatStateChange(String chatId,State state,GroupChat.ReasonCode reasonCode){ mGroupChatEventBroadcaster.broadcastStateChanged(chatId,state,reasonCode); }
Broadcasts Group Chat state change
public static synchronized CourseOffering addNew(Long subjAreaId,String courseNbr) throws Exception { CourseOffering co=null; InstructionalOfferingDAO idao=new InstructionalOfferingDAO(); Session hibSession=idao.getSession(); try { SubjectArea subjArea=new SubjectAreaDAO().get(subjAreaId); org.unitime.t...
Add a new course offering (instructional offering) to the database
public SetOnlineStatusCommand(String playerName,boolean online){ this.playerName=playerName; this.online=online; }
Creates a new SetOnlineStatusCommand
public static Token newToken(int ofKind,String image){ switch (ofKind) { default : return new Token(ofKind,image); } }
Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a subclass of Token called IDToken that you want to create if ofKind is ID, simply add something...
public static byte[] decode(byte[] source) throws Base64DecoderException { return decode(source,0,source.length); }
Decodes Base64 content in byte array format and returns the decoded byte array.
private void updateProgress(String progressLabel,int progress){ if (myHost != null) { myHost.updateProgress(progressLabel,progress); } else { System.out.println(progressLabel + " " + progress+ "%"); } }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public TriggerOption withEarlyFiringsAtEvery(long count){ CountTrigger trigger=new CountTrigger(Type.EARLY,count); triggerList.add(trigger); return this; }
A trigger should be fired before the watermark once for every n tuple(s)
public Simulator(DialogueSystem system,Domain domain){ this.system=system; this.domain=domain; simulatorState=domain.getInitialState().copy(); simulatorState.setParameters(domain.getParameters()); this.system.changeSettings(domain.getSettings()); }
Creates a new user/environment simulator.
public boolean isHRApproved(){ Object oo=get_Value(COLUMNNAME_IsHRApproved); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get HR Approved.
public static void main(final String[] args){ DOMTestCase.doMain(nodedocumentfragmentnodevalue.class,args); }
Runs this test from the command line.
public StatementBuilder resetCount(){ index=0; return this; }
Reset the loop counter.
public Element store(){ Element e=new org.jdom2.Element(Xml.SCHEDULE); e.setAttribute(Xml.ID,getId()); e.setAttribute(Xml.NAME,getName()); if (!getComment().equals(NONE)) { e.setAttribute(Xml.COMMENT,getComment()); } StringBuilder buf=new StringBuilder(); for ( String id : _trainIds) { buf.append...
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-config.xml.
public boolean isNull(int index){ return JSONObject.NULL.equals(opt(index)); }
Determine if the value is null.
public BufferServletOutputStream(int bufferSize){ buffer=ByteBuffer.allocate(bufferSize); }
Create a new instance, with a specific buffersize.
public static boolean canResumeFromSave(){ return GameState.canResumeFromSave(); }
Determines whether our saved game is for a game in progress.
public static OMPoint read(DataInputStream dis) throws IOException { return read(dis,null); }
Read the DataInputStream, and create an OMPoint. Assumes that the LinkPoint header has been read from the link.
@Override public boolean doesMaxRowSizeIncludeBlobs(){ debugCodeCall("doesMaxRowSizeIncludeBlobs"); return false; }
Returns whether the maximum row size includes blobs.
private int rank(ASTNode node){ int relativeRank=node.getStartPosition() + node.getLength() - pos; if (relativeRank < 0) return Integer.MAX_VALUE + relativeRank; else return relativeRank; }
Returns the absolute rank of an <code>ASTNode</code>. Nodes preceding <code>pos</code> are ranked last.
public void stainedStatusChanged(Stainable stainable,boolean stained){ image=stained ? stain : clean; repaint(); }
Changes the icon so it reflects the state of being stained or clean.
@Override public void clear(){ cache.clear(); }
Removes all elements from this Map, leaving it empty.
public void shiftLeftThis(){ int i; if ((len & 0x1f) == 0) { len+=1; blocks+=1; if (blocks > value.length) { int[] bs=new int[blocks]; System.arraycopy(value,0,bs,0,value.length); value=null; value=bs; } for (i=blocks - 1; i >= 1; i--) { value[i]|=value[i - 1] >>> 3...
Shifts-left this by one and enlarges the size of value if necesary.
public AppActivity(){ }
Mandatory for fragment initation
public static CassandraConfig parse(byte[] bytes) throws IOException { return parse(CassandraProtos.CassandraConfig.parseFrom(bytes)); }
Parses a CassandraConfig from a byte array containing a Protocol Buffers serialized representation of the configuration.
public void testBitCountNeg(){ BigInteger aNumber=new BigInteger("-12378634756382937873487638746283767238657872368748726875"); assertEquals(87,aNumber.bitCount()); }
bitCount() of a negative number.
public int next(){ for (++_currentNode; _sp >= 0; ++_currentNode) { if (_currentNode < _stack[_sp]) { if (_type(_currentNode) != ATTRIBUTE_NODE && _type(_currentNode) != NAMESPACE_NODE) return returnNode(makeNodeHandle(_currentNode)); } else --_sp; } return NULL; }
Get the next node in the iteration.
public ImmutableMap<String,String> attributes(){ return this.serviceAttributes; }
Attributes different services in the node can add to be reported as part of the node info (for example).
private void sweep(){ for (Node p=head, s, n; p != null && (s=p.next) != null; ) { if (!s.isMatched()) p=s; else if ((n=s.next) == null) break; else if (s == n) p=head; else p.casNext(s,n); } }
Unlinks matched (typically cancelled) nodes encountered in a traversal from head.
public boolean isOutline(){ return this.showOutline; }
Returns a flag that controls whether or not outlines of the areas are drawn.
public static int copy(InputStream in,OutputStream out) throws IOException { Assert.notNull(in,"No InputStream specified"); Assert.notNull(out,"No OutputStream specified"); int byteCount=0; byte[] buffer=new byte[BUFFER_SIZE]; int bytesRead=-1; while ((bytesRead=in.read(buffer)) != -1) { out.write(buffe...
Copy the contents of the given InputStream to the given OutputStream. Leaves both streams open when done.
@Override protected void modify(float[] data,int frames,int channels,int rate){ data=Dsp.convertSampleRate(data,frames,channels,mSampleRate,rate); super.propagate(data,data.length,channels,rate); }
Modify the PCM audio stream. The audio data is uniform and interleaved.
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode='o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma=false; return this; } throw new JSONException("Misplaced object."); }
Begin appending a new object. All keys and values until the balancing <code>endObject</code> will be appended to this object. The <code>endObject</code> method must be called to mark the object's end.
public ZipShort(byte[] bytes,int offset){ value=getValue(bytes,offset); }
Create instance from the two bytes starting at offset.
public MethodBinding tiebreakMethod(){ return this; }
Returns the method to use during tiebreak (usually the method itself). For generic method invocations, tiebreak needs to use generic method with erasure substitutes.
private boolean shouldFireEvent(Trigger t,double quota,Statistic globalStat){ double threshold=getThesholdByUnit(quota,t.getMetricThreshold(),t.getUnit()); logger.debug("Aggreated [" + t.getMetric() + "-"+ t.getThresholdType()+ "] on all instances in app ["+ this.appId+ "]: "+ globalStat.getValue()+ " with the thre...
Checks if should fire an event
@Override public View generateView(Context ctx){ VH viewHolder=getViewHolder(LayoutInflater.from(ctx).inflate(getLayoutRes(),null,false)); bindView(viewHolder,Collections.EMPTY_LIST); return viewHolder.itemView; }
generates a view by the defined LayoutRes
@Override public void pool(){ }
Reset state when instance is pooled.
protected boolean isRetentionRequired(){ ScheduledEvent event=ExecutionUtils.currentContext().getScheduledEvent(); if (event == null) { return false; } try { OrderCreateParam param=OrderCreateParam.deserialize(org.apache.commons.codec.binary.Base64.decodeBase64(event.getOrderCreationParam().getBytes(UTF...
Check if it is a recurrent order and retention policy is defined
public void applyChainWaveBuffer(ModelRenderer... boxes){ float rotateAmount=0.01745329251F * ClientUtils.interpolate(this.prevPitchVariation,this.pitchVariation,LLibrary.PROXY.getPartialTicks()) / boxes.length; for ( ModelRenderer box : boxes) { box.rotateAngleX+=rotateAmount; } }
Applies this buffer on the X axis to the given array of model boxes.
public CompiledST defineTemplate(String templateName,String template){ if (templateName.charAt(0) != '/') templateName="/" + templateName; try { CompiledST impl=defineTemplate(templateName,new CommonToken(GroupParser.ID,templateName),null,template,null); return impl; } catch ( STException se) { } ...
for testing
public DefaultInputHandler(){ bindings=currentBindings=new Hashtable(); }
Creates a new input handler with no key bindings defined.
public static boolean isSurrogate(char char16){ return LEAD_SURROGATE_MIN_VALUE <= char16 && char16 <= TRAIL_SURROGATE_MAX_VALUE; }
Determines whether the code value is a surrogate.
public void visitEnd(){ if (cv != null) { cv.visitEnd(); } }
Visits the end of the class. This method, which is the last one to be called, is used to inform the visitor that all the fields and methods of the class have been visited.
public InlineQueryResultAudio.InlineQueryResultAudioBuilder audioUrl(URL audioUrl){ this.audio_url=audioUrl; return this; }
*Required Sets the URL of the audio for the result
public GridCacheOperation op(){ return op; }
Gets cache operation.
public PinLaterMySQLBackend(PropertiesConfiguration configuration,String serverHostName,long serverStartTimeMillis) throws Exception { super(configuration,"MySQL",serverHostName,serverStartTimeMillis); this.configuration=Preconditions.checkNotNull(configuration); this.countLimit=configuration.getInt("MYSQL_COUNT_...
Creates an instance of the PinLaterMySQLBackend.
public static void addChemicalDissolutionChamberRecipe(ItemStack input,GasStack output){ addRecipe(Recipe.CHEMICAL_DISSOLUTION_CHAMBER,new DissolutionRecipe(input,output)); }
Add a Chemical Dissolution Chamber recipe.
private void addImportClass(Class<?> cl){ if (cl.isArray()) { cl=cl.getComponentType(); } if (cl.isPrimitive()) return; addImportClass(cl.getCanonicalName()); }
Add class to class import list
public void join(boolean cancel){ if (cancel) U.cancel(workers); boolean interrupted=Thread.interrupted(); try { U.join(workers,log); } finally { if (interrupted) Thread.currentThread().interrupt(); } }
Waits for all workers to finish.
public boolean isAvailable(){ LOG.debug("Testing availability {}",baseUrl); try { return retrieveDescriptor() != null; } catch ( Exception e) { LOG.warn(e.getLocalizedMessage()); return false; } }
Checks service availability.
public void enforceConstraints(){ addConstraintVertices(); int count=0; int splits=0; do { splits=enforceGabriel(segments); count++; Debug.println("Iter: " + count + " Splits: "+ splits+ " Current # segments = "+ segments.size()); } while (splits > 0 && count < MAX_SPLIT_ITER); if (count ==...
Enforces the supplied constraints into the triangulation.
public ImageProperty(String url,ImageType type){ super(url,type); }
Creates an image property.
public final void writeByte(int v){ write(v); }
Writes to the output stream the eight low- order bits of the argument <code>v</code>. The 24 high-order bits of <code>v</code> are ignored. (This means that <code>writeByte</code> does exactly the same thing as <code>write</code> for an integer argument.) The byte written by this method may be read by the <code>readByt...
public synchronized void removeTextListener(TextListener cl){ m_textListeners.remove(cl); }
Remove a text listener
public static boolean isMatched(String topicFilter,String topicName) throws IllegalStateException, IllegalArgumentException { int curn=0, curf=0; int curn_end=topicName.length(); int curf_end=topicFilter.length(); MqttTopic.validate(topicFilter,true); MqttTopic.validate(topicName,false); if (topicFilter.equ...
Check the supplied topic name and filter match
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:35:49.827 -0500",hash_original_method="12CDDF08CF66932EC00C47C0F2860F33",hash_generated_method="11A2E6CBF0E0777D3F44E46ECBDC07EF") public void dump(Printer pw,String prefix){ pw.println(p...
Dump a CrashInfo instance to a Printer.
public UserController(final UserService userService){ Spark.staticFileLocation("/public"); get("/api/users",null,json()); get("/api/users/:id",null,json()); post("/api/users",null,json()); put("/api/users/:id",null,json()); delete("/api/users/:id",null,json()); after(null); exception(IllegalArgumentExce...
Creates a controller that maps requests to gcloud-java functions.
private void fileBrowse(){ Shell shell=new Shell(Display.getDefault()); FilteredResourcesSelectionDialog dialog=new FilteredResourcesSelectionDialog(shell,false,ResourcesPlugin.getWorkspace().getRoot(),IResource.FILE); dialog.setInitialPattern("*.dpans"); if (dialog.open() == ResourceSelectionDialog.OK) { O...
Open a browser to select an existing resource. By default, set a filter to "*.dpans".
public static SourceDSL values(){ return new SourceDSL(){ } ; }
Entry point for DSL from which sources for common Java types can be built
protected final void paintPeer(final Graphics g){ final D delegate=getDelegate(); if (delegate != null) { if (!SwingUtilities.isEventDispatchThread()) { throw new InternalError("Painting must be done on EDT"); } synchronized (getDelegateLock()) { getDelegate().print(g); } } }
Paints the peer. Delegate the actual painting to Swing components.
public static byte[] generateSalt() throws GeneralSecurityException { return randomBytes(PBE_SALT_LENGTH_BITS); }
Generates a random salt.
public void selectAll(boolean notifyDataSetChanged,IFileFilter filter){ for (int i=0; i < getCount(); i++) { IFileDataModel item=getItem(i); item.setSelected(filter == null ? true : filter.accept(item.getFile())); } if (notifyDataSetChanged) notifyDataSetChanged(); }
Selects all items.
protected FunctionTypeExprOrRefImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:35:44.103 -0500",hash_original_method="96127A12D0FD338A76B8651F7EF76641",hash_generated_method="4C6CA4BAB6E956E2812EB9D744773149") public ActivityMonitor(String cls,ActivityResult result,boolean block){ mWhich=null; mClass=cls; m...
Create a new ActivityMonitor that looks for a specific activity class to be started.
public static void main(String[] args) throws FileNotFoundException { driverMsg("Starting DroidSafe Run"); for ( String arg : args) { commandLineArgs+=(arg + " "); } Config.v().init(args); IDroidsafeProgressMonitor monitor=new DroidsafeDefaultProgressMonitor(); common_init(monitor); if (Config.v().ta...
Entry point of DroidSafe Tool.
public boolean redo(){ return table.redo(); }
Tries to redo the last action undone.
public boolean isEmpty(){ return this.fromGroup.isEmpty() || this.toGroup.isEmpty(); }
States whether this group is empty, that is there is no edges in it (Note there may be some partial information though).
Operation findBestArcToDelete(BayesNet bayesNet,Instances instances,Operation oBestOperation){ int nNrOfAtts=instances.numAttributes(); for (int iNode=0; iNode < nNrOfAtts; iNode++) { ParentSet parentSet=bayesNet.getParentSet(iNode); for (int iParent=0; iParent < parentSet.getNrOfParents(); iParent++) { ...
find best (or least bad) arc deletion operation
public static VirtualSubnet convert(VirtualNetworkService.State virtualNetworkState){ VirtualSubnet virtualSubnet=new VirtualSubnet(); virtualSubnet.setId(ServiceUtils.getIDFromDocumentSelfLink(virtualNetworkState.documentSelfLink)); virtualSubnet.setName(virtualNetworkState.name); virtualSubnet.setDescription(...
Converts virtual network from back-end representation to front-end representation.
public ApplicationConfig applicationConfig(){ final Map<String,Object> eventData=data(); if (!eventData.containsKey(CONFIG_KEY)) { return null; } return (ApplicationConfig)eventData.get(CONFIG_KEY); }
Getter for application config, attached to this event. This config was used to perform download/installation work.
DeviceCommsApp(String propsPath) throws Exception { super(propsPath); }
Create an application instance.
public int addValue(CharSequence value){ return add(value,bloom,bloomSeeds,bloomMask); }
Returns 0 if this was a new addition, and 1 if this may have been and old value
private static DatacenterBroker createBroker(){ DatacenterBroker broker=null; try { broker=new DatacenterBroker("Broker"); } catch ( Exception e) { e.printStackTrace(); return null; } return broker; }
Creates the broker.
public void clear(){ mRecycler.setAdapter(null); }
Remove the adapter from the recycler
@Override public void updateNCharacterStream(String columnLabel,Reader x,long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNCharacterStream(" + quote(columnLabel) + ", x, "+ length+ "L);"); } checkClosed(); Value v=conn.createClob(x,length); update(columnLabel...
Updates a column in the current or insert row.
public boolean hasLabel(){ return getLabel() != null; }
Returns whether it has the label.
public void runTest() throws Throwable { Document doc; NodeList testList; Node piNode; String piValue; doc=(Document)load("staff",true); testList=doc.getChildNodes(); piNode=testList.item(0); piNode.setNodeValue("Something different"); piValue=piNode.getNodeValue(); assertEquals("nodeValue","Somethi...
Runs the test case.
public boolean contains(float val){ return index(val) >= 0; }
Searches the set for <tt>val</tt>
@DSModeled public Intent cloneFilter(){ return new Intent(this,false); }
Make a clone of only the parts of the Intent that are relevant for filter matching: the action, data, type, component, and categories.
protected boolean canDrawInBounds(){ int arrowSize=this.getScrollArrowSize(); String orientation=this.getOrientation(); if (AVKey.VERTICAL.equals(orientation)) return this.bounds.height >= (arrowSize * 2 + this.getMinScrollKnobSize()) && this.bounds.width >= arrowSize; else return this.bounds.width >= (arrow...
Determines if the scrollbar is able to draw within its bounds.