code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public String requestWikidata(String message,String botid,String server,String apikey,int limit,String hint,Network network) throws Exception {
try {
log("WIKIDATA",Level.INFO,message);
Vertex result=getBot().awareness().getSense(Wikidata.class).processSearch(message,-1,false,hint,network,new HashMap<String,V... | Invoke the Wikidata sense. |
public Vector2 solve(Vector2 b){
double det=this.determinant();
if (Math.abs(det) > Epsilon.E) {
det=1.0 / det;
}
Vector2 r=new Vector2();
r.x=det * (this.m11 * b.x - this.m01 * b.y);
r.y=det * (this.m00 * b.y - this.m10 * b.x);
return r;
}
| Solves the system of linear equations: <p style="white-space: pre;"> Ax = b Multiply by A<sup>-1</sup> on both sides x = A<sup>-1</sup>b</p> |
public boolean hasWildcard(){
for ( Type type : list) {
if (type.isParameterized() && ((ParameterizedType)type).hasWildcard()) {
return true;
}
}
return false;
}
| Indicates whether any of the types in this type tuple contains a wildcard. |
public boolean validate(InputNode node) throws Exception {
InputNode from=node.getParent();
String name=node.getName();
while (node != null) {
if (!key.validate(node)) {
return false;
}
if (!value.validate(node)) {
return false;
}
node=from.getNext(name);
}
return true;
}
| This <code>read</code> method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its <... |
protected void updateNotificationSummary(){
final StatusBarNotification[] activeNotifications=mNotificationManager.getActiveNotifications();
int numberOfNotifications=activeNotifications.length;
for ( StatusBarNotification notification : activeNotifications) {
if (notification.getId() == NOTIFICATION_GROUP_S... | Adds/updates/removes the notification summary as necessary. |
public static String formatPath(List<ChildNumber> path){
return PATH_JOINER.join(Iterables.concat(Collections.singleton("M"),path));
}
| Convert to a string path, starting with "M/" |
public void moveViewBox(double dx,double dy){
if (Math.abs(dx) > getWidth() || Math.abs(dy) > getHeight()) return;
MutableCoord origin=inverseTransform(new MutableCoord((double)0,(double)0));
MutableCoord moves=inverseTransform(new MutableCoord(dx,dy));
curX+=(moves.getX() - origin.getX());
curY+=(moves.get... | Moves the view box by some difference over x and y. |
public static void encodeFileToFile(String infile,String outfile) throws java.io.IOException {
String encoded=Base64.encodeFromFile(infile);
java.io.OutputStream out=null;
try {
out=new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile));
out.write(encoded.getBytes("US-ASCII"));
}
catch... | Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>. |
protected static String xsdQuote(final String value,final String type){
return quote(value,"\"","\"^^xsd:" + type);
}
| Place double quotes around the given string and append an XSD data type. |
public ArrowTip(double angle,double outerRadius,double innerRadius){
this(angle,outerRadius,innerRadius,true,false,true);
}
| Constructs an arrow tip with the specified angle and outer and inner radius. |
public MicroHessianInput(InputStream is){
init(is);
}
| Creates a new Hessian input stream, initialized with an underlying input stream. |
public ExtentTest fatal(Throwable t){
log(Status.FATAL,t);
return this;
}
| Logs an event with <code>Status.FATAL</code> and exception |
String renameType(Type type){
if (type == null) {
return null;
}
if (type.getSort() == Type.OBJECT) {
String in=type.getInternalName();
return "L" + renameInternalType(in) + ";";
}
else if (type.getSort() == Type.ARRAY) {
StringBuilder sb=new StringBuilder();
for (int n=type.getDimensions... | Renames an object type, e.g. "Lcom.package.MyClass;" or an array type that has an object element, e.g. "[Lcom.package.MyClass;" If the type doesn't need to be renamed, returns the internal name of the input type. |
public Result send(Message message,String to,int retries) throws IOException {
int attempt=0;
Result result;
int backoff=BACKOFF_INITIAL_DELAY;
boolean tryAgain;
do {
attempt++;
if (logger.isLoggable(Level.FINE)) {
logger.fine("Attempt #" + attempt + " to send message "+ message+ " to regIds "+ ... | Sends a message to one device, retrying in case of unavailability. <p> <strong>Note: </strong> this method uses exponential back-off to retry in case of service unavailability and hence could block the calling thread for many seconds. |
public OperandTree(final int operandId){
m_id=operandId;
}
| Creates a new operand tree. |
public static ByteBuffer convertToSigned16BitSamples(RealBuffer buffer){
return convertToSigned16BitSamples(buffer.getSamples());
}
| Converts the float samples in a complex buffer to a little endian 16-bit buffer |
private void doPermissionWorkBeforeAndroidM(@NonNull Activity activity,@NonNull String[] permissions,@Nullable PermissionsResultAction action){
for ( String perm : permissions) {
if (action != null) {
if (!mPermissions.contains(perm)) {
action.onResult(perm,Permissions.NOT_FOUND);
}
else ... | When request permissions on devices before Android M (Android 6.0, API Level 23) Do the granted or denied work directly according to the permission status |
public int size(){
return info[0] & 0xff;
}
| Returns <code>parameters_count</code>, which is the number of parameters. |
static public String removeAndHump(String data,String replaceThis){
String temp=null;
StringBuffer out=new StringBuffer();
temp=data;
StringTokenizer st=new StringTokenizer(temp,replaceThis);
while (st.hasMoreTokens()) {
String element=(String)st.nextElement();
out.append(capitalizeFirstLetter(element... | <p> 'Camels Hump' replacement. </p> <p> Remove one string from another string but leave the capitalization of the other letters unchanged. </p> <p> For example, removing "_" from <code>foo_barBar</code> becomes <code>FooBarBar</code>. </p> |
public Object remove(Object key){
processQueue();
return hash.remove(key);
}
| Removes the mapping for the given <code>key</code> from this map, if present. |
public boolean isCritical(){
return critical;
}
| Returns true if shard is critical. |
protected void updateView(){
}
| This method is invoked, when the property changed and when the view changed. |
@Override public void requestLocationSuccess(String locationName){
weatherUtils.requestWeather(locationName,this);
getLocation().realLocation=locationName;
DatabaseHelper.getInstance(this).insertLocation(getLocation());
}
| <br> interface. |
public boolean isSuccess(){
return success;
}
| success getter |
@Override public void SyncComplete(String result){
Log.i(t,"disk sync task complete");
TextView tv=(TextView)findViewById(R.id.status_text);
tv.setText(result);
}
| Called by DiskSyncTask when the task is finished |
public static _Fields findByName(String name){
return byName.get(name);
}
| Find the _Fields constant that matches name, or null if its not found. |
public HttpException(int status_code){
this(status_code,null);
}
| Constructs an ODataHttpException with the specified HTTP status code. |
private long computeInterfaceHash(){
long hash=0;
ByteArrayOutputStream sink=new ByteArrayOutputStream(512);
try {
MessageDigest md=MessageDigest.getInstance("SHA");
DataOutputStream out=new DataOutputStream(new DigestOutputStream(sink,md));
out.writeInt(INTERFACE_HASH_STUB_VERSION);
for ( Meth... | Computes the "interface hash" of the stub/skeleton pair for this remote implementation class. This is the 64-bit value used to enforce compatibility between a stub class and a skeleton class in the JDK 1.1 version of the JRMP stub/skeleton protocol. It is calculated using the first 64 bits of an SHA digest. The diges... |
private void writeQNameAttribute(java.lang.String namespace,java.lang.String attName,javax.xml.namespace.QName qname,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace=qname.getNamespaceURI();
java.lang.String attributePrefix=xmlWriter.getPre... | Util method to write an attribute without the ns prefix |
void appendEndDocument(){
done=true;
}
| All appends to this document have finished; do whatever final cleanup is needed. |
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namesp... | Util method to write an attribute without the ns prefix |
public synchronized void empty(){
while (size > 0) pop();
}
| Removes all elements from the list. |
protected void processKeyEvent(KeyEvent e){
char keyChar=e.getKeyChar();
int keyCode=e.getKeyCode();
if (keyCode == KeyEvent.VK_ENTER) {
finished=true;
}
boolean needProcess=false;
for (int i=0; i < processable.length; i++) {
if (processable[i] == keyCode) {
needProcess=true;
}
}
if (!... | Key processing function. Certain key events are delegated to the superclass. Others submit the user input to the calling object or react to the input internally. |
public void testMergeFromDynamic() throws Exception {
TestAllTypes result=TestAllTypes.newBuilder(MERGE_DEST).mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build()).build();
assertEquals(MERGE_RESULT_TEXT,result.toString());
}
| Test merging a DynamicMessage into a GeneratedMessage. As long as they have the same descriptor, this should work, but it is an entirely different code path. |
final boolean acquireQueued(final Node node,long arg){
boolean failed=true;
try {
boolean interrupted=false;
for (; ; ) {
final Node p=node.predecessor();
if (p == head && tryAcquire(arg)) {
setHead(node);
p.next=null;
failed=false;
return interrupted;
}
... | Acquires in exclusive uninterruptible mode for thread already in queue. Used by condition wait methods as well as acquire. |
public void testEquals(){
ChangeRequestAttribute target=null;
boolean expectedReturn=false;
boolean actualReturn=changeRequestAttribute.equals(target);
assertEquals("Null value test failed",expectedReturn,actualReturn);
target=new ChangeRequestAttribute();
changeRequestAttribute.setChangeIpFlag(true);
cha... | Tests the equals method against a null, a different and an identical object. |
private void testRangeOfValues(){
logger.info("Test range of values...");
boolean rangeOfInterpValuesUseful=true;
double min=Double.MAX_VALUE;
double max=Double.MIN_VALUE;
for (double x=this.sg.getXmin(); x <= this.sg.getXmax(); x+=this.sg.getResolution() / 2) {
for (double y=this.sg.getYmin(); y <= this.... | This method checks the range of all interpolated values of the interpolated SpatialGrid at one resolution higher. |
@PUT @Path("/wardensuspensionlevelsanddurations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Description("Updates warden infraction level counts and suspension durations.") public Response updateWardenSuspensionLevelsAndDurations(@Context HttpServletRequest req,Map<Integer,Long> infrac... | Updates warden suspension levels. |
public void resetTagDefinitions(){
mTagInfo=null;
}
| Resets tag definitions to the default ones. |
public static StoragePort assignPortToInitiator(StoragePortsAssigner assigner,List<StoragePort> ports,NetworkLite net,Initiator initiator,Map<StoragePort,Integer> portUsage,String groupId){
StoragePort foundPort=null;
for ( StoragePort port : ports) {
if (groupId == null || port.getPortGroup().equals(groupId))... | This function tries to select a port for a given initiator and tries to minimize the number of initiators using the same port. When the ports being assigned are pre-zoned, this function also ensures that the port assigned to an initiator is pre-zoned to the initiator. |
public void endVisit(SingleVariableDeclaration node){
}
| End of visit the given type-specific AST node. <p> The default implementation does nothing. Subclasses may reimplement. </p> |
public CellTableProbs(DataSet dataSet){
if (dataSet == null) {
throw new NullPointerException("Data set not provided.");
}
this.dataSet=dataSet;
dims=new int[dataSet.getNumColumns()];
for (int i=0; i < dims.length; i++) {
DiscreteVariable variable=(DiscreteVariable)dataSet.getVariable(i);
dims[i]=... | Creates a cell count table for the given data set. |
private void writeEscUTF16(String s,int start,int length,boolean isAttVal) throws SAXException {
String subString=s.substring(start,start + length);
write(StringEscapeUtils.escapeHtml4(subString));
}
| Write an array of data characters with escaping. |
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. |
public int step(){
return step;
}
| Returns the step value |
public void updateQuantityCount(ItemBean original,ItemBean itemToAdd,boolean add){
BigDecimal originalQuantity=original.getQtyCount();
BigDecimal quantityToAdd=itemToAdd.getQtyCount();
BigDecimal finalQuantity=null;
if (!add) finalQuantity=originalQuantity.subtract(quantityToAdd);
else finalQuantity=origin... | Update Quantity count in inventory |
public final boolean unify(final JIPTerm term,final Hashtable varsTbl){
Hashtable varTable1=new Hashtable(10);
if (m_obj.unify(term.m_obj,varTable1)) {
Variable var;
Enumeration en=varTable1.elements();
while (en.hasMoreElements()) {
var=((Variable)en.nextElement());
varsTbl.put(var,new JIPV... | Unifies this JIPTerm object with the specified term. If this JIPTerm object unifies with the specified term this method unifies the terms and varTable will contains the variables that has been bound. |
public Builder withLeader(Address leader){
response.leader=leader;
return this;
}
| Sets the response leader. |
public CustomElement(String value){
this.value=value;
}
| Creates a custom element with only the value set. |
public MCashLine createReversal(){
MCash parent=getParent();
if (parent.isProcessed()) {
parent=MCash.get(getCtx(),parent.getAD_Org_ID(),parent.getStatementDate(),parent.getC_Currency_ID(),get_TrxName());
}
else {
this.setIsActive(false);
return this;
}
MCashLine reversal=new MCashLine(parent);
... | Create Line Reversal or inactivate this line if is not processed |
public final void parseNw(final String nwShpFileName) throws IOException, RuntimeException {
log.info("creating data structure from Tele Atlas MultiNet network shape file '" + nwShpFileName + "'...");
if (this.data.junctionElements == null) {
throw new IllegalArgumentException("No junction map given.");
}
M... | parsing and extracting network features, requires junctions to be loaded already |
@Override public net.floodlightcontroller.core.IListener.Command reconcileFlows(ArrayList<OFMatchReconcile> ofmRcList){
if (lds != null) {
links=new HashMap<Link,LinkInfo>();
if (lds.getLinks() != null) links.putAll(lds.getLinks());
for ( OFMatchReconcile ofmr : ofmRcList) {
if (ofmr.rcAction... | Base case for the reconciliation of flows. This is triggered at the switch which is immediately affected by the PORT_DOWN event |
public static Writable writeRead(Writable before,Configuration conf) throws Exception {
DataOutputBuffer dob=new DataOutputBuffer();
before.write(dob);
DataInputBuffer dib=new DataInputBuffer();
dib.reset(dob.getData(),dob.getLength());
Writable after=(Writable)before.getClass().newInstance();
if (conf != n... | Utility method for testing writables. |
public Info(String tabKey,String userAgentTag,String url,String remoteHost,String initialSessionKey,byte[] browserIconBytes){
this.tabKey=returnEmptyStrIfNull(tabKey);
this.userAgentTag=generateUniqueNameIfNullOrEmpty(userAgentTag,"Browser");
this.remoteHost=returnEmptyStrIfNull(remoteHost);
this.url=generateUn... | Construct a new instance. |
protected static boolean isHostReachable(String hostName){
try {
InetAddress.getByName(hostName);
}
catch ( UnknownHostException e) {
String message=Logging.getMessage("NetworkStatus.UnreachableTestHost",hostName);
Logging.logger().fine(message);
return false;
}
catch ( Exception e) {
Strin... | Determine if a host is reachable by attempting to resolve the host name, and then attempting to open a connection. |
private static Map<Integer,List<DimensionAggregatorInfo>> arrangeDimensionAggregationInfo(List<DimensionAggregatorInfo> queryDimensionAggregationInfos,Map<Integer,Integer> dimensionOrdinaltoBlockIndexMapping){
Map<Integer,List<DimensionAggregatorInfo>> groupedDimensionAggregationInfo=new LinkedHashMap<Integer,List<Di... | Below method will be used to group the dimension aggregation infos This grouping will be based on block index of the file to dimension mapping Basically it will group all the dimension aggregation of same column group dimension This is done to avoid the column group dimension mdkey unpacking multiple times. If all the ... |
public static <T>boolean containsEquivalent(Collection<T> c,Object o,Hasher h){
for ( T t : c) {
if (h.equals(t,o)) return true;
}
return false;
}
| Returns true iff the collection contains an element equivalent to the given one, as decided by the hasher. |
public void receivePulse(GlowBlock block){
block.getWorld().cancelPulse(block);
}
| Called when the BlockType gets pulsed as requested. |
public static void updateIcon(){
Main.triggerMenuInvalidationStatic();
}
| Updates the "undo" icon visibility by invalidating the menu. Avoid calling this off the main thread, or bad things may happen to your menu. |
protected void validateSystemMonitorResponse(String systemMonitorResponseMessage){
assertTrue("Correlation Id \"" + TEST_SQS_MESSAGE_CORRELATION_ID + "\" expected, but not found.",systemMonitorResponseMessage.contains("<correlation-id>" + TEST_SQS_MESSAGE_CORRELATION_ID + "</correlation-id>"));
assertTrue("Context ... | Validates that the specified system monitor response message is valid. If not, an exception will be thrown. |
public VOOrganization updateCustomerDiscount(VOOrganization organization,BigDecimal value,long startTime,long endTime) throws Exception {
VODiscount discount=organization.getDiscount();
if (discount == null) {
discount=new VODiscount();
organization.setDiscount(discount);
}
discount.setValue(value);
d... | Update the customer discount for the given customer organization. Don't update the discount for a customer that is used by other testcases! |
public static void rotateM(float[] rm,int rmOffset,float[] m,int mOffset,float a,float x,float y,float z){
synchronized (TEMP_MATRIX_ARRAY) {
setRotateM(TEMP_MATRIX_ARRAY,0,a,x,y,z);
multiplyMM(rm,rmOffset,m,mOffset,TEMP_MATRIX_ARRAY,0);
}
}
| Rotates matrix m by angle a (in degrees) around the axis (x, y, z) |
public EllipticalOrbitAnimation3D(Vector3 focalPoint,Vector3 periapsis,Vector3 normal,double eccentricity,double angle,OrbitDirection direction){
super();
mFocalPoint=focalPoint;
mPeriapsis=periapsis;
mNormal=normal.clone();
mEccentricity=eccentricity;
mDirection=direction;
mAngle=angle;
}
| Defines an elliptical orbit around a point. |
public int toInt(Element el,String attributeName){
return Caster.toIntValue(el.getAttribute(attributeName),Integer.MIN_VALUE);
}
| reads a XML Element Attribute ans cast it to a int value |
private boolean trackMatchesString(Track track,String string){
boolean matchesName=track.getName().toLowerCase().contains(string.toLowerCase());
boolean matchesArtist=track.getArtist().toLowerCase().contains(string.toLowerCase());
boolean matchesLabel=track.getLabel().toLowerCase().contains(string.toLowerCase());... | Determines if a track matches a given string by its name, artist, label, genre or album. |
public void copyTo(PositionTextureVertex[] verts,TexturedQuad[] quad){
TexturedPolygon[] poly=new TexturedPolygon[quad.length];
for (int idx=0; idx < quad.length; idx++) {
poly[idx]=new TexturedPolygon((PositionTextureVertex[])quad[idx].vertexPositions);
}
copyTo(verts,poly);
}
| Copies an array of vertices and quads to the current shape. This method converts quads to polygons and then calls the main copyTo method. |
public boolean hasColumns(){
return this.columns != null;
}
| Query to determine if we have column definitions. |
public FloatMatrix put(int[] indices,int c,FloatMatrix x){
if (x.isScalar()) {
return put(indices,c,x.scalar());
}
for (int i=0; i < indices.length; i++) {
put(indices[i],c,x.get(i));
}
return this;
}
| Set multiple elements in a row. |
@Override protected EClass eStaticClass(){
return UmplePackage.eINSTANCE.getAnonymous_multipleIsA_1_();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static <T>T orderWrites(T ref){
theVolatile=0;
return ref;
}
| Informally: Ensures that a use of the given reference with the effect of reading or writing a field (or if an array, element) of the referenced object, prior to the invocation of this method occur before a subsequent write of the reference. For details, see the class documentation for this class. |
public static Object invokeCompiledCommand(Class commandClass,Object[] args,Interpreter interpreter,CallStack callstack) throws UtilEvalError {
Object[] invokeArgs=new Object[args.length + 2];
invokeArgs[0]=interpreter;
invokeArgs[1]=callstack;
System.arraycopy(args,0,invokeArgs,2,args.length);
BshClassManage... | A command may be implemented as a compiled Java class containing one or more static invoke() methods of the correct signature. The invoke() methods must accept two additional leading arguments of the interpreter and callstack, respectively. e.g. invoke(interpreter, callstack, ... ) This method adds the arguments and i... |
public PCALCodeScanner(){
TLAColorProvider provider=TLAEditorActivator.getDefault().getTLAColorProvider();
IToken keyword=new Token(new TextAttribute(provider.getColor(TLAColorProvider.TLA_KEYWORD),null,SWT.BOLD));
IToken value=new Token(new TextAttribute(provider.getColor(TLAColorProvider.TLA_VALUE)));
IToken ... | Construct the rules |
protected Criteria createCriteriaInternal(){
Criteria criteria=new Criteria();
return criteria;
}
| This method was generated by MyBatis Generator. This method corresponds to the database table company_privilege |
@Override public Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder){
SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
qb.setTables(MainTable.TABLE_NAME);
switch (mUriMatcher.match(uri)) {
case MAIN:
qb.setProjectionMap(mNotesProjectionMap);
break;
case MAIN_ID:
q... | Handle incoming queries. |
public void loadIPsAndNames(){
PropertyInfo props=coordinator.getPropertyInfo();
if (props == null) {
throw SecurityException.retryables.keystoreUnavailable();
}
addresses=new HashSet<InetAddress>();
String ipAddress=props.getProperty(NETWORK_STANDALONE_IP_ADDRESS_PROPERTY_NAME);
InetAddress inet;
if ... | loads all the cluster's IPs and the DNS names |
public void configure(){
SerialTrafficController tc=null;
String opt1=getOptionState(option1Name);
if (opt1.equals("CM11")) {
this.setSystemConnectionMemo(new jmri.jmrix.powerline.cm11.SpecificSystemConnectionMemo());
tc=new jmri.jmrix.powerline.cm11.SpecificTrafficController(this.getSystemConnectionMemo(... | set up all of the other objects to operate connected to this port |
public EaseOutIn(){
}
| Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration. |
public XPathAPI newXPathAPI(){
return new XalanXPathAPI();
}
| Get a new XPathAPI instance |
public boolean isSetTriggerType(){
return this.triggerType != null;
}
| Returns true if field triggerType is set (has been assigned a value) and false otherwise |
public final synchronized void stop(){
boolean joined=false;
if (!running) return;
halt(false);
while (!joined) {
try {
thread.join();
joined=true;
}
catch ( InterruptedException e) {
}
}
state.removeFromAsynchronousRegistry(this);
running=false;
}
| Requests that the AsynchronousSteppable shut down its thread, and blocks until this occurs. If it's already stopped, nothing happens. |
public boolean canUndo(){
return undoManager.canUndo();
}
| Tells whether an undo is possible |
public static boolean isLocalURL(URL url){
return "file".equalsIgnoreCase(url.getProtocol()) || "jar".equalsIgnoreCase(url.getProtocol());
}
| URL is currently assumed local if the protocol is either "file" or "jar". |
private void processTest(DeploymentMode depMode) throws Exception {
this.depMode=depMode;
try {
Ignite ignite=startGrid(1);
ignite.compute().execute(Task.class,null);
}
finally {
stopGrid(1);
}
}
| Process one test. |
public PipelineCpeBuilder(String pipelineName,File yamlFile) throws BaleenException {
super(pipelineName,yamlFile);
}
| Initiate a CpeBuilder with a YAML configuration file |
@Override public Object writeReplace(Object obj){
Calendar cal=(Calendar)obj;
return new CalendarHandle(cal.getClass(),cal.getTimeInMillis());
}
| java.util.Calendar serializes to com.caucho.hessian.io.CalendarHandle |
public void testEmptyOffer(){
SubmissionPublisher<Integer> p=basicPublisher();
assertEquals(0,p.offer(1,null));
}
| offer to a publisher with no subscribers returns lag 0 |
public CategoryInfo browse(){
return client.getURI(CategoryInfo.class,catalogPath(null));
}
| Browse the root of the service catalog. <p> API Call: GET /api/catalog |
protected void addInstance(Instance newInstance) throws Exception {
if (m_clusterInstances == null) {
m_clusterInstances=new Instances(newInstance.dataset(),1);
m_clusterInstances.add(newInstance);
updateStats(newInstance,false);
return;
}
else if (m_children == null) {
m_children=new ArrayLi... | Adds an instance to this cluster. |
private boolean isStartingNewContextualSearch(PanelState toState,StateChangeReason reason){
return toState == PanelState.PEEKED && (reason == StateChangeReason.TEXT_SELECT_TAP || reason == StateChangeReason.TEXT_SELECT_LONG_PRESS);
}
| Determine whether a new contextual search is starting. |
public PilotingRollData checkGetUp(MoveStep step,EntityMovementType moveType){
PilotingRollData roll=super.checkGetUp(step,moveType);
roll.addModifier(4,"armless Mech");
return roll;
}
| Checks if the entity is getting up. If so, returns the target roll for the piloting skill check. |
GridUriDeploymentUnitDescriptor(String uri,File file,long tstamp,ClassLoader clsLdr,String md5){
assert uri != null;
assert file != null;
assert tstamp > 0;
this.uri=uri;
this.file=file;
this.tstamp=tstamp;
this.clsLdr=clsLdr;
this.md5=md5;
type=FILE;
}
| Constructs descriptor for GAR file. |
public static Decoder createDecoder(String configFile){
JoshuaConfiguration joshuaConfiguration=new JoshuaConfiguration();
return new Decoder(joshuaConfiguration,configFile);
}
| Factory method that creates a new decoder using the specified configuration file. |
public static void logError(String message,Exception e){
System.out.println(message);
e.printStackTrace();
}
| Make an error log, log what ever happens |
protected Expression minus(int opPos) throws TransformerException {
return compileOperation(new Minus(),opPos);
}
| Compile a '-' operation. |
public void process(HttpServletResponse response) throws IOException {
if (proxyTargeted) {
response.setStatus(HttpServletResponse.SC_OK);
response.setHeader("content-type","message/http");
response.setHeader("Connection","close");
String path=method.getPath();
String protocol=method.getParams().g... | Will either respond with data from the underlying server or the proxy's own data. |
public Configurator recordNoData(){
dataWriterFactory=null;
return this;
}
| Turn off the data recorder so that it does not record anything. |
public HopfieldNode(NetworkPanel networkPanel,Hopfield group){
super(networkPanel,group);
setContextMenu();
}
| Create a Hopfield Network PNode. |
private static byte[] encode3to4(byte[] source,int srcOffset,int numSigBytes,byte[] destination,int destOffset,int options){
byte[] ALPHABET=getAlphabet(options);
int inBuff=(numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) | (numSigBytes > 2 ... | <p>Encodes up to three bytes of the array <var>source</var> and writes the resulting four Base64 bytes to <var>destination</var>. The source and destination arrays can be manipulated anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>. This method does not check to make sure your ar... |
public static ModuleVersion parseVersion(String version){
if (version == null) return DEFAULT_VERSION;
version=version.trim();
if (version.length() == 0) return DEFAULT_VERSION;
return new ModuleVersion(version);
}
| Parses a version identifier from the specified string. See <code>Version(String)</code> for the format of the version string. |
@Override @SideEffectFree public String formatAnnotationString(Collection<? extends AnnotationMirror> annos,boolean printInvisible){
StringBuilder sb=new StringBuilder();
for ( AnnotationMirror obj : annos) {
if (obj == null) {
ErrorReporter.errorAbort("AnnotatedTypeMirror.formatAnnotationString: found n... | Creates a space String of each annotation in annos separated by a single space character, obeying the printInvisible parameter. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.