method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public JMeterGUIComponent getCurrentGui() { try { updateCurrentNode(); TestElement curNode = treeListener.getCurrentNode().getTestElement(); JMeterGUIComponent comp = getGui(curNode); comp.clearGui(); log.debug("Updating gui to new node"); comp.configure(curNode); currentNodeUpdated = false; return comp; } catch (Exception e) { log.error("Problem retrieving gui", e); return null; } }
JMeterGUIComponent function() { try { updateCurrentNode(); TestElement curNode = treeListener.getCurrentNode().getTestElement(); JMeterGUIComponent comp = getGui(curNode); comp.clearGui(); log.debug(STR); comp.configure(curNode); currentNodeUpdated = false; return comp; } catch (Exception e) { log.error(STR, e); return null; } }
/** * Convenience method for grabbing the gui for the current node. * * @return the GUI component associated with the currently selected node */
Convenience method for grabbing the gui for the current node
getCurrentGui
{ "repo_name": "yuyupapa/OpenSource", "path": "apache-jmeter-3.0/src/core/org/apache/jmeter/gui/GuiPackage.java", "license": "apache-2.0", "size": 29555 }
[ "org.apache.jmeter.testelement.TestElement" ]
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.*;
[ "org.apache.jmeter" ]
org.apache.jmeter;
1,583,327
protected static void getExplicitProperties(List<InternalEventPropDescriptor> result, Class clazz, ConfigurationEventTypeLegacy legacyConfig) { for (ConfigurationEventTypeLegacy.LegacyFieldPropDesc desc : legacyConfig.getFieldProperties()) { result.add(makeDesc(clazz, desc)); } for (ConfigurationEventTypeLegacy.LegacyMethodPropDesc desc : legacyConfig.getMethodProperties()) { result.add(makeDesc(clazz, desc)); } }
static void function(List<InternalEventPropDescriptor> result, Class clazz, ConfigurationEventTypeLegacy legacyConfig) { for (ConfigurationEventTypeLegacy.LegacyFieldPropDesc desc : legacyConfig.getFieldProperties()) { result.add(makeDesc(clazz, desc)); } for (ConfigurationEventTypeLegacy.LegacyMethodPropDesc desc : legacyConfig.getMethodProperties()) { result.add(makeDesc(clazz, desc)); } }
/** * Populates explicitly-defined properties into the result list. * @param result is the resulting list of event property descriptors * @param clazz is the class to introspect * @param legacyConfig supplies specification of explicit methods and fields to expose */
Populates explicitly-defined properties into the result list
getExplicitProperties
{ "repo_name": "b-cuts/esper", "path": "esper/src/main/java/com/espertech/esper/event/bean/PropertyListBuilderExplicit.java", "license": "gpl-2.0", "size": 6352 }
[ "com.espertech.esper.client.ConfigurationEventTypeLegacy", "com.espertech.esper.event.bean.InternalEventPropDescriptor", "java.util.List" ]
import com.espertech.esper.client.ConfigurationEventTypeLegacy; import com.espertech.esper.event.bean.InternalEventPropDescriptor; import java.util.List;
import com.espertech.esper.client.*; import com.espertech.esper.event.bean.*; import java.util.*;
[ "com.espertech.esper", "java.util" ]
com.espertech.esper; java.util;
2,150,951
private void initComponents() throws CryptoException { // Are there any certificates to view? if (m_certs.length == 0) { m_iSelCert = -1; } else { m_iSelCert = 0; }
void function() throws CryptoException { if (m_certs.length == 0) { m_iSelCert = -1; } else { m_iSelCert = 0; }
/** * Initialize the dialog's GUI components. * * @throws CryptoException A problem was encountered getting the certificates' details */
Initialize the dialog's GUI components
initComponents
{ "repo_name": "venator85/portecle", "path": "src/main/net/sf/portecle/DViewCertificate.java", "license": "gpl-2.0", "size": 25622 }
[ "net.sf.portecle.crypto.CryptoException" ]
import net.sf.portecle.crypto.CryptoException;
import net.sf.portecle.crypto.*;
[ "net.sf.portecle" ]
net.sf.portecle;
159,343
static Table addTableConstraintDefinitions(Session session, Table table, HsqlArrayList tempConstraints, HsqlArrayList constraintList) { Constraint c = (Constraint) tempConstraints.get(0); String namePart = c.getName() == null ? null : c.getName().name; HsqlName indexName = session.database.nameManager.newAutoName("IDX", namePart, table.getSchemaName(), table.getName(), SchemaObject.INDEX); if (c.mainColSet != null) { c.core.mainCols = table.getColumnIndexes(c.mainColSet); } table.createPrimaryKey(indexName, c.core.mainCols, true); if (c.core.mainCols != null) { Constraint newconstraint = new Constraint(c.getName(), table, table.getPrimaryIndex(), Constraint.PRIMARY_KEY); table.addConstraint(newconstraint); session.database.schemaManager.addSchemaObject(newconstraint); } for (int i = 1; i < tempConstraints.size(); i++) { c = (Constraint) tempConstraints.get(i); switch (c.constType) { case Constraint.UNIQUE : { c.setColumnsIndexes(table); if (table.getUniqueConstraintForColumns(c.core.mainCols) != null) { throw Error.error(ErrorCode.X_42522); } // create an autonamed index indexName = session.database.nameManager.newAutoName("IDX", c.getName().name, table.getSchemaName(), table.getName(), SchemaObject.INDEX); Index index = table.createAndAddIndexStructure(indexName, c.core.mainCols, null, null, true, true, false); Constraint newconstraint = new Constraint(c.getName(), table, index, Constraint.UNIQUE); table.addConstraint(newconstraint); session.database.schemaManager.addSchemaObject( newconstraint); break; } case Constraint.FOREIGN_KEY : { addForeignKey(session, table, c, constraintList); break; } case Constraint.CHECK : { c.prepareCheckConstraint(session, table, false); table.addConstraint(c); if (c.isNotNull()) { ColumnSchema column = table.getColumn(c.notNullColumnIndex); column.setNullable(false); table.setColumnTypeVars(c.notNullColumnIndex); } session.database.schemaManager.addSchemaObject(c); break; } } } return table; }
static Table addTableConstraintDefinitions(Session session, Table table, HsqlArrayList tempConstraints, HsqlArrayList constraintList) { Constraint c = (Constraint) tempConstraints.get(0); String namePart = c.getName() == null ? null : c.getName().name; HsqlName indexName = session.database.nameManager.newAutoName("IDX", namePart, table.getSchemaName(), table.getName(), SchemaObject.INDEX); if (c.mainColSet != null) { c.core.mainCols = table.getColumnIndexes(c.mainColSet); } table.createPrimaryKey(indexName, c.core.mainCols, true); if (c.core.mainCols != null) { Constraint newconstraint = new Constraint(c.getName(), table, table.getPrimaryIndex(), Constraint.PRIMARY_KEY); table.addConstraint(newconstraint); session.database.schemaManager.addSchemaObject(newconstraint); } for (int i = 1; i < tempConstraints.size(); i++) { c = (Constraint) tempConstraints.get(i); switch (c.constType) { case Constraint.UNIQUE : { c.setColumnsIndexes(table); if (table.getUniqueConstraintForColumns(c.core.mainCols) != null) { throw Error.error(ErrorCode.X_42522); } indexName = session.database.nameManager.newAutoName("IDX", c.getName().name, table.getSchemaName(), table.getName(), SchemaObject.INDEX); Index index = table.createAndAddIndexStructure(indexName, c.core.mainCols, null, null, true, true, false); Constraint newconstraint = new Constraint(c.getName(), table, index, Constraint.UNIQUE); table.addConstraint(newconstraint); session.database.schemaManager.addSchemaObject( newconstraint); break; } case Constraint.FOREIGN_KEY : { addForeignKey(session, table, c, constraintList); break; } case Constraint.CHECK : { c.prepareCheckConstraint(session, table, false); table.addConstraint(c); if (c.isNotNull()) { ColumnSchema column = table.getColumn(c.notNullColumnIndex); column.setNullable(false); table.setColumnTypeVars(c.notNullColumnIndex); } session.database.schemaManager.addSchemaObject(c); break; } } } return table; }
/** * Adds a list of temp constraints to a new table */
Adds a list of temp constraints to a new table
addTableConstraintDefinitions
{ "repo_name": "ifcharming/original2.0", "path": "src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java", "license": "gpl-3.0", "size": 145138 }
[ "org.hsqldb_voltpatches.HsqlNameManager", "org.hsqldb_voltpatches.index.Index", "org.hsqldb_voltpatches.lib.HsqlArrayList" ]
import org.hsqldb_voltpatches.HsqlNameManager; import org.hsqldb_voltpatches.index.Index; import org.hsqldb_voltpatches.lib.HsqlArrayList;
import org.hsqldb_voltpatches.*; import org.hsqldb_voltpatches.index.*; import org.hsqldb_voltpatches.lib.*;
[ "org.hsqldb_voltpatches", "org.hsqldb_voltpatches.index", "org.hsqldb_voltpatches.lib" ]
org.hsqldb_voltpatches; org.hsqldb_voltpatches.index; org.hsqldb_voltpatches.lib;
612,105
public Date convertFromTimeZone1StringToServerDate (SimpleDateFormat ndf, String tz1string, TimeZone tz1){ Date serverDate= null; try { ndf.setTimeZone(tz1); serverDate= ndf.parse(tz1string); } catch(Exception e){ e.printStackTrace(); } return serverDate; }
Date function (SimpleDateFormat ndf, String tz1string, TimeZone tz1){ Date serverDate= null; try { ndf.setTimeZone(tz1); serverDate= ndf.parse(tz1string); } catch(Exception e){ e.printStackTrace(); } return serverDate; }
/** * Convert a String representation of date and time in the client TimeZone * to Date representation of date and time in server TimeZone * before saving to DB. * tz1 is the client timezone, tz2 is the server timezone */
Convert a String representation of date and time in the client TimeZone to Date representation of date and time in server TimeZone before saving to DB. tz1 is the client timezone, tz2 is the server timezone
convertFromTimeZone1StringToServerDate
{ "repo_name": "harfalm/Sakai-10.1", "path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/util/TimeUtil.java", "license": "apache-2.0", "size": 4466 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.TimeZone" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
1,648,058
@Operation(opcode = Opcode.WRITE_BARRIERED) public static native void writeWord(Object object, int offset, WordBase val, LocationIdentity locationIdentity);
@Operation(opcode = Opcode.WRITE_BARRIERED) static native void function(Object object, int offset, WordBase val, LocationIdentity locationIdentity);
/** * Writes the memory at address {@code (object + offset)}. The offset is in bytes. * * @param object the base object for the memory access * @param offset the signed offset for the memory access * @param locationIdentity the identity of the write * @param val the value to be written to memory */
Writes the memory at address (object + offset). The offset is in bytes
writeWord
{ "repo_name": "zapster/graal-core", "path": "graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java", "license": "gpl-2.0", "size": 43991 }
[ "com.oracle.graal.compiler.common.LocationIdentity", "com.oracle.graal.word.Word" ]
import com.oracle.graal.compiler.common.LocationIdentity; import com.oracle.graal.word.Word;
import com.oracle.graal.compiler.common.*; import com.oracle.graal.word.*;
[ "com.oracle.graal" ]
com.oracle.graal;
1,512,671
static MethodHandle lookupArrayLoad(Class<?> receiverClass) { if (receiverClass.isArray()) { return MethodHandles.arrayElementGetter(receiverClass); } else if (Map.class.isAssignableFrom(receiverClass)) { // maps allow access like mymap[key] return MAP_GET; } else if (List.class.isAssignableFrom(receiverClass)) { return LIST_GET; } throw new IllegalArgumentException("Attempting to address a non-array type " + "[" + receiverClass.getCanonicalName() + "] as an array."); } @SuppressWarnings("unused") // iterator() methods are are actually used, javac just does not know :) private static final class ArrayIteratorHelper { private static final MethodHandles.Lookup PRIVATE_METHOD_HANDLES_LOOKUP = MethodHandles.lookup(); private static final Map<Class<?>,MethodHandle> ARRAY_TYPE_MH_MAPPING = Collections.unmodifiableMap( Stream.of(boolean[].class, byte[].class, short[].class, int[].class, long[].class, char[].class, float[].class, double[].class, Object[].class) .collect(Collectors.toMap(Function.identity(), type -> { try { return PRIVATE_METHOD_HANDLES_LOOKUP.findStatic( PRIVATE_METHOD_HANDLES_LOOKUP.lookupClass(), "iterator", MethodType.methodType(Iterator.class, type)); } catch (ReflectiveOperationException e) { throw new AssertionError(e); } })) ); private static final MethodHandle OBJECT_ARRAY_MH = ARRAY_TYPE_MH_MAPPING.get(Object[].class);
static MethodHandle lookupArrayLoad(Class<?> receiverClass) { if (receiverClass.isArray()) { return MethodHandles.arrayElementGetter(receiverClass); } else if (Map.class.isAssignableFrom(receiverClass)) { return MAP_GET; } else if (List.class.isAssignableFrom(receiverClass)) { return LIST_GET; } throw new IllegalArgumentException(STR + "[" + receiverClass.getCanonicalName() + STR); } @SuppressWarnings(STR) private static final class ArrayIteratorHelper { private static final MethodHandles.Lookup PRIVATE_METHOD_HANDLES_LOOKUP = MethodHandles.lookup(); private static final Map<Class<?>,MethodHandle> ARRAY_TYPE_MH_MAPPING = Collections.unmodifiableMap( Stream.of(boolean[].class, byte[].class, short[].class, int[].class, long[].class, char[].class, float[].class, double[].class, Object[].class) .collect(Collectors.toMap(Function.identity(), type -> { try { return PRIVATE_METHOD_HANDLES_LOOKUP.findStatic( PRIVATE_METHOD_HANDLES_LOOKUP.lookupClass(), STR, MethodType.methodType(Iterator.class, type)); } catch (ReflectiveOperationException e) { throw new AssertionError(e); } })) ); private static final MethodHandle OBJECT_ARRAY_MH = ARRAY_TYPE_MH_MAPPING.get(Object[].class);
/** * Returns a method handle to do an array load. * @param receiverClass Class of the array to load the value from * @return a MethodHandle that accepts the receiver as first argument, the index as second argument. * It returns the loaded value. */
Returns a method handle to do an array load
lookupArrayLoad
{ "repo_name": "ern/elasticsearch", "path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java", "license": "apache-2.0", "size": 64157 }
[ "java.lang.invoke.MethodHandle", "java.lang.invoke.MethodHandles", "java.lang.invoke.MethodType", "java.util.Collections", "java.util.Iterator", "java.util.List", "java.util.Map", "java.util.function.Function", "java.util.stream.Collectors", "java.util.stream.Stream" ]
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream;
import java.lang.invoke.*; import java.util.*; import java.util.function.*; import java.util.stream.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,848,105
public static String readFileAsStringV2(String fileName) throws java.io.IOException { return readFileAsStringV2(new File(fileName)); }
static String function(String fileName) throws java.io.IOException { return readFileAsStringV2(new File(fileName)); }
/** * from http://www.cs.helsinki.fi/group/converge/ * webcore.utilities.FileUtils * * @param fileName * @return * @throws java.io.IOException */
from HREF webcore.utilities.FileUtils
readFileAsStringV2
{ "repo_name": "qingtian/tb-diamond", "path": "diamond-utils/src/main/java/com/taobao/diamond/utils/ZFileUtil.java", "license": "gpl-2.0", "size": 13522 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
527,605
private Node renameProperty(Node propertyName) { checkArgument(propertyName.isString()); if (!renameProperties) { return propertyName; } Node call = IR.call( IR.name(NodeUtil.JSC_PROPERTY_NAME_FN).srcref(propertyName), propertyName); call.srcref(propertyName); call.putBooleanProp(Node.FREE_CALL, true); call.putBooleanProp(Node.IS_CONSTANT_NAME, true); return call; }
Node function(Node propertyName) { checkArgument(propertyName.isString()); if (!renameProperties) { return propertyName; } Node call = IR.call( IR.name(NodeUtil.JSC_PROPERTY_NAME_FN).srcref(propertyName), propertyName); call.srcref(propertyName); call.putBooleanProp(Node.FREE_CALL, true); call.putBooleanProp(Node.IS_CONSTANT_NAME, true); return call; }
/** * Wraps a property string in a JSCompiler_renameProperty call. * * <p>Should only be called in phases running before {@link RenameProperties}, * if such a pass is even used (see {@link #renameProperties}). */
Wraps a property string in a JSCompiler_renameProperty call. Should only be called in phases running before <code>RenameProperties</code>, if such a pass is even used (see <code>#renameProperties</code>)
renameProperty
{ "repo_name": "tiobe/closure-compiler", "path": "src/com/google/javascript/jscomp/DartSuperAccessorsPass.java", "license": "apache-2.0", "size": 6876 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.IR", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
66
@Override public OutputStream getOutputStream() { baos = new ByteArrayOutputStream(); return baos; }
OutputStream function() { baos = new ByteArrayOutputStream(); return baos; }
/** * Get the OutputStream to write to. * * @return An OutputStream * @since 1.0 */
Get the OutputStream to write to
getOutputStream
{ "repo_name": "apache/commons-email", "path": "src/main/java/org/apache/commons/mail/ByteArrayDataSource.java", "license": "apache-2.0", "size": 6261 }
[ "java.io.ByteArrayOutputStream", "java.io.OutputStream" ]
import java.io.ByteArrayOutputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,857,539
public List<String> getReadableFileExtensions() throws OpenStegoException { if(readFormats != null) { return readFormats; } String format = null; String[] formats = null; List<String> formatList = new ArrayList<String>(); formats = ImageIO.getReaderFormatNames(); for(int i = 0; i < formats.length; i++) { format = formats[i].toLowerCase(); if(format.indexOf("jpeg") >= 0 && format.indexOf("2000") >= 0) { format = "jp2"; } if(!formatList.contains(format)) { formatList.add(format); } } Collections.sort(formatList); readFormats = formatList; return readFormats; }
List<String> function() throws OpenStegoException { if(readFormats != null) { return readFormats; } String format = null; String[] formats = null; List<String> formatList = new ArrayList<String>(); formats = ImageIO.getReaderFormatNames(); for(int i = 0; i < formats.length; i++) { format = formats[i].toLowerCase(); if(format.indexOf("jpeg") >= 0 && format.indexOf("2000") >= 0) { format = "jp2"; } if(!formatList.contains(format)) { formatList.add(format); } } Collections.sort(formatList); readFormats = formatList; return readFormats; }
/** * Method to get the list of supported file extensions for reading * * @return List of supported file extensions for reading * @throws OpenStegoException */
Method to get the list of supported file extensions for reading
getReadableFileExtensions
{ "repo_name": "seglo/openstego", "path": "src/net/sourceforge/openstego/plugin/template/dct/DCTPluginTemplate.java", "license": "gpl-2.0", "size": 4600 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "javax.imageio.ImageIO", "net.sourceforge.openstego.OpenStegoException" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.imageio.ImageIO; import net.sourceforge.openstego.OpenStegoException;
import java.util.*; import javax.imageio.*; import net.sourceforge.openstego.*;
[ "java.util", "javax.imageio", "net.sourceforge.openstego" ]
java.util; javax.imageio; net.sourceforge.openstego;
759,931
//Esta parte del codigo muestra el logo de la empresa PropCapos prop = new PropCapos(); File jarPath=new File(DbCapos.class.getProtectionDomain().getCodeSource().getLocation().getPath()); String propertiesPath=jarPath.getParentFile().getAbsolutePath(); Image image = new Image("file:"+propertiesPath+"/"+prop.getStore_logo(), 256, 100, false, false); imgLogoCom.setImage(image); }
PropCapos prop = new PropCapos(); File jarPath=new File(DbCapos.class.getProtectionDomain().getCodeSource().getLocation().getPath()); String propertiesPath=jarPath.getParentFile().getAbsolutePath(); Image image = new Image("file:"+propertiesPath+"/"+prop.getStore_logo(), 256, 100, false, false); imgLogoCom.setImage(image); }
/** * Initializes the controller class. */
Initializes the controller class
initialize
{ "repo_name": "antoniotorres/CAPOS", "path": "src/main/loginController.java", "license": "gpl-3.0", "size": 1879 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,332,033
private void testSecondSnapshot() throws Exception { testLog.info("testSecondSnapshot starting"); expSnapshotState.add(payload3); expSnapshotState.add(payload4); expSnapshotState.add(payload5); expSnapshotState.add(payload6); // Delay the CaptureSnapshot message to the leader actor. leaderActor.underlyingActor().startDropMessages(CaptureSnapshotReply.class); // Send the payload. payload7 = sendPayloadData(leaderActor, "seven"); // Capture the CaptureSnapshotReply message so we can send it later. CaptureSnapshotReply captureSnapshotReply = MessageCollectorActor.expectFirstMatching(leaderCollectorActor, CaptureSnapshotReply.class); // Wait for the state to be applied in the leader. ApplyState applyState = MessageCollectorActor.expectFirstMatching(leaderCollectorActor, ApplyState.class); verifyApplyState(applyState, leaderCollectorActor, payload7.toString(), currentTerm, 7, payload7); // At this point the leader has applied the new state but the cached snapshot index should not be // advanced by a "fake" snapshot because we're in the middle of a snapshot. We'll wait for at least // one more heartbeat AppendEntriesReply to ensure this does not occur. MessageCollectorActor.clearMessages(leaderCollectorActor); MessageCollectorActor.expectFirstMatching(leaderCollectorActor, AppendEntriesReply.class); assertEquals("Leader snapshot term", currentTerm, leaderContext.getReplicatedLog().getSnapshotTerm()); assertEquals("Leader snapshot index", 5, leaderContext.getReplicatedLog().getSnapshotIndex()); assertEquals("Leader journal log size", 2, leaderContext.getReplicatedLog().size()); assertEquals("Leader journal last index", 7, leaderContext.getReplicatedLog().lastIndex()); assertEquals("Leader commit index", 7, leaderContext.getCommitIndex()); assertEquals("Leader last applied", 7, leaderContext.getLastApplied()); assertEquals("Leader replicatedToAllIndex", 5, leader.getReplicatedToAllIndex()); // Now deliver the CaptureSnapshotReply. leaderActor.underlyingActor().stopDropMessages(CaptureSnapshotReply.class); leaderActor.tell(captureSnapshotReply, leaderActor); // Wait for snapshot complete. MessageCollectorActor.expectFirstMatching(leaderCollectorActor, SaveSnapshotSuccess.class); // Wait for another heartbeat AppendEntriesReply. This should cause a "fake" snapshot to advance the // snapshot index and trimmed the log since we're no longer in a snapshot. MessageCollectorActor.clearMessages(leaderCollectorActor); MessageCollectorActor.expectFirstMatching(leaderCollectorActor, AppendEntriesReply.class); assertEquals("Leader snapshot term", currentTerm, leaderContext.getReplicatedLog().getSnapshotTerm()); assertEquals("Leader snapshot index", 6, leaderContext.getReplicatedLog().getSnapshotIndex()); assertEquals("Leader journal log size", 1, leaderContext.getReplicatedLog().size()); assertEquals("Leader journal last index", 7, leaderContext.getReplicatedLog().lastIndex()); assertEquals("Leader commit index", 7, leaderContext.getCommitIndex()); // Verify the persisted snapshot. This should reflect the snapshot index as the last applied // log entry (7) and shouldn't contain any unapplied entries as we capture persisted the snapshot data // when the snapshot is created (ie when the CaptureSnapshot is processed). List<Snapshot> persistedSnapshots = InMemorySnapshotStore.getSnapshots(leaderId, Snapshot.class); assertEquals("Persisted snapshots size", 1, persistedSnapshots.size()); verifySnapshot("Persisted", persistedSnapshots.get(0), currentTerm, 6, currentTerm, 7); List<ReplicatedLogEntry> unAppliedEntry = persistedSnapshots.get(0).getUnAppliedEntries(); assertEquals("Persisted Snapshot getUnAppliedEntries size", 1, unAppliedEntry.size()); verifyReplicatedLogEntry(unAppliedEntry.get(0), currentTerm, 7, payload7); // The leader's persisted journal log should be cleared since we did a snapshot. List<ReplicatedLogImplEntry> persistedLeaderJournal = InMemoryJournal.get( leaderId, ReplicatedLogImplEntry.class); assertEquals("Persisted journal log size", 0, persistedLeaderJournal.size()); // Verify the followers apply all 4 new log entries. List<ApplyState> applyStates = MessageCollectorActor.expectMatching(follower1CollectorActor, ApplyState.class, 4); verifyApplyState(applyStates.get(0), null, null, currentTerm, 4, payload4); verifyApplyState(applyStates.get(1), null, null, currentTerm, 5, payload5); verifyApplyState(applyStates.get(2), null, null, currentTerm, 6, payload6); verifyApplyState(applyStates.get(3), null, null, currentTerm, 7, payload7); applyStates = MessageCollectorActor.expectMatching(follower2CollectorActor, ApplyState.class, 4); verifyApplyState(applyStates.get(0), null, null, currentTerm, 4, payload4); verifyApplyState(applyStates.get(1), null, null, currentTerm, 5, payload5); verifyApplyState(applyStates.get(2), null, null, currentTerm, 6, payload6); verifyApplyState(applyStates.get(3), null, null, currentTerm, 7, payload7); // Verify the follower's snapshot index has also advanced. (after another AppendEntries heartbeat // to be safe). MessageCollectorActor.clearMessages(follower1CollectorActor); MessageCollectorActor.expectFirstMatching(follower1CollectorActor, AppendEntries.class); RaftActorContext follower1Context = follower1Actor.underlyingActor().getRaftActorContext(); assertEquals("Follower 1 snapshot term", currentTerm, follower1Context.getReplicatedLog().getSnapshotTerm()); assertEquals("Follower 1 snapshot index", 6, follower1Context.getReplicatedLog().getSnapshotIndex()); assertEquals("Follower 1 journal log size", 1, follower1Context.getReplicatedLog().size()); assertEquals("Follower 1 journal last index", 7, follower1Context.getReplicatedLog().lastIndex()); assertEquals("Follower 1 commit index", 7, follower1Context.getCommitIndex()); MessageCollectorActor.clearMessages(follower2CollectorActor); MessageCollectorActor.expectFirstMatching(follower2CollectorActor, AppendEntries.class); RaftActorContext follower2Context = follower2Actor.underlyingActor().getRaftActorContext(); assertEquals("Follower 2 snapshot term", currentTerm, follower2Context.getReplicatedLog().getSnapshotTerm()); assertEquals("Follower 2 snapshot index", 6, follower2Context.getReplicatedLog().getSnapshotIndex()); assertEquals("Follower 2 journal log size", 1, follower2Context.getReplicatedLog().size()); assertEquals("Follower 2 journal last index", 7, follower2Context.getReplicatedLog().lastIndex()); assertEquals("Follower 2 commit index", 7, follower2Context.getCommitIndex()); expSnapshotState.add(payload7); testLog.info("testSecondSnapshot ending"); }
void function() throws Exception { testLog.info(STR); expSnapshotState.add(payload3); expSnapshotState.add(payload4); expSnapshotState.add(payload5); expSnapshotState.add(payload6); leaderActor.underlyingActor().startDropMessages(CaptureSnapshotReply.class); payload7 = sendPayloadData(leaderActor, "seven"); CaptureSnapshotReply captureSnapshotReply = MessageCollectorActor.expectFirstMatching(leaderCollectorActor, CaptureSnapshotReply.class); ApplyState applyState = MessageCollectorActor.expectFirstMatching(leaderCollectorActor, ApplyState.class); verifyApplyState(applyState, leaderCollectorActor, payload7.toString(), currentTerm, 7, payload7); MessageCollectorActor.clearMessages(leaderCollectorActor); MessageCollectorActor.expectFirstMatching(leaderCollectorActor, AppendEntriesReply.class); assertEquals(STR, currentTerm, leaderContext.getReplicatedLog().getSnapshotTerm()); assertEquals(STR, 5, leaderContext.getReplicatedLog().getSnapshotIndex()); assertEquals(STR, 2, leaderContext.getReplicatedLog().size()); assertEquals(STR, 7, leaderContext.getReplicatedLog().lastIndex()); assertEquals(STR, 7, leaderContext.getCommitIndex()); assertEquals(STR, 7, leaderContext.getLastApplied()); assertEquals(STR, 5, leader.getReplicatedToAllIndex()); leaderActor.underlyingActor().stopDropMessages(CaptureSnapshotReply.class); leaderActor.tell(captureSnapshotReply, leaderActor); MessageCollectorActor.expectFirstMatching(leaderCollectorActor, SaveSnapshotSuccess.class); MessageCollectorActor.clearMessages(leaderCollectorActor); MessageCollectorActor.expectFirstMatching(leaderCollectorActor, AppendEntriesReply.class); assertEquals(STR, currentTerm, leaderContext.getReplicatedLog().getSnapshotTerm()); assertEquals(STR, 6, leaderContext.getReplicatedLog().getSnapshotIndex()); assertEquals(STR, 1, leaderContext.getReplicatedLog().size()); assertEquals(STR, 7, leaderContext.getReplicatedLog().lastIndex()); assertEquals(STR, 7, leaderContext.getCommitIndex()); List<Snapshot> persistedSnapshots = InMemorySnapshotStore.getSnapshots(leaderId, Snapshot.class); assertEquals(STR, 1, persistedSnapshots.size()); verifySnapshot(STR, persistedSnapshots.get(0), currentTerm, 6, currentTerm, 7); List<ReplicatedLogEntry> unAppliedEntry = persistedSnapshots.get(0).getUnAppliedEntries(); assertEquals(STR, 1, unAppliedEntry.size()); verifyReplicatedLogEntry(unAppliedEntry.get(0), currentTerm, 7, payload7); List<ReplicatedLogImplEntry> persistedLeaderJournal = InMemoryJournal.get( leaderId, ReplicatedLogImplEntry.class); assertEquals(STR, 0, persistedLeaderJournal.size()); List<ApplyState> applyStates = MessageCollectorActor.expectMatching(follower1CollectorActor, ApplyState.class, 4); verifyApplyState(applyStates.get(0), null, null, currentTerm, 4, payload4); verifyApplyState(applyStates.get(1), null, null, currentTerm, 5, payload5); verifyApplyState(applyStates.get(2), null, null, currentTerm, 6, payload6); verifyApplyState(applyStates.get(3), null, null, currentTerm, 7, payload7); applyStates = MessageCollectorActor.expectMatching(follower2CollectorActor, ApplyState.class, 4); verifyApplyState(applyStates.get(0), null, null, currentTerm, 4, payload4); verifyApplyState(applyStates.get(1), null, null, currentTerm, 5, payload5); verifyApplyState(applyStates.get(2), null, null, currentTerm, 6, payload6); verifyApplyState(applyStates.get(3), null, null, currentTerm, 7, payload7); MessageCollectorActor.clearMessages(follower1CollectorActor); MessageCollectorActor.expectFirstMatching(follower1CollectorActor, AppendEntries.class); RaftActorContext follower1Context = follower1Actor.underlyingActor().getRaftActorContext(); assertEquals(STR, currentTerm, follower1Context.getReplicatedLog().getSnapshotTerm()); assertEquals(STR, 6, follower1Context.getReplicatedLog().getSnapshotIndex()); assertEquals(STR, 1, follower1Context.getReplicatedLog().size()); assertEquals(STR, 7, follower1Context.getReplicatedLog().lastIndex()); assertEquals(STR, 7, follower1Context.getCommitIndex()); MessageCollectorActor.clearMessages(follower2CollectorActor); MessageCollectorActor.expectFirstMatching(follower2CollectorActor, AppendEntries.class); RaftActorContext follower2Context = follower2Actor.underlyingActor().getRaftActorContext(); assertEquals(STR, currentTerm, follower2Context.getReplicatedLog().getSnapshotTerm()); assertEquals(STR, 6, follower2Context.getReplicatedLog().getSnapshotIndex()); assertEquals(STR, 1, follower2Context.getReplicatedLog().size()); assertEquals(STR, 7, follower2Context.getReplicatedLog().lastIndex()); assertEquals(STR, 7, follower2Context.getCommitIndex()); expSnapshotState.add(payload7); testLog.info(STR); }
/** * Send one more payload to trigger another snapshot. In this scenario, we delay the snapshot until * consensus occurs and the leader applies the state. * @throws Exception */
Send one more payload to trigger another snapshot. In this scenario, we delay the snapshot until consensus occurs and the leader applies the state
testSecondSnapshot
{ "repo_name": "Sushma7785/OpenDayLight-Load-Balancer", "path": "opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicationAndSnapshotsIntegrationTest.java", "license": "epl-1.0", "size": 24462 }
[ "java.util.List", "org.junit.Assert", "org.opendaylight.controller.cluster.raft.base.messages.ApplyState", "org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply", "org.opendaylight.controller.cluster.raft.messages.AppendEntries", "org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply", "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal", "org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore", "org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor" ]
import java.util.List; import org.junit.Assert; import org.opendaylight.controller.cluster.raft.base.messages.ApplyState; import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply; import org.opendaylight.controller.cluster.raft.messages.AppendEntries; import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply; import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal; import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore; import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
import java.util.*; import org.junit.*; import org.opendaylight.controller.cluster.raft.base.messages.*; import org.opendaylight.controller.cluster.raft.messages.*; import org.opendaylight.controller.cluster.raft.utils.*;
[ "java.util", "org.junit", "org.opendaylight.controller" ]
java.util; org.junit; org.opendaylight.controller;
889,767
public TimeValue getAsTime(String setting, TimeValue defaultValue) { return parseTimeValue(get(setting), defaultValue, setting); }
TimeValue function(String setting, TimeValue defaultValue) { return parseTimeValue(get(setting), defaultValue, setting); }
/** * Returns the setting value (as time) associated with the setting key. If it does not exists, * returns the default value provided. */
Returns the setting value (as time) associated with the setting key. If it does not exists, returns the default value provided
getAsTime
{ "repo_name": "robin13/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/settings/Settings.java", "license": "apache-2.0", "size": 54918 }
[ "org.elasticsearch.common.unit.TimeValue" ]
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,225,001
public List<ImageData> getFailures() { List<ImageData> failures = new ArrayList<ImageData>(); Map<Boolean, List<ImageData>> e; Iterator<Map<Boolean, List<ImageData>>> i = result.values().iterator(); while (i.hasNext()) { e = i.next(); failures.addAll(e.get(Boolean.valueOf(false))); } return failures; } public SecurityContext getContext() { return ctx; }
List<ImageData> function() { List<ImageData> failures = new ArrayList<ImageData>(); Map<Boolean, List<ImageData>> e; Iterator<Map<Boolean, List<ImageData>>> i = result.values().iterator(); while (i.hasNext()) { e = i.next(); failures.addAll(e.get(Boolean.valueOf(false))); } return failures; } public SecurityContext getContext() { return ctx; }
/** * Returns the images that failed to be moved or deleted. * * @return See above. */
Returns the images that failed to be moved or deleted
getFailures
{ "repo_name": "simleo/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/model/MIFResultObject.java", "license": "gpl-2.0", "size": 4470 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "java.util.Map" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,270,927
protected static XMLParameter getServiceSection(CommonModel model, Object stationKey) { Vector classes = model.getClassKeys(); //creating set of service time distributions XMLParameter[] distrParams = new XMLParameter[classes.size()]; Object currentClass; for (int i = 0; i < distrParams.length; i++) { currentClass = classes.get(i); Object serviceDistribution = model.getServiceTimeDistribution(stationKey, currentClass); if (serviceDistribution instanceof Distribution) { // Service time is a Distribution and not a LDService distrParams[i] = DistributionWriter.getDistributionParameter((Distribution) serviceDistribution, model, currentClass); } else if (serviceDistribution instanceof ZeroStrategy) { // Zero Service Time Strategy --- Bertoli Marco distrParams[i] = new XMLParameter("ZeroTimeServiceStrategy", ZeroStrategy.getEngineClassPath(), model.getClassName(currentClass), (String) null, true); } else { // Load dependent Service Time Strategy --- Bertoli Marco LDStrategy strategy = (LDStrategy) serviceDistribution; XMLParameter[] ranges = new XMLParameter[strategy.getRangeNumber()]; Object[] rangeKeys = strategy.getAllRanges(); for (int j = 0; j < ranges.length; j++) { // Creates "from" parameter XMLParameter from = new XMLParameter("from", Integer.class.getName(), null, Integer.toString(strategy.getRangeFrom(rangeKeys[j])), true); // Creates "distribution" parameter XMLParameter[] distribution = DistributionWriter.getDistributionParameter(strategy.getRangeDistribution(rangeKeys[j])); // Creates "function" parameter (mean value of the distribution) XMLParameter function = new XMLParameter("function", String.class.getName(), null, strategy .getRangeDistributionMean(rangeKeys[j]), true); ranges[j] = new XMLParameter("LDParameter", strategiesClasspathBase + serviceStrategiesSuffix + "LDParameter", null, new XMLParameter[] { from, distribution[0], distribution[1], function }, true); // Sets array = false as it's not an array of equal elements ranges[j].parameterArray = "false"; } // Creates LDParameter array XMLParameter LDParameter = new XMLParameter("LDParameter", strategiesClasspathBase + serviceStrategiesSuffix + "LDParameter", null, ranges, true); // Creates Service strategy distrParams[i] = new XMLParameter("LoadDependentStrategy", strategiesClasspathBase + serviceStrategiesSuffix + "LoadDependentStrategy", model.getClassName(currentClass), new XMLParameter[] { LDParameter }, true); distrParams[i].parameterArray = "false"; } } XMLParameter globalDistr = new XMLParameter("ServiceStrategy", strategiesClasspathBase + "ServiceStrategy", null, distrParams, false); return globalDistr; }
static XMLParameter function(CommonModel model, Object stationKey) { Vector classes = model.getClassKeys(); XMLParameter[] distrParams = new XMLParameter[classes.size()]; Object currentClass; for (int i = 0; i < distrParams.length; i++) { currentClass = classes.get(i); Object serviceDistribution = model.getServiceTimeDistribution(stationKey, currentClass); if (serviceDistribution instanceof Distribution) { distrParams[i] = DistributionWriter.getDistributionParameter((Distribution) serviceDistribution, model, currentClass); } else if (serviceDistribution instanceof ZeroStrategy) { distrParams[i] = new XMLParameter(STR, ZeroStrategy.getEngineClassPath(), model.getClassName(currentClass), (String) null, true); } else { LDStrategy strategy = (LDStrategy) serviceDistribution; XMLParameter[] ranges = new XMLParameter[strategy.getRangeNumber()]; Object[] rangeKeys = strategy.getAllRanges(); for (int j = 0; j < ranges.length; j++) { XMLParameter from = new XMLParameter("from", Integer.class.getName(), null, Integer.toString(strategy.getRangeFrom(rangeKeys[j])), true); XMLParameter[] distribution = DistributionWriter.getDistributionParameter(strategy.getRangeDistribution(rangeKeys[j])); XMLParameter function = new XMLParameter(STR, String.class.getName(), null, strategy .getRangeDistributionMean(rangeKeys[j]), true); ranges[j] = new XMLParameter(STR, strategiesClasspathBase + serviceStrategiesSuffix + STR, null, new XMLParameter[] { from, distribution[0], distribution[1], function }, true); ranges[j].parameterArray = "false"; } XMLParameter LDParameter = new XMLParameter(STR, strategiesClasspathBase + serviceStrategiesSuffix + STR, null, ranges, true); distrParams[i] = new XMLParameter(STR, strategiesClasspathBase + serviceStrategiesSuffix + STR, model.getClassName(currentClass), new XMLParameter[] { LDParameter }, true); distrParams[i].parameterArray = "false"; } } XMLParameter globalDistr = new XMLParameter(STR, strategiesClasspathBase + STR, null, distrParams, false); return globalDistr; }
/** * Returns a service section rapresentation in XMLParameter format * @param model model data structure * @param stationKey search's key for current station * @return service section rapresentation in XMLParameter format * Author: Bertoli Marco */
Returns a service section rapresentation in XMLParameter format
getServiceSection
{ "repo_name": "HOMlab/QN-ACTR-Release", "path": "QN-ACTR Java/src/jmt/gui/common/xml/XMLWriter.java", "license": "lgpl-3.0", "size": 47785 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
1,479,449
public ExpressRoutePeeringState state() { return this.state; }
ExpressRoutePeeringState function() { return this.state; }
/** * Get the peering state. Possible values include: 'Disabled', 'Enabled'. * * @return the state value */
Get the peering state. Possible values include: 'Disabled', 'Enabled'
state
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/ExpressRouteCrossConnectionPeeringInner.java", "license": "mit", "size": 12184 }
[ "com.microsoft.azure.management.network.v2019_08_01.ExpressRoutePeeringState" ]
import com.microsoft.azure.management.network.v2019_08_01.ExpressRoutePeeringState;
import com.microsoft.azure.management.network.v2019_08_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,333,295
public void testEqualsAndHashcode() throws IOException { for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) { checkEqualsAndHashCode(createTestItem(), this::copy, this::mutate); } }
void function() throws IOException { for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) { checkEqualsAndHashCode(createTestItem(), this::copy, this::mutate); } }
/** * Test equality and hashCode properties */
Test equality and hashCode properties
testEqualsAndHashcode
{ "repo_name": "henakamaMSFT/elasticsearch", "path": "core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java", "license": "apache-2.0", "size": 12141 }
[ "java.io.IOException", "org.elasticsearch.test.EqualsHashCodeTestUtils" ]
import java.io.IOException; import org.elasticsearch.test.EqualsHashCodeTestUtils;
import java.io.*; import org.elasticsearch.test.*;
[ "java.io", "org.elasticsearch.test" ]
java.io; org.elasticsearch.test;
639,733
public Neighbor<double[], E> nearest(double[] q, double recall, int T) { if (recall > 1 || recall < 0) { throw new IllegalArgumentException("Invalid recall: " + recall); } double alpha = 1 - Math.pow(1 - recall, 1.0 / hash.size()); IntArrayList candidates = new IntArrayList(); for (int i = 0; i < hash.size(); i++) { IntArrayList buckets = model.get(i).getProbeSequence(q, alpha, T); for (int j = 0; j < buckets.size(); j++) { int bucket = buckets.get(j); ArrayList<HashEntry> bin = hash.get(i).table[bucket % H]; if (bin != null) { for (HashEntry e : bin) { if (e.bucket == bucket) { if (q == e.key && identicalExcluded) { continue; } candidates.add(e.index); } } } } } Neighbor<double[], E> neighbor = new Neighbor<double[], E>(null, null, -1, Double.MAX_VALUE); int[] cand = candidates.toArray(); Arrays.sort(cand); int prev = -1; for (int index : cand) { if (index == prev) { continue; } else { prev = index; } double[] key = keys.get(index); double distance = Math.distance(q, key); if (distance < neighbor.distance) { neighbor.index = index; neighbor.distance = distance; neighbor.key = key; neighbor.value = data.get(index); } } return neighbor; }
Neighbor<double[], E> function(double[] q, double recall, int T) { if (recall > 1 recall < 0) { throw new IllegalArgumentException(STR + recall); } double alpha = 1 - Math.pow(1 - recall, 1.0 / hash.size()); IntArrayList candidates = new IntArrayList(); for (int i = 0; i < hash.size(); i++) { IntArrayList buckets = model.get(i).getProbeSequence(q, alpha, T); for (int j = 0; j < buckets.size(); j++) { int bucket = buckets.get(j); ArrayList<HashEntry> bin = hash.get(i).table[bucket % H]; if (bin != null) { for (HashEntry e : bin) { if (e.bucket == bucket) { if (q == e.key && identicalExcluded) { continue; } candidates.add(e.index); } } } } } Neighbor<double[], E> neighbor = new Neighbor<double[], E>(null, null, -1, Double.MAX_VALUE); int[] cand = candidates.toArray(); Arrays.sort(cand); int prev = -1; for (int index : cand) { if (index == prev) { continue; } else { prev = index; } double[] key = keys.get(index); double distance = Math.distance(q, key); if (distance < neighbor.distance) { neighbor.index = index; neighbor.distance = distance; neighbor.key = key; neighbor.value = data.get(index); } } return neighbor; }
/** * Returns the approximate nearest neighbor. A posteriori multiple probe * model has to be trained already. * @param q the query object. * @param recall the expected recall rate. * @param T the maximum number of probes. */
Returns the approximate nearest neighbor. A posteriori multiple probe model has to be trained already
nearest
{ "repo_name": "dublinio/smile", "path": "Smile/src/main/java/smile/neighbor/MPLSH.java", "license": "apache-2.0", "size": 33511 }
[ "java.util.ArrayList", "java.util.Arrays" ]
import java.util.ArrayList; import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,116,790
public default GraphTraversal<S, Vertex> addV(final Traversal<?, String> vertexLabelTraversal) { if (null == vertexLabelTraversal) throw new IllegalArgumentException("vertexLabelTraversal cannot be null"); this.asAdmin().getBytecode().addStep(Symbols.addV, vertexLabelTraversal); return this.asAdmin().addStep(new AddVertexStep<>(this.asAdmin(), vertexLabelTraversal.asAdmin())); }
default GraphTraversal<S, Vertex> function(final Traversal<?, String> vertexLabelTraversal) { if (null == vertexLabelTraversal) throw new IllegalArgumentException(STR); this.asAdmin().getBytecode().addStep(Symbols.addV, vertexLabelTraversal); return this.asAdmin().addStep(new AddVertexStep<>(this.asAdmin(), vertexLabelTraversal.asAdmin())); }
/** * Adds a {@link Vertex} with a vertex label determined by a {@link Traversal}. * * @return the traversal with the {@link AddVertexStep} added * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addvertex-step" target="_blank">Reference Documentation - AddVertex Step</a> * @since 3.3.1 */
Adds a <code>Vertex</code> with a vertex label determined by a <code>Traversal</code>
addV
{ "repo_name": "apache/tinkerpop", "path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java", "license": "apache-2.0", "size": 186459 }
[ "org.apache.tinkerpop.gremlin.process.traversal.Traversal", "org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep", "org.apache.tinkerpop.gremlin.structure.Vertex" ]
import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep; import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.process.traversal.*; import org.apache.tinkerpop.gremlin.process.traversal.step.map.*; import org.apache.tinkerpop.gremlin.structure.*;
[ "org.apache.tinkerpop" ]
org.apache.tinkerpop;
2,632,256
public BoxSharedLinkRequestObject setPermissions(final BoxSharedLinkPermissions permissionsEntity) { put(BoxSharedLink.FIELD_PERMISSIONS, permissionsEntity); return this; }
BoxSharedLinkRequestObject function(final BoxSharedLinkPermissions permissionsEntity) { put(BoxSharedLink.FIELD_PERMISSIONS, permissionsEntity); return this; }
/** * Set permissions. * * @param permissionsEntity * permissions * @return */
Set permissions
setPermissions
{ "repo_name": "ElectroJunkie/box-java-sdk-v2-master", "path": "BoxJavaLibraryV2/src/com/box/boxjavalibv2/requests/requestobjects/BoxSharedLinkRequestObject.java", "license": "apache-2.0", "size": 2989 }
[ "com.box.boxjavalibv2.dao.BoxSharedLink", "com.box.boxjavalibv2.dao.BoxSharedLinkPermissions" ]
import com.box.boxjavalibv2.dao.BoxSharedLink; import com.box.boxjavalibv2.dao.BoxSharedLinkPermissions;
import com.box.boxjavalibv2.dao.*;
[ "com.box.boxjavalibv2" ]
com.box.boxjavalibv2;
90,531
public void setOriginEntryGroupService(OriginEntryGroupService originEntryGroupService) { this.originEntryGroupService = originEntryGroupService; }
void function(OriginEntryGroupService originEntryGroupService) { this.originEntryGroupService = originEntryGroupService; }
/** * Sets the originEntryGroupService attribute value. * * @param originEntryGroupService The originEntryGroupService to set. */
Sets the originEntryGroupService attribute value
setOriginEntryGroupService
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/ld/batch/service/impl/LaborPosterServiceImpl.java", "license": "agpl-3.0", "size": 27221 }
[ "org.kuali.kfs.gl.service.OriginEntryGroupService" ]
import org.kuali.kfs.gl.service.OriginEntryGroupService;
import org.kuali.kfs.gl.service.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
960,227
private void writeSkip(int skip, PacketBuilder pb) { if (skip > -1) { int type = 0; if (skip != 0) { if (skip < 32) { type = 1; } else if (skip < 256) { type = 2; } else if (skip < 2048) { type = 3; } else { throw new IllegalArgumentException("Skip count cannot be over 2047!"); } } pb.putBits(1, 0); pb.putBits(2, type); switch (type) { case 1: pb.putBits(5, skip); break; case 2: pb.putBits(8, skip); break; case 3: pb.putBits(11, skip); break; } } }
void function(int skip, PacketBuilder pb) { if (skip > -1) { int type = 0; if (skip != 0) { if (skip < 32) { type = 1; } else if (skip < 256) { type = 2; } else if (skip < 2048) { type = 3; } else { throw new IllegalArgumentException(STR); } } pb.putBits(1, 0); pb.putBits(2, type); switch (type) { case 1: pb.putBits(5, skip); break; case 2: pb.putBits(8, skip); break; case 3: pb.putBits(11, skip); break; } } }
/** * Writes an amount of loops to skip. * * @param skip The amount of loops to skip. * @param pb The message factory to write with. */
Writes an amount of loops to skip
writeSkip
{ "repo_name": "Anadyr/OSRSe", "path": "src/Servers/Game/org/osrse/game/logic/protocol/ComplexUpdate.java", "license": "mit", "size": 18830 }
[ "org.osrse.network.PacketBuilder" ]
import org.osrse.network.PacketBuilder;
import org.osrse.network.*;
[ "org.osrse.network" ]
org.osrse.network;
2,742,687
public static Reader newReader(ReadableByteChannel ch, String csName) { checkNotNull(csName, "csName"); return newReader(ch, Charset.forName(csName).newDecoder(), -1); }
static Reader function(ReadableByteChannel ch, String csName) { checkNotNull(csName, STR); return newReader(ch, Charset.forName(csName).newDecoder(), -1); }
/** * Constructs a reader that decodes bytes from the given channel according * to the named charset. * * <p> An invocation of this method of the form * * <blockquote><pre> * Channels.newReader(ch, csname)</pre></blockquote> * * behaves in exactly the same way as the expression * * <blockquote><pre> * Channels.newReader(ch, * Charset.forName(csName) * .newDecoder(), * -1);</pre></blockquote> * * @param ch * The channel from which bytes will be read * * @param csName * The name of the charset to be used * * @return A new reader * * @throws UnsupportedCharsetException * If no support for the named charset is available * in this instance of the Java virtual machine */
Constructs a reader that decodes bytes from the given channel according to the named charset. An invocation of this method of the form <code> Channels.newReader(ch, csname)</code> behaves in exactly the same way as the expression <code> Channels.newReader(ch, Charset.forName(csName) .newDecoder(), -1);</code>
newReader
{ "repo_name": "debian-pkg-android-tools/android-platform-libcore", "path": "ojluni/src/main/java/java/nio/channels/Channels.java", "license": "gpl-2.0", "size": 16470 }
[ "java.io.Reader", "java.nio.charset.Charset" ]
import java.io.Reader; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,540,287
public void generateEvent(String dskType, String id, double magnitude) { String key = dskType + "' / '" + id; if (log.isInfoEnabled()) { log.info("Generate Flare Event for : '" + key + "' with magnitude " + magnitude); } Vector<IPluginEventPublisher> publishers = policyElements.get(key); if (publishers != null) { for (IPluginEventPublisher publisher : publishers) { publisher.pushGauge(dskType, id, "Flare", "magnitude", magnitude); } } if (dskType.trim().length() == 0) { eventListener.event(id, magnitude); } }
void function(String dskType, String id, double magnitude) { String key = dskType + STR + id; if (log.isInfoEnabled()) { log.info(STR + key + STR + magnitude); } Vector<IPluginEventPublisher> publishers = policyElements.get(key); if (publishers != null) { for (IPluginEventPublisher publisher : publishers) { publisher.pushGauge(dskType, id, "Flare", STR, magnitude); } } if (dskType.trim().length() == 0) { eventListener.event(id, magnitude); } }
/** * generate event * * @param dskType disk type * @param id event id * @param magnitude magnitude */
generate event
generateEvent
{ "repo_name": "opensds/nbp", "path": "vmware/vro/plugin/src/main/java/org/opensds/storage/vro/plugin/core/OpenSDSStorageEventGenerator.java", "license": "apache-2.0", "size": 3889 }
[ "ch.dunes.vso.sdk.api.IPluginEventPublisher", "java.util.Vector" ]
import ch.dunes.vso.sdk.api.IPluginEventPublisher; import java.util.Vector;
import ch.dunes.vso.sdk.api.*; import java.util.*;
[ "ch.dunes.vso", "java.util" ]
ch.dunes.vso; java.util;
2,347,807
private static boolean canOptimizeObjectCreate(Node firstParam) { Node curParam = firstParam; while (curParam != null) { // All keys must be strings or numbers. if (!curParam.isString() && !curParam.isNumber()) { return false; } curParam = curParam.getNext(); // Check for an odd number of parameters. if (curParam == null) { return false; } curParam = curParam.getNext(); } return true; }
static boolean function(Node firstParam) { Node curParam = firstParam; while (curParam != null) { if (!curParam.isString() && !curParam.isNumber()) { return false; } curParam = curParam.getNext(); if (curParam == null) { return false; } curParam = curParam.getNext(); } return true; }
/** * Returns whether the given call to goog.object.create can be converted to an * object literal. */
Returns whether the given call to goog.object.create can be converted to an object literal
canOptimizeObjectCreate
{ "repo_name": "LorenzoDV/closure-compiler", "path": "src/com/google/javascript/jscomp/ClosureOptimizePrimitives.java", "license": "apache-2.0", "size": 7403 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
133,537
int deleteByExample(BDIHistoryDayExample example);
int deleteByExample(BDIHistoryDayExample example);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table nfjd502.dbo.BDIHistoryDay * * @mbggenerated Thu Mar 02 11:23:21 CST 2017 */
This method was generated by MyBatis Generator. This method corresponds to the database table nfjd502.dbo.BDIHistoryDay
deleteByExample
{ "repo_name": "xtwxy/cassandra-tests", "path": "mstar-server-dao/src/main/java/com/wincom/mstar/dao/mapper/BDIHistoryDayMapper.java", "license": "apache-2.0", "size": 2198 }
[ "com.wincom.mstar.domain.BDIHistoryDayExample" ]
import com.wincom.mstar.domain.BDIHistoryDayExample;
import com.wincom.mstar.domain.*;
[ "com.wincom.mstar" ]
com.wincom.mstar;
295,387
public void setHelpText(String text, Point location) { helpTextLabel.setText(text); moveHelpText(location); }
void function(String text, Point location) { helpTextLabel.setText(text); moveHelpText(location); }
/** * Set a help Text on the canvas at a given position * * @param text * @param location */
Set a help Text on the canvas at a given position
setHelpText
{ "repo_name": "RaphaelBrugier/gwtuml", "path": "GWTUMLAPI/src/com/objetdirect/gwt/umlapi/client/umlCanvas/DecoratorCanvas.java", "license": "gpl-3.0", "size": 15506 }
[ "com.objetdirect.gwt.umlapi.client.engine.Point" ]
import com.objetdirect.gwt.umlapi.client.engine.Point;
import com.objetdirect.gwt.umlapi.client.engine.*;
[ "com.objetdirect.gwt" ]
com.objetdirect.gwt;
261,768
private void setAppContext(Context context) { appContext = context; }
void function(Context context) { appContext = context; }
/** * Set the calling application context. * @param context the application context to set * @author Vibhor */
Set the calling application context
setAppContext
{ "repo_name": "vibhorgoswami/Utilities", "path": "DownloadLibrary/app/src/main/java/com/vibs/downloadlibrary/core/DownloadManager.java", "license": "gpl-2.0", "size": 25227 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,025,809
@Test public void sameLoggers() { TinylogLoggerFactory factory = new TinylogLoggerFactory(); TinylogLogger first = factory.getLogger("abc"); assertThat(first.getName()).isEqualTo("abc"); TinylogLogger second = factory.getLogger("abc"); assertThat(second.getName()).isEqualTo("abc"); assertThat(second).isSameAs(first); }
void function() { TinylogLoggerFactory factory = new TinylogLoggerFactory(); TinylogLogger first = factory.getLogger("abc"); assertThat(first.getName()).isEqualTo("abc"); TinylogLogger second = factory.getLogger("abc"); assertThat(second.getName()).isEqualTo("abc"); assertThat(second).isSameAs(first); }
/** * Verifies that the same logger instance will be returned for the same name. */
Verifies that the same logger instance will be returned for the same name
sameLoggers
{ "repo_name": "pmwmedia/tinylog", "path": "slf4j-tinylog/src/test/java/org/tinylog/slf4j/TinylogLoggerFactoryTest.java", "license": "apache-2.0", "size": 2249 }
[ "org.assertj.core.api.Assertions" ]
import org.assertj.core.api.Assertions;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
564,476
protected void writeToNestedBWC(StreamOutput out, QueryBuilder query, String nestedPath) throws IOException { assert out.getVersion().before(Version.V_5_5_0) : "invalid output version, must be < " + Version.V_5_5_0.toString(); writeToBWC(out, query, nestedPath, null); }
void function(StreamOutput out, QueryBuilder query, String nestedPath) throws IOException { assert out.getVersion().before(Version.V_5_5_0) : STR + Version.V_5_5_0.toString(); writeToBWC(out, query, nestedPath, null); }
/** * BWC serialization for nested {@link InnerHitBuilder}. * Should only be used to send nested inner hits to nodes pre 5.5. */
BWC serialization for nested <code>InnerHitBuilder</code>. Should only be used to send nested inner hits to nodes pre 5.5
writeToNestedBWC
{ "repo_name": "strapdata/elassandra5-rc", "path": "core/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java", "license": "apache-2.0", "size": 21817 }
[ "java.io.IOException", "org.elasticsearch.Version", "org.elasticsearch.common.io.stream.StreamOutput" ]
import java.io.IOException; import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.*; import org.elasticsearch.*; import org.elasticsearch.common.io.stream.*;
[ "java.io", "org.elasticsearch", "org.elasticsearch.common" ]
java.io; org.elasticsearch; org.elasticsearch.common;
2,062,973
public boolean isCorrectConfig() { return (!TextUtils.isEmpty(mConfig.getToken())); } public static class TGConfiguration { public static final String API_VERSION = "0.4"; private static final String DEFAULT_API_URL = "https://api.tapglue.com/"; private static final int DEFAULT_FLUSH_INTERVAL = 15 * 1000; // 15s private static final int MAX_FLUSH_INTERVAL = 180 * 1000; // 180s boolean analyticsEnabled = true; @NonNull String mApiBaseUrl = DEFAULT_API_URL; boolean mDebugMode = false; int mFlushIntervalInMs = DEFAULT_FLUSH_INTERVAL; @Nullable String mToken = null; private boolean cacheEnabled = true;
boolean function() { return (!TextUtils.isEmpty(mConfig.getToken())); } public static class TGConfiguration { public static final String API_VERSION = "0.4"; private static final String DEFAULT_API_URL = "https: private static final int DEFAULT_FLUSH_INTERVAL = 15 * 1000; private static final int MAX_FLUSH_INTERVAL = 180 * 1000; boolean analyticsEnabled = true; String mApiBaseUrl = DEFAULT_API_URL; boolean mDebugMode = false; int mFlushIntervalInMs = DEFAULT_FLUSH_INTERVAL; String mToken = null; private boolean cacheEnabled = true;
/** * Check if current configuration is correct (exists with non-null token) * * @return Is config correct? */
Check if current configuration is correct (exists with non-null token)
isCorrectConfig
{ "repo_name": "AutomatedPlayground/android_sdk", "path": "tapglue-android-sdk/src/main/java/com/tapglue/Tapglue.java", "license": "apache-2.0", "size": 11002 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
517,007
public HashMap<String, List<WSDLElement>> getElementTypes(List<Element> schemaElements, String targetNamespace) { HashMap<String, List<WSDLElement>> elementTypeToElements = new HashMap<>(); for (Element elm : schemaElements) { ElementImpl elmImpl = (ElementImpl) elm; elementTypeToElements.put(getTypeWithNamespace(targetNamespace, elmImpl.getQName()), getElementsOfElement (elm, targetNamespace)); } return elementTypeToElements; }
HashMap<String, List<WSDLElement>> function(List<Element> schemaElements, String targetNamespace) { HashMap<String, List<WSDLElement>> elementTypeToElements = new HashMap<>(); for (Element elm : schemaElements) { ElementImpl elmImpl = (ElementImpl) elm; elementTypeToElements.put(getTypeWithNamespace(targetNamespace, elmImpl.getQName()), getElementsOfElement (elm, targetNamespace)); } return elementTypeToElements; }
/** * This method create a map of list of sub elements against element name * * @param schemaElements List of elements * @param targetNamespace TargetNamespace of the element * @return Map of list of sub elements against element name */
This method create a map of list of sub elements against element name
getElementTypes
{ "repo_name": "wso2/carbon-governance-extensions", "path": "components/governance-extensions/org.wso2.carbon.governance.soap.viewer/src/main/java/org/wso2/carbon/governance/soap/viewer/WSDLVisualizer.java", "license": "apache-2.0", "size": 66401 }
[ "java.util.HashMap", "java.util.List", "org.ow2.easywsdl.schema.api.Element", "org.ow2.easywsdl.schema.impl.ElementImpl" ]
import java.util.HashMap; import java.util.List; import org.ow2.easywsdl.schema.api.Element; import org.ow2.easywsdl.schema.impl.ElementImpl;
import java.util.*; import org.ow2.easywsdl.schema.api.*; import org.ow2.easywsdl.schema.impl.*;
[ "java.util", "org.ow2.easywsdl" ]
java.util; org.ow2.easywsdl;
871,079
public FormEntryPrompt[] getQuestionPrompts() throws RuntimeException { ArrayList<FormIndex> indicies = new ArrayList<FormIndex>(); FormIndex currentIndex = getFormIndex(); // For questions, there is only one. // For groups, there could be many, but we set that below FormEntryPrompt[] questions = new FormEntryPrompt[1]; IFormElement element = mFormEntryController.getModel().getForm().getChild(currentIndex); if (element instanceof GroupDef) { GroupDef gd = (GroupDef) element; // descend into group FormIndex idxChild = mFormEntryController.getModel().incrementIndex(currentIndex, true); if ( gd.getChildren().size() == 1 && getEvent(idxChild) == FormEntryController.EVENT_GROUP ) { // if we have a group definition within a field-list attribute group, and this is the // only child in the group, check to see if it is also a field-list appearance. // If it is, then silently recurse into it to pick up its elements. // Work-around for the inconsistent treatment of field-list groups and repeats in 1.1.7 that // either breaks forms generated by build or breaks forms generated by XLSForm. IFormElement nestedElement = mFormEntryController.getModel().getForm().getChild(idxChild); if (nestedElement instanceof GroupDef) { GroupDef nestedGd = (GroupDef) nestedElement; if ( ODKView.FIELD_LIST.equalsIgnoreCase(nestedGd.getAppearanceAttr()) ) { gd = nestedGd; idxChild = mFormEntryController.getModel().incrementIndex(idxChild, true); } } } for (int i = 0; i < gd.getChildren().size(); i++) { indicies.add(idxChild); // don't descend idxChild = mFormEntryController.getModel().incrementIndex(idxChild, false); } // we only display relevant questions ArrayList<FormEntryPrompt> questionList = new ArrayList<FormEntryPrompt>(); for (int i = 0; i < indicies.size(); i++) { FormIndex index = indicies.get(i); if (getEvent(index) != FormEntryController.EVENT_QUESTION) { String errorMsg = "Only questions are allowed in 'field-list'. Bad node is: " + index.getReference().toString(false); RuntimeException e = new RuntimeException(errorMsg); Log.e(t, errorMsg); throw e; } // we only display relevant questions if (mFormEntryController.getModel().isIndexRelevant(index)) { questionList.add(getQuestionPrompt(index)); } questions = new FormEntryPrompt[questionList.size()]; questionList.toArray(questions); } } else { // We have a quesion, so just get the one prompt questions[0] = getQuestionPrompt(); } return questions; }
FormEntryPrompt[] function() throws RuntimeException { ArrayList<FormIndex> indicies = new ArrayList<FormIndex>(); FormIndex currentIndex = getFormIndex(); FormEntryPrompt[] questions = new FormEntryPrompt[1]; IFormElement element = mFormEntryController.getModel().getForm().getChild(currentIndex); if (element instanceof GroupDef) { GroupDef gd = (GroupDef) element; FormIndex idxChild = mFormEntryController.getModel().incrementIndex(currentIndex, true); if ( gd.getChildren().size() == 1 && getEvent(idxChild) == FormEntryController.EVENT_GROUP ) { IFormElement nestedElement = mFormEntryController.getModel().getForm().getChild(idxChild); if (nestedElement instanceof GroupDef) { GroupDef nestedGd = (GroupDef) nestedElement; if ( ODKView.FIELD_LIST.equalsIgnoreCase(nestedGd.getAppearanceAttr()) ) { gd = nestedGd; idxChild = mFormEntryController.getModel().incrementIndex(idxChild, true); } } } for (int i = 0; i < gd.getChildren().size(); i++) { indicies.add(idxChild); idxChild = mFormEntryController.getModel().incrementIndex(idxChild, false); } ArrayList<FormEntryPrompt> questionList = new ArrayList<FormEntryPrompt>(); for (int i = 0; i < indicies.size(); i++) { FormIndex index = indicies.get(i); if (getEvent(index) != FormEntryController.EVENT_QUESTION) { String errorMsg = STR + index.getReference().toString(false); RuntimeException e = new RuntimeException(errorMsg); Log.e(t, errorMsg); throw e; } if (mFormEntryController.getModel().isIndexRelevant(index)) { questionList.add(getQuestionPrompt(index)); } questions = new FormEntryPrompt[questionList.size()]; questionList.toArray(questions); } } else { questions[0] = getQuestionPrompt(); } return questions; }
/** * Returns an array of question promps. * * @return */
Returns an array of question promps
getQuestionPrompts
{ "repo_name": "smap-consulting/ODK1.4_lib", "path": "src/org/odk/collect/android/logic/FormController.java", "license": "apache-2.0", "size": 44030 }
[ "android.util.Log", "java.util.ArrayList", "org.javarosa.core.model.FormIndex", "org.javarosa.core.model.GroupDef", "org.javarosa.core.model.IFormElement", "org.javarosa.form.api.FormEntryController", "org.javarosa.form.api.FormEntryPrompt", "org.odk.collect.android.views.ODKView" ]
import android.util.Log; import java.util.ArrayList; import org.javarosa.core.model.FormIndex; import org.javarosa.core.model.GroupDef; import org.javarosa.core.model.IFormElement; import org.javarosa.form.api.FormEntryController; import org.javarosa.form.api.FormEntryPrompt; import org.odk.collect.android.views.ODKView;
import android.util.*; import java.util.*; import org.javarosa.core.model.*; import org.javarosa.form.api.*; import org.odk.collect.android.views.*;
[ "android.util", "java.util", "org.javarosa.core", "org.javarosa.form", "org.odk.collect" ]
android.util; java.util; org.javarosa.core; org.javarosa.form; org.odk.collect;
2,060,304
public final String getLikelyEndContextMismatchCause(ContentKind contentKind) { Preconditions.checkArgument(!isValidEndContextForContentKind(contentKind)); if (contentKind == ContentKind.ATTRIBUTES) { // Special error message for ATTRIBUTES since it has some specific logic. return "an unterminated attribute value, or ending with an unquoted attribute"; } switch (state) { case HTML_TAG_NAME: case HTML_TAG: case HTML_ATTRIBUTE_NAME: case HTML_NORMAL_ATTR_VALUE: return "an unterminated HTML tag or attribute"; case CSS: return "an unclosed style block or attribute"; case JS: case JS_LINE_COMMENT: // Line comments are terminated by end of input. return "an unclosed script block or attribute"; case CSS_COMMENT: case HTML_COMMENT: case JS_BLOCK_COMMENT: return "an unterminated comment"; case CSS_DQ_STRING: case CSS_SQ_STRING: case JS_DQ_STRING: case JS_SQ_STRING: return "an unterminated string literal"; case URI: case CSS_URI: case CSS_DQ_URI: case CSS_SQ_URI: return "an unterminated or empty URI"; case JS_REGEX: return "an unterminated regular expression"; default: if (templateNestDepth != 0) { return "an unterminated <template> element"; } else { return "unknown to compiler"; } } } @SuppressWarnings("hiding") // Enum value names mask corresponding Contexts declared above. public enum State { HTML_PCDATA(EscapingMode.ESCAPE_HTML), HTML_RCDATA(EscapingMode.ESCAPE_HTML_RCDATA), HTML_BEFORE_OPEN_TAG_NAME(EscapingMode.FILTER_HTML_ELEMENT_NAME), HTML_BEFORE_CLOSE_TAG_NAME(EscapingMode.FILTER_HTML_ELEMENT_NAME), HTML_TAG_NAME("Dynamic values are not permitted in the middle of an HTML tag name;" + " try adding a space before."), HTML_TAG(EscapingMode.FILTER_HTML_ATTRIBUTES), // TODO: Do we need to filter out names that look like JS/CSS/URI attribute names. HTML_ATTRIBUTE_NAME(EscapingMode.FILTER_HTML_ATTRIBUTES), HTML_BEFORE_ATTRIBUTE_VALUE("(unexpected state)"), HTML_COMMENT(EscapingMode.ESCAPE_HTML_RCDATA), HTML_NORMAL_ATTR_VALUE(EscapingMode.ESCAPE_HTML_ATTRIBUTE), CSS(EscapingMode.FILTER_CSS_VALUE), CSS_COMMENT("CSS comments cannot contain dynamic values."), CSS_DQ_STRING(EscapingMode.ESCAPE_CSS_STRING), CSS_SQ_STRING(EscapingMode.ESCAPE_CSS_STRING), CSS_URI(EscapingMode.NORMALIZE_URI), CSS_DQ_URI(EscapingMode.NORMALIZE_URI), CSS_SQ_URI(EscapingMode.NORMALIZE_URI), JS(EscapingMode.ESCAPE_JS_VALUE), JS_LINE_COMMENT("JS comments cannot contain dynamic values."), JS_BLOCK_COMMENT("JS comments cannot contain dynamic values."), JS_DQ_STRING(EscapingMode.ESCAPE_JS_STRING), JS_SQ_STRING(EscapingMode.ESCAPE_JS_STRING), JS_REGEX(EscapingMode.ESCAPE_JS_REGEX), URI(EscapingMode.NORMALIZE_URI), TEXT(EscapingMode.TEXT) ; private final @Nullable EscapingMode escapingMode; private final @Nullable String errorMessage; State(EscapingMode escapingMode) { this.escapingMode = escapingMode; this.errorMessage = null; } State(String errorMessage) { this.errorMessage = errorMessage; this.escapingMode = null; } } public enum ElementType { NONE, SCRIPT, STYLE, TEXTAREA, TITLE, XMP, MEDIA, NORMAL, ; } public enum AttributeType { NONE, SCRIPT, STYLE, URI, PLAIN_TEXT, ; } public enum AttributeEndDelimiter { NONE, DOUBLE_QUOTE("\""), SINGLE_QUOTE("'"), SPACE_OR_TAG_END(""), ; public final @Nullable String text; AttributeEndDelimiter(String text) { this.text = text; } AttributeEndDelimiter() { this.text = null; } } public enum JsFollowingSlash { NONE, REGEX, DIV_OP, UNKNOWN, ; } public enum UriPart { NONE, START, MAYBE_VARIABLE_SCHEME, MAYBE_SCHEME, AUTHORITY_OR_PATH, QUERY, FRAGMENT, UNKNOWN_PRE_FRAGMENT, UNKNOWN, DANGEROUS_SCHEME ; } public enum UriType { NONE, NORMAL, MEDIA // TODO(gboyer): Add TRUSTED for things like scripts and stylesheets that cannot be // attacker-controlled. } static final class Builder { private State state; private ElementType elType; private AttributeType attrType; private AttributeEndDelimiter delimType; private JsFollowingSlash slashType; private UriPart uriPart; private UriType uriType; private int templateNestDepth; private Builder(Context context) { this.state = context.state; this.elType = context.elType; this.attrType = context.attrType; this.delimType = context.delimType; this.slashType = context.slashType; this.uriPart = context.uriPart; this.uriType = context.uriType; this.templateNestDepth = context.templateNestDepth; }
final String function(ContentKind contentKind) { Preconditions.checkArgument(!isValidEndContextForContentKind(contentKind)); if (contentKind == ContentKind.ATTRIBUTES) { return STR; } switch (state) { case HTML_TAG_NAME: case HTML_TAG: case HTML_ATTRIBUTE_NAME: case HTML_NORMAL_ATTR_VALUE: return STR; case CSS: return STR; case JS: case JS_LINE_COMMENT: return STR; case CSS_COMMENT: case HTML_COMMENT: case JS_BLOCK_COMMENT: return STR; case CSS_DQ_STRING: case CSS_SQ_STRING: case JS_DQ_STRING: case JS_SQ_STRING: return STR; case URI: case CSS_URI: case CSS_DQ_URI: case CSS_SQ_URI: return STR; case JS_REGEX: return STR; default: if (templateNestDepth != 0) { return STR; } else { return STR; } } } @SuppressWarnings(STR) public enum State { HTML_PCDATA(EscapingMode.ESCAPE_HTML), HTML_RCDATA(EscapingMode.ESCAPE_HTML_RCDATA), HTML_BEFORE_OPEN_TAG_NAME(EscapingMode.FILTER_HTML_ELEMENT_NAME), HTML_BEFORE_CLOSE_TAG_NAME(EscapingMode.FILTER_HTML_ELEMENT_NAME), HTML_TAG_NAME(STR + STR), HTML_TAG(EscapingMode.FILTER_HTML_ATTRIBUTES), HTML_ATTRIBUTE_NAME(EscapingMode.FILTER_HTML_ATTRIBUTES), HTML_BEFORE_ATTRIBUTE_VALUE(STR), HTML_COMMENT(EscapingMode.ESCAPE_HTML_RCDATA), HTML_NORMAL_ATTR_VALUE(EscapingMode.ESCAPE_HTML_ATTRIBUTE), CSS(EscapingMode.FILTER_CSS_VALUE), CSS_COMMENT(STR), CSS_DQ_STRING(EscapingMode.ESCAPE_CSS_STRING), CSS_SQ_STRING(EscapingMode.ESCAPE_CSS_STRING), CSS_URI(EscapingMode.NORMALIZE_URI), CSS_DQ_URI(EscapingMode.NORMALIZE_URI), CSS_SQ_URI(EscapingMode.NORMALIZE_URI), JS(EscapingMode.ESCAPE_JS_VALUE), JS_LINE_COMMENT(STR), JS_BLOCK_COMMENT(STR), JS_DQ_STRING(EscapingMode.ESCAPE_JS_STRING), JS_SQ_STRING(EscapingMode.ESCAPE_JS_STRING), JS_REGEX(EscapingMode.ESCAPE_JS_REGEX), URI(EscapingMode.NORMALIZE_URI), TEXT(EscapingMode.TEXT) ; private final @Nullable EscapingMode escapingMode; private final @Nullable String errorMessage; State(EscapingMode escapingMode) { this.escapingMode = escapingMode; this.errorMessage = null; } State(String errorMessage) { this.errorMessage = errorMessage; this.escapingMode = null; } } public enum ElementType { NONE, SCRIPT, STYLE, TEXTAREA, TITLE, XMP, MEDIA, NORMAL, ; } public enum AttributeType { NONE, SCRIPT, STYLE, URI, PLAIN_TEXT, ; } public enum AttributeEndDelimiter { NONE, DOUBLE_QUOTE("\"STR'STR"), ; public final @Nullable String text; AttributeEndDelimiter(String text) { this.text = text; } AttributeEndDelimiter() { this.text = null; } } public enum JsFollowingSlash { NONE, REGEX, DIV_OP, UNKNOWN, ; } public enum UriPart { NONE, START, MAYBE_VARIABLE_SCHEME, MAYBE_SCHEME, AUTHORITY_OR_PATH, QUERY, FRAGMENT, UNKNOWN_PRE_FRAGMENT, UNKNOWN, DANGEROUS_SCHEME ; } public enum UriType { NONE, NORMAL, MEDIA } static final class Builder { private State state; private ElementType elType; private AttributeType attrType; private AttributeEndDelimiter delimType; private JsFollowingSlash slashType; private UriPart uriPart; private UriType uriType; private int templateNestDepth; private Builder(Context context) { this.state = context.state; this.elType = context.elType; this.attrType = context.attrType; this.delimType = context.delimType; this.slashType = context.slashType; this.uriPart = context.uriPart; this.uriType = context.uriType; this.templateNestDepth = context.templateNestDepth; }
/** * Returns a plausible human-readable description of a context mismatch; * <p> * This assumes that the provided context is an invalid end context for the particular content * kind. */
Returns a plausible human-readable description of a context mismatch; This assumes that the provided context is an invalid end context for the particular content kind
getLikelyEndContextMismatchCause
{ "repo_name": "atul-bhouraskar/closure-templates", "path": "java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java", "license": "apache-2.0", "size": 54126 }
[ "com.google.common.base.Preconditions", "com.google.template.soy.data.SanitizedContent", "javax.annotation.Nullable" ]
import com.google.common.base.Preconditions; import com.google.template.soy.data.SanitizedContent; import javax.annotation.Nullable;
import com.google.common.base.*; import com.google.template.soy.data.*; import javax.annotation.*;
[ "com.google.common", "com.google.template", "javax.annotation" ]
com.google.common; com.google.template; javax.annotation;
54,009
public void startApp() { if (!initialized) { nfcMenu = new NfcMenuForm(this); nfcMenu.init(); } Display.getDisplay(this).setCurrent(nfcMenu); }
void function() { if (!initialized) { nfcMenu = new NfcMenuForm(this); nfcMenu.init(); } Display.getDisplay(this).setCurrent(nfcMenu); }
/** * Called when the midlet is entering the active state. * On the very first start-up, this registers listening for NDEF tags. */
Called when the midlet is entering the active state. On the very first start-up, this registers listening for NDEF tags
startApp
{ "repo_name": "andijakl/nfccreator", "path": "src/com/nokia/examples/NfcCreatorMidlet.java", "license": "gpl-3.0", "size": 1743 }
[ "javax.microedition.lcdui.Display" ]
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.*;
[ "javax.microedition" ]
javax.microedition;
1,059,494
@Override protected boolean standardRetainAll(Collection<?> elementsToRetain) { return Multisets.retainAllImpl(this, elementsToRetain); }
boolean function(Collection<?> elementsToRetain) { return Multisets.retainAllImpl(this, elementsToRetain); }
/** * A sensible definition of {@link #retainAll} in terms of the {@code * retainAll} method of {@link #elementSet}. If you override {@link * #elementSet}, you may wish to override {@link #retainAll} to forward to * this implementation. * * @since 7.0 */
A sensible definition of <code>#retainAll</code> in terms of the retainAll method of <code>#elementSet</code>. If you override <code>#elementSet</code>, you may wish to override <code>#retainAll</code> to forward to this implementation
standardRetainAll
{ "repo_name": "paulmartel/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/collect/ForwardingMultiset.java", "license": "agpl-3.0", "size": 9962 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,296,676
public static HashFunction hmacMd5(byte[] key) { return hmacMd5(new SecretKeySpec(checkNotNull(key), "HmacMD5")); }
static HashFunction function(byte[] key) { return hmacMd5(new SecretKeySpec(checkNotNull(key), STR)); }
/** * Returns a hash function implementing the Message Authentication Code (MAC) algorithm, using the * MD5 (128 hash bits) hash function and a {@link SecretKeySpec} created from the given byte array * and the MD5 algorithm. * * @param key the key material of the secret key * @since 20.0 */
Returns a hash function implementing the Message Authentication Code (MAC) algorithm, using the MD5 (128 hash bits) hash function and a <code>SecretKeySpec</code> created from the given byte array and the MD5 algorithm
hmacMd5
{ "repo_name": "typetools/guava", "path": "guava/src/com/google/common/hash/Hashing.java", "license": "apache-2.0", "size": 26827 }
[ "javax.crypto.spec.SecretKeySpec" ]
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.*;
[ "javax.crypto" ]
javax.crypto;
2,769,378
private static int blendColors(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); } private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { private int[] mIndicatorColors;
static int function(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); } private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { private int[] mIndicatorColors;
/** * Blend {@code color1} and {@code color2} using the given ratio. * * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, * 0.0 will return {@code color2}. */
Blend color1 and color2 using the given ratio
blendColors
{ "repo_name": "KyoungjunPark/SmartClass", "path": "app/src/main/java/com/example/kjpark/smartclass/SlidingTabStrip.java", "license": "mit", "size": 6417 }
[ "android.graphics.Color" ]
import android.graphics.Color;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,674,866
public boolean isMarkPointRange(float x, float y) { float range = DensityUtils.dp2px(getContext(), 60); if (x > (markPointX - range) && x < (markPointX + range) && y > (markPointY - range) && y < (markPointY + range)) { return true; } else { return false; } }
boolean function(float x, float y) { float range = DensityUtils.dp2px(getContext(), 60); if (x > (markPointX - range) && x < (markPointX + range) && y > (markPointY - range) && y < (markPointY + range)) { return true; } else { return false; } }
/** * Checks if is mark point range. * * @param x * the x * @param y * the y * @return true, if is mark point range */
Checks if is mark point range
isMarkPointRange
{ "repo_name": "gizwits/Gizwits-SmartBuld_Android", "path": "src/com/gizwits/opensource/devicecontrol/ui/view/ColorTempCircularSeekBar.java", "license": "mit", "size": 25145 }
[ "com.gizwits.opensource.devicecontrol.ui.utils.DensityUtils" ]
import com.gizwits.opensource.devicecontrol.ui.utils.DensityUtils;
import com.gizwits.opensource.devicecontrol.ui.utils.*;
[ "com.gizwits.opensource" ]
com.gizwits.opensource;
2,159,678
public void testBooleanValueType() throws Exception { // isXxx assertFalse(BOOLEAN_TYPE.isArrayType()); assertFalse(BOOLEAN_TYPE.isBooleanObjectType()); assertTrue(BOOLEAN_TYPE.isBooleanValueType()); assertFalse(BOOLEAN_TYPE.isDateType()); assertFalse(BOOLEAN_TYPE.isEnumElementType()); assertFalse(BOOLEAN_TYPE.isNamedType()); assertFalse(BOOLEAN_TYPE.isNullType()); assertFalse(BOOLEAN_TYPE.isNumberObjectType()); assertFalse(BOOLEAN_TYPE.isNumberValueType()); assertFalse(BOOLEAN_TYPE.isFunctionPrototypeType()); assertFalse(BOOLEAN_TYPE.isRegexpType()); assertFalse(BOOLEAN_TYPE.isStringObjectType()); assertFalse(BOOLEAN_TYPE.isStringValueType()); assertFalse(BOOLEAN_TYPE.isEnumType()); assertFalse(BOOLEAN_TYPE.isUnionType()); assertFalse(BOOLEAN_TYPE.isStruct()); assertFalse(BOOLEAN_TYPE.isDict()); assertFalse(BOOLEAN_TYPE.isAllType()); assertFalse(BOOLEAN_TYPE.isVoidType()); assertFalse(BOOLEAN_TYPE.isConstructor()); assertFalse(BOOLEAN_TYPE.isInstanceType()); // autoboxesTo assertTypeEquals(BOOLEAN_OBJECT_TYPE, BOOLEAN_TYPE.autoboxesTo()); // unboxesTo assertTypeEquals(BOOLEAN_TYPE, BOOLEAN_OBJECT_TYPE.unboxesTo()); // isSubtype assertTrue(BOOLEAN_TYPE.isSubtype(ALL_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(STRING_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(NUMBER_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(functionType)); assertFalse(BOOLEAN_TYPE.isSubtype(NULL_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(DATE_TYPE)); assertTrue(BOOLEAN_TYPE.isSubtype(unresolvedNamedType)); assertFalse(BOOLEAN_TYPE.isSubtype(namedGoogBar)); assertFalse(BOOLEAN_TYPE.isSubtype(REGEXP_TYPE)); // canBeCalled assertFalse(BOOLEAN_TYPE.canBeCalled()); // canTestForEqualityWith assertCanTestForEqualityWith(BOOLEAN_TYPE, ALL_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, STRING_OBJECT_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, NUMBER_TYPE); assertCannotTestForEqualityWith(BOOLEAN_TYPE, functionType); assertCannotTestForEqualityWith(BOOLEAN_TYPE, VOID_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, DATE_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, REGEXP_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, UNKNOWN_TYPE); // canTestForShallowEqualityWith assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertFalse(BOOLEAN_TYPE. canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(functionType)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE. canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE)); // isNullable assertFalse(BOOLEAN_TYPE.isNullable()); assertFalse(BOOLEAN_TYPE.isVoidable()); // matchesXxx assertTrue(BOOLEAN_TYPE.matchesInt32Context()); assertTrue(BOOLEAN_TYPE.matchesNumberContext()); assertTrue(BOOLEAN_TYPE.matchesObjectContext()); assertTrue(BOOLEAN_TYPE.matchesStringContext()); assertTrue(BOOLEAN_TYPE.matchesUint32Context()); // toString assertEquals("boolean", BOOLEAN_TYPE.toString()); assertTrue(BOOLEAN_TYPE.hasDisplayName()); assertEquals("boolean", BOOLEAN_TYPE.getDisplayName()); Asserts.assertResolvesToSame(BOOLEAN_TYPE); }
void function() throws Exception { assertFalse(BOOLEAN_TYPE.isArrayType()); assertFalse(BOOLEAN_TYPE.isBooleanObjectType()); assertTrue(BOOLEAN_TYPE.isBooleanValueType()); assertFalse(BOOLEAN_TYPE.isDateType()); assertFalse(BOOLEAN_TYPE.isEnumElementType()); assertFalse(BOOLEAN_TYPE.isNamedType()); assertFalse(BOOLEAN_TYPE.isNullType()); assertFalse(BOOLEAN_TYPE.isNumberObjectType()); assertFalse(BOOLEAN_TYPE.isNumberValueType()); assertFalse(BOOLEAN_TYPE.isFunctionPrototypeType()); assertFalse(BOOLEAN_TYPE.isRegexpType()); assertFalse(BOOLEAN_TYPE.isStringObjectType()); assertFalse(BOOLEAN_TYPE.isStringValueType()); assertFalse(BOOLEAN_TYPE.isEnumType()); assertFalse(BOOLEAN_TYPE.isUnionType()); assertFalse(BOOLEAN_TYPE.isStruct()); assertFalse(BOOLEAN_TYPE.isDict()); assertFalse(BOOLEAN_TYPE.isAllType()); assertFalse(BOOLEAN_TYPE.isVoidType()); assertFalse(BOOLEAN_TYPE.isConstructor()); assertFalse(BOOLEAN_TYPE.isInstanceType()); assertTypeEquals(BOOLEAN_OBJECT_TYPE, BOOLEAN_TYPE.autoboxesTo()); assertTypeEquals(BOOLEAN_TYPE, BOOLEAN_OBJECT_TYPE.unboxesTo()); assertTrue(BOOLEAN_TYPE.isSubtype(ALL_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(STRING_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(NUMBER_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(functionType)); assertFalse(BOOLEAN_TYPE.isSubtype(NULL_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.isSubtype(DATE_TYPE)); assertTrue(BOOLEAN_TYPE.isSubtype(unresolvedNamedType)); assertFalse(BOOLEAN_TYPE.isSubtype(namedGoogBar)); assertFalse(BOOLEAN_TYPE.isSubtype(REGEXP_TYPE)); assertFalse(BOOLEAN_TYPE.canBeCalled()); assertCanTestForEqualityWith(BOOLEAN_TYPE, ALL_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, STRING_OBJECT_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, NUMBER_TYPE); assertCannotTestForEqualityWith(BOOLEAN_TYPE, functionType); assertCannotTestForEqualityWith(BOOLEAN_TYPE, VOID_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, DATE_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, REGEXP_TYPE); assertCanTestForEqualityWith(BOOLEAN_TYPE, UNKNOWN_TYPE); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertFalse(BOOLEAN_TYPE. canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(functionType)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE. canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertFalse(BOOLEAN_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertTrue(BOOLEAN_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE)); assertFalse(BOOLEAN_TYPE.isNullable()); assertFalse(BOOLEAN_TYPE.isVoidable()); assertTrue(BOOLEAN_TYPE.matchesInt32Context()); assertTrue(BOOLEAN_TYPE.matchesNumberContext()); assertTrue(BOOLEAN_TYPE.matchesObjectContext()); assertTrue(BOOLEAN_TYPE.matchesStringContext()); assertTrue(BOOLEAN_TYPE.matchesUint32Context()); assertEquals(STR, BOOLEAN_TYPE.toString()); assertTrue(BOOLEAN_TYPE.hasDisplayName()); assertEquals(STR, BOOLEAN_TYPE.getDisplayName()); Asserts.assertResolvesToSame(BOOLEAN_TYPE); }
/** * Tests the behavior of the boolean type. */
Tests the behavior of the boolean type
testBooleanValueType
{ "repo_name": "LorenzoDV/closure-compiler", "path": "test/com/google/javascript/rhino/jstype/JSTypeTest.java", "license": "apache-2.0", "size": 273520 }
[ "com.google.javascript.rhino.testing.Asserts" ]
import com.google.javascript.rhino.testing.Asserts;
import com.google.javascript.rhino.testing.*;
[ "com.google.javascript" ]
com.google.javascript;
377,572
public static SRPPublicKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_SRP_PUBLIC_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new SRPKeyPairRawCodec(); return (SRPPublicKey) codec.decodePublicKey(k); } throw new IllegalArgumentException("magic"); }
static SRPPublicKey function(byte[] k) { if (k[0] == Registry.MAGIC_RAW_SRP_PUBLIC_KEY[0]) { IKeyPairCodec codec = new SRPKeyPairRawCodec(); return (SRPPublicKey) codec.decodePublicKey(k); } throw new IllegalArgumentException("magic"); }
/** * A class method that takes the output of the <code>encodePublicKey()</code> * method of an SRP keypair codec object (an instance implementing * {@link IKeyPairCodec} for SRP keys, and re-constructs an instance of this * object. * * @param k the contents of a previously encoded instance of this object. * @throws ArrayIndexOutOfBoundsException if there is not enough bytes, in * <code>k</code>, to represent a valid encoding of an instance * of this object. * @throws IllegalArgumentException if the byte sequence does not represent a * valid encoding of an instance of this object. */
A class method that takes the output of the <code>encodePublicKey()</code> method of an SRP keypair codec object (an instance implementing <code>IKeyPairCodec</code> for SRP keys, and re-constructs an instance of this object
valueOf
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/javax/crypto/key/srp6/SRPPublicKey.java", "license": "gpl-2.0", "size": 5852 }
[ "gnu.java.security.Registry", "gnu.java.security.key.IKeyPairCodec" ]
import gnu.java.security.Registry; import gnu.java.security.key.IKeyPairCodec;
import gnu.java.security.*; import gnu.java.security.key.*;
[ "gnu.java.security" ]
gnu.java.security;
2,159,500
EClass getUrl_Statement();
EClass getUrl_Statement();
/** * Returns the meta object for class '{@link org.xtext.example.macros.macros.Url_Statement <em>Url Statement</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Url Statement</em>'. * @see org.xtext.example.macros.macros.Url_Statement * @generated */
Returns the meta object for class '<code>org.xtext.example.macros.macros.Url_Statement Url Statement</code>'.
getUrl_Statement
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.macros/src-gen/org/xtext/example/macros/macros/MacrosPackage.java", "license": "epl-1.0", "size": 25384 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
763,684
ServiceCall createUserAsync(User body, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
ServiceCall createUserAsync(User body, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
/** * Create user. * This can only be done by the logged in user. * * @param body Created user object * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */
Create user. This can only be done by the logged in user
createUserAsync
{ "repo_name": "xingwu1/autorest", "path": "Samples/petstore/Java/SwaggerPetstore.java", "license": "mit", "size": 35698 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,510,990
private INodeAttributeProvider getUserFilteredAttributeProvider( UserGroupInformation ugi) { if (attributeProvider == null || (ugi != null && isUserBypassingExtAttrProvider(ugi.getUserName()))) { return null; } return attributeProvider; }
INodeAttributeProvider function( UserGroupInformation ugi) { if (attributeProvider == null (ugi != null && isUserBypassingExtAttrProvider(ugi.getUserName()))) { return null; } return attributeProvider; }
/** * Return attributeProvider or null if ugi is to bypass attributeProvider. * @param ugi * @return configured attributeProvider or null */
Return attributeProvider or null if ugi is to bypass attributeProvider
getUserFilteredAttributeProvider
{ "repo_name": "huafengw/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java", "license": "apache-2.0", "size": 71874 }
[ "org.apache.hadoop.security.UserGroupInformation" ]
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
841,847
Optional<Long> extent();
Optional<Long> extent();
/** * Get the extent of the aggregation. * <p> * The extent is the space of time in milliseconds that an aggregation takes samples. * * @return The extent if available, otherwise an empty result. */
Get the extent of the aggregation. The extent is the space of time in milliseconds that an aggregation takes samples
extent
{ "repo_name": "dbrounst/heroic", "path": "heroic-component/src/main/java/com/spotify/heroic/aggregation/Aggregation.java", "license": "apache-2.0", "size": 2041 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
2,529,782
@ApiModelProperty(example = "null", value = "Use this detector name when refering to this detector in a configuration for media processing") public String getDetectorName() { return detectorName; }
@ApiModelProperty(example = "null", value = STR) String function() { return detectorName; }
/** * Use this detector name when refering to this detector in a configuration for media processing * @return detectorName **/
Use this detector name when refering to this detector in a configuration for media processing
getDetectorName
{ "repo_name": "jbocharov/voicebase-java-samples", "path": "v3-upload-transcribe/src/main/java/com/voicebase/sample/v3client/model/VbDetectorModel.java", "license": "mit", "size": 7686 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,059,119
@Override public void onCreate(SQLiteDatabase db) { onUpgrade(db,0,DATABASE_VERSION); }
void function(SQLiteDatabase db) { onUpgrade(db,0,DATABASE_VERSION); }
/** * In the onCreate function we create the tables * @param db Android will pass in a writable SQLiteDatabase that we use to create the tables */
In the onCreate function we create the tables
onCreate
{ "repo_name": "SNiels/Multi-Mania-app", "path": "app/MultiMania/app/src/main/java/be/ana/nmct/multimania/data/DbHelper.java", "license": "mit", "size": 10632 }
[ "android.database.sqlite.SQLiteDatabase" ]
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.*;
[ "android.database" ]
android.database;
1,237,888
long getRemainingSpace() throws IOException;
long getRemainingSpace() throws IOException;
/** * Get the amount of free space on the mount, in bytes. You should decrease this value as the user writes to the * mount, and write operations should fail once it reaches zero. * * @return The amount of free space, in bytes. * @throws IOException If the remaining space could not be computed. */
Get the amount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero
getRemainingSpace
{ "repo_name": "rolandoislas/PeripheralsPlusPlus", "path": "src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java", "license": "gpl-2.0", "size": 3189 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,542,543
public static Color getColor(final int systemColorID) { final Display display = Display.getCurrent(); return display.getSystemColor(systemColorID); }
static Color function(final int systemColorID) { final Display display = Display.getCurrent(); return display.getSystemColor(systemColorID); }
/** * Returns the system {@link Color} matching the specific ID. * * @param systemColorID * the ID value for the color * @return the system {@link Color} matching the specific ID */
Returns the system <code>Color</code> matching the specific ID
getColor
{ "repo_name": "Berloe/SDMapGen", "path": "org.smapgen/src/org/eclipse/wb/swt/SWTResourceManager.java", "license": "epl-1.0", "size": 18234 }
[ "org.eclipse.swt.graphics.Color", "org.eclipse.swt.widgets.Display" ]
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,898,800
public final CreateIndexRequestBuilder prepareCreate(String index) { return prepareCreate(index, -1); }
final CreateIndexRequestBuilder function(String index) { return prepareCreate(index, -1); }
/** * Creates a new {@link CreateIndexRequestBuilder} with the settings obtained from {@link #indexSettings()}. */
Creates a new <code>CreateIndexRequestBuilder</code> with the settings obtained from <code>#indexSettings()</code>
prepareCreate
{ "repo_name": "rajanm/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "apache-2.0", "size": 107161 }
[ "org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder" ]
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.admin.indices.create.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,212
@Test public void selectItemOfSpecificType() { ListItemDock item = new ListItemDock(listView1.asList(), Date.class, new Any()); listView1.asSelectable().selector().select(item.control()); }
void function() { ListItemDock item = new ListItemDock(listView1.asList(), Date.class, new Any()); listView1.asSelectable().selector().select(item.control()); }
/** * Selecting an item of specific type. */
Selecting an item of specific type
selectItemOfSpecificType
{ "repo_name": "teamfx/openjfx-8u-dev-tests", "path": "tools/Jemmy/JemmyFX/samples/org/jemmy/samples/listview/ListViewSample.java", "license": "gpl-2.0", "size": 6707 }
[ "java.util.Date", "org.jemmy.fx.control.ListItemDock", "org.jemmy.lookup.Any" ]
import java.util.Date; import org.jemmy.fx.control.ListItemDock; import org.jemmy.lookup.Any;
import java.util.*; import org.jemmy.fx.control.*; import org.jemmy.lookup.*;
[ "java.util", "org.jemmy.fx", "org.jemmy.lookup" ]
java.util; org.jemmy.fx; org.jemmy.lookup;
1,579,761
protected Object lookup() throws NamingException { return lookup(getJndiName(), getExpectedType()); }
Object function() throws NamingException { return lookup(getJndiName(), getExpectedType()); }
/** * Perform the actual JNDI lookup for this locator's target resource. * @return the located target object * @throws NamingException if the JNDI lookup failed or if the * located JNDI object is not assigable to the expected type * @see #setJndiName * @see #setExpectedType * @see #lookup(String, Class) */
Perform the actual JNDI lookup for this locator's target resource
lookup
{ "repo_name": "mattxia/spring-2.5-analysis", "path": "src/org/springframework/jndi/JndiObjectLocator.java", "license": "apache-2.0", "size": 3358 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
1,744,937
@Override public CMActivity getStartActivity(final Long processClassId) throws CMWorkflowException { logger.debug("getting starting activity for process with class id '{}'", processClassId); return workflowEngine.findProcessClassById(processClassId).getStartActivity(); }
CMActivity function(final Long processClassId) throws CMWorkflowException { logger.debug(STR, processClassId); return workflowEngine.findProcessClassById(processClassId).getStartActivity(); }
/** * Returns the process start activity for the current user. * * @param process * class id * @return the start activity definition * @throws CMWorkflowException */
Returns the process start activity for the current user
getStartActivity
{ "repo_name": "jzinedine/CMDBuild", "path": "core/src/main/java/org/cmdbuild/logic/workflow/DefaultWorkflowLogic.java", "license": "agpl-3.0", "size": 19284 }
[ "org.cmdbuild.workflow.CMActivity", "org.cmdbuild.workflow.CMWorkflowException" ]
import org.cmdbuild.workflow.CMActivity; import org.cmdbuild.workflow.CMWorkflowException;
import org.cmdbuild.workflow.*;
[ "org.cmdbuild.workflow" ]
org.cmdbuild.workflow;
386,405
public void fireSpanChanged(SpanModelEvent event) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == SpanModelListener.class) { ((SpanModelListener) listeners[i + 1]).spanChanged(event); } } }
void function(SpanModelEvent event) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == SpanModelListener.class) { ((SpanModelListener) listeners[i + 1]).spanChanged(event); } } }
/** * Forwards the given notification event to all * <code>SpanModelListeners</code> that registered themselves as listeners * for this SpanModel. * * @param event * the event to be forwarded * * @see #addSpanModelListener * @see SpanModelEvent * @see EventListenerList */
Forwards the given notification event to all <code>SpanModelListeners</code> that registered themselves as listeners for this SpanModel
fireSpanChanged
{ "repo_name": "nextreports/nextreports-designer", "path": "src/ro/nextreports/designer/grid/AbstractSpanModel.java", "license": "apache-2.0", "size": 4104 }
[ "ro.nextreports.designer.grid.event.SpanModelEvent", "ro.nextreports.designer.grid.event.SpanModelListener" ]
import ro.nextreports.designer.grid.event.SpanModelEvent; import ro.nextreports.designer.grid.event.SpanModelListener;
import ro.nextreports.designer.grid.event.*;
[ "ro.nextreports.designer" ]
ro.nextreports.designer;
2,568,932
public String getFullName() { CharBuffer name = new CharBuffer(); name.append(getName()); name.append("("); JClass []params = getParameterTypes(); for (int i = 0; i < params.length; i++) { if (i != 0) name.append(", "); name.append(params[i].getShortName()); } name.append(')'); return name.toString(); }
String function() { CharBuffer name = new CharBuffer(); name.append(getName()); name.append("("); JClass []params = getParameterTypes(); for (int i = 0; i < params.length; i++) { if (i != 0) name.append(STR); name.append(params[i].getShortName()); } name.append(')'); return name.toString(); }
/** * Returns a full method name with arguments. */
Returns a full method name with arguments
getFullName
{ "repo_name": "dlitz/resin", "path": "modules/kernel/src/com/caucho/bytecode/JMethod.java", "license": "gpl-2.0", "size": 3732 }
[ "com.caucho.util.CharBuffer" ]
import com.caucho.util.CharBuffer;
import com.caucho.util.*;
[ "com.caucho.util" ]
com.caucho.util;
1,500,040
public List<LumberjackFrame> getFrames() throws LumberjackFrameException { List<LumberjackFrame> frames = new LinkedList<>(); if (currState != LumberjackState.COMPLETE) { throw new LumberjackFrameException("Must be at the trailer of a frame"); } try { if (currState == LumberjackState.COMPLETE && frameBuilder.frameType == FRAME_COMPRESSED) { logger.debug("Frame is compressed, will iterate to decode", new Object[]{}); // LumberjackDecoder decompressedDecoder = new LumberjackDecoder(); // Zero currBytes, currState and frameBuilder prior to iteration over // decompressed bytes currBytes.reset(); frameBuilder.reset(); currState = LumberjackState.VERSION; // Run over decompressed data. frames = processDECOMPRESSED(decompressedData); } else { final LumberjackFrame frame = frameBuilder.build(); currBytes.reset(); frameBuilder.reset(); currState = LumberjackState.VERSION; frames.add(frame); } return frames; } catch (Exception e) { throw new LumberjackFrameException("Error decoding Lumberjack frame: " + e.getMessage(), e); } }
List<LumberjackFrame> function() throws LumberjackFrameException { List<LumberjackFrame> frames = new LinkedList<>(); if (currState != LumberjackState.COMPLETE) { throw new LumberjackFrameException(STR); } try { if (currState == LumberjackState.COMPLETE && frameBuilder.frameType == FRAME_COMPRESSED) { logger.debug(STR, new Object[]{}); currBytes.reset(); frameBuilder.reset(); currState = LumberjackState.VERSION; frames = processDECOMPRESSED(decompressedData); } else { final LumberjackFrame frame = frameBuilder.build(); currBytes.reset(); frameBuilder.reset(); currState = LumberjackState.VERSION; frames.add(frame); } return frames; } catch (Exception e) { throw new LumberjackFrameException(STR + e.getMessage(), e); } }
/** * Returns the decoded frame and resets the decoder for the next frame. * This method should be called after checking isComplete(). * * @return the LumberjackFrame that was decoded */
Returns the decoded frame and resets the decoder for the next frame. This method should be called after checking isComplete()
getFrames
{ "repo_name": "jtstorck/nifi", "path": "nifi-nar-bundles/nifi-lumberjack-bundle/nifi-lumberjack-processors/src/main/java/org/apache/nifi/processors/lumberjack/frame/LumberjackDecoder.java", "license": "apache-2.0", "size": 12238 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
961,904
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityHopper) { playerIn.displayGUIChest((TileEntityHopper)tileentity); playerIn.addStat(StatList.HOPPER_INSPECTED); } return true; } }
boolean function(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityHopper) { playerIn.displayGUIChest((TileEntityHopper)tileentity); playerIn.addStat(StatList.HOPPER_INSPECTED); } return true; } }
/** * Called when the block is right clicked by a player. */
Called when the block is right clicked by a player
onBlockActivated
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockHopper.java", "license": "gpl-3.0", "size": 11063 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.stats.StatList", "net.minecraft.tileentity.TileEntity", "net.minecraft.tileentity.TileEntityHopper", "net.minecraft.util.EnumFacing", "net.minecraft.util.EnumHand", "net.minecraft.util.math.BlockPos", "net.minecraft.world.World" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World;
import net.minecraft.block.state.*; import net.minecraft.entity.player.*; import net.minecraft.stats.*; import net.minecraft.tileentity.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.entity", "net.minecraft.stats", "net.minecraft.tileentity", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.entity; net.minecraft.stats; net.minecraft.tileentity; net.minecraft.util; net.minecraft.world;
454,197
public MetaProperty<DaysAdjustment> exCouponPeriod() { return exCouponPeriod; }
MetaProperty<DaysAdjustment> function() { return exCouponPeriod; }
/** * The meta-property for the {@code exCouponPeriod} property. * @return the meta-property, not null */
The meta-property for the exCouponPeriod property
exCouponPeriod
{ "repo_name": "OpenGamma/Strata", "path": "modules/product/src/main/java/com/opengamma/strata/product/bond/CapitalIndexedBond.java", "license": "apache-2.0", "size": 39324 }
[ "com.opengamma.strata.basics.date.DaysAdjustment", "org.joda.beans.MetaProperty" ]
import com.opengamma.strata.basics.date.DaysAdjustment; import org.joda.beans.MetaProperty;
import com.opengamma.strata.basics.date.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
1,779,165
@Override public void appendTo(Appendable out, String name) throws IOException { // Write the mappings out to the file. The format of the generated // source map is three sections, each delimited by a magic comment. // // The first section contains an array for each line of the generated // code, where each element in the array is the ID of the mapping which // best represents the index-th character found on that line of the // generated source code. // // The second section contains an array per generated line. Unused. // // The third and final section contains an array per line, each of which // represents a mapping with a unique ID. The mappings are added in order. // The array itself contains a tuple representing // ['source file', line, col (, 'original name')] // // Example for 2 lines of generated code (with line numbers added for // readability): // // 1) { "count": 2 } // 2) [0,0,0,0,0,0,1,1,1,1,2] // 3) [2,2,2,2,2,2,3,4,4,4,4,4] // 4) // 5) [] // 6) [] // 7) // 8) ["a.js", 1, 34] // 9) ["a.js", 5, 2] // 10) ["b.js", 1, 3, "event"] // 11) ["c.js", 1, 4] // 12) ["d.js", 3, 78, "foo"] int maxLine = prepMappings(); // Add the line character maps. out.append("{ \"file\" : "); out.append(escapeString(name)); out.append(", \"count\": "); out.append(String.valueOf(maxLine + 1)); out.append(" }\n"); (new LineMapper(out)).appendLineMappings(); // Add the source file maps. out.append("\n"); // This section is unused but we need one entry per line to // prevent changing the format. for (int i = 0; i <= maxLine; ++i) { out.append("[]\n"); } // Add the mappings themselves. out.append("\n"); (new MappingWriter()).appendMappings(out); }
void function(Appendable out, String name) throws IOException { int maxLine = prepMappings(); out.append(STRfile\STR); out.append(escapeString(name)); out.append(STRcount\STR); out.append(String.valueOf(maxLine + 1)); out.append(STR); (new LineMapper(out)).appendLineMappings(); out.append("\n"); for (int i = 0; i <= maxLine; ++i) { out.append("[]\n"); } out.append("\n"); (new MappingWriter()).appendMappings(out); }
/** * Appends the source map in LavaBug format to the given buffer. * * @param out The stream to which the map will be appended. * @param name The name of the generated source file that this source map * represents. */
Appends the source map in LavaBug format to the given buffer
appendTo
{ "repo_name": "wenzowski/closure-compiler", "path": "src/com/google/debugging/sourcemap/SourceMapGeneratorV1.java", "license": "apache-2.0", "size": 19573 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,510,495
void subscribeTags(final Set<Long> tagIds);
void subscribeTags(final Set<Long> tagIds);
/** * This method handles the subscription of the <code>ClientDataTag</code> to * the <code>JmsProxy</code> and <code>SupervisionManager</code>. * * @param tagIds The ids of the <code>ClientDataTag</code> objects that shall * be subscribed to. */
This method handles the subscription of the <code>ClientDataTag</code> to the <code>JmsProxy</code> and <code>SupervisionManager</code>
subscribeTags
{ "repo_name": "c2mon/c2mon", "path": "c2mon-client/c2mon-client-core/src/main/java/cern/c2mon/client/core/cache/CacheSynchronizer.java", "license": "lgpl-3.0", "size": 4040 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,771,294
WebApplicationService getService();
WebApplicationService getService();
/** * Method to obtain the service for which we are asserting this ticket is * valid for. * * @return the service for which we are asserting this ticket is valid for. */
Method to obtain the service for which we are asserting this ticket is valid for
getService
{ "repo_name": "apereo/cas", "path": "api/cas-server-core-api-validation/src/main/java/org/apereo/cas/validation/Assertion.java", "license": "apache-2.0", "size": 1477 }
[ "org.apereo.cas.authentication.principal.WebApplicationService" ]
import org.apereo.cas.authentication.principal.WebApplicationService;
import org.apereo.cas.authentication.principal.*;
[ "org.apereo.cas" ]
org.apereo.cas;
2,406,059
public final void setSequenceNr(IContext context, Long sequencenr) { getMendixObject().setValue(context, MemberNames.SequenceNr.toString(), sequencenr); }
final void function(IContext context, Long sequencenr) { getMendixObject().setValue(context, MemberNames.SequenceNr.toString(), sequencenr); }
/** * Set value of SequenceNr * @param context * @param sequencenr */
Set value of SequenceNr
setSequenceNr
{ "repo_name": "mrgroen/reCAPTCHA", "path": "test/javasource/restservices/proxies/ChangeItem.java", "license": "apache-2.0", "size": 10446 }
[ "com.mendix.systemwideinterfaces.core.IContext" ]
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.systemwideinterfaces.core.*;
[ "com.mendix.systemwideinterfaces" ]
com.mendix.systemwideinterfaces;
2,238,731
protected boolean sendAccountRegistrationActivationSms(final AccountRegistrationRequest registrationRequest, final String url) { if (StringUtils.isNotBlank(registrationRequest.getPhone())) { val smsProps = casProperties.getAccountRegistration().getSms(); val message = smsProps.getFormattedText(url); return communicationsManager.sms(smsProps.getFrom(), registrationRequest.getPhone(), message); } return false; }
boolean function(final AccountRegistrationRequest registrationRequest, final String url) { if (StringUtils.isNotBlank(registrationRequest.getPhone())) { val smsProps = casProperties.getAccountRegistration().getSms(); val message = smsProps.getFormattedText(url); return communicationsManager.sms(smsProps.getFrom(), registrationRequest.getPhone(), message); } return false; }
/** * Send account registration activation sms. * * @param registrationRequest the registration request * @param url the url * @return the boolean */
Send account registration activation sms
sendAccountRegistrationActivationSms
{ "repo_name": "rkorn86/cas", "path": "support/cas-server-support-account-mgmt/src/main/java/org/apereo/cas/acct/webflow/SubmitAccountRegistrationAction.java", "license": "apache-2.0", "size": 6821 }
[ "org.apache.commons.lang3.StringUtils", "org.apereo.cas.acct.AccountRegistrationRequest" ]
import org.apache.commons.lang3.StringUtils; import org.apereo.cas.acct.AccountRegistrationRequest;
import org.apache.commons.lang3.*; import org.apereo.cas.acct.*;
[ "org.apache.commons", "org.apereo.cas" ]
org.apache.commons; org.apereo.cas;
2,345,893
if(REDIS_COUNTER.getAndIncrement() == 0) { LOG.info("Starting redis..."); try { redisServer = new RedisServer(port); redisServer.start(); } catch (IOException e){ throw new RuntimeException("Unable to start embedded redis", e); } LOG.info("Redis started."); } }
if(REDIS_COUNTER.getAndIncrement() == 0) { LOG.info(STR); try { redisServer = new RedisServer(port); redisServer.start(); } catch (IOException e){ throw new RuntimeException(STR, e); } LOG.info(STR); } }
/** * Starts an embedded redis on the provided port * * @param port The port to start redis on */
Starts an embedded redis on the provided port
start
{ "repo_name": "alexandraorth/grakn", "path": "grakn-test-tools/src/main/java/ai/grakn/util/EmbeddedRedis.java", "license": "gpl-3.0", "size": 2168 }
[ "java.io.IOException", "redis.embedded.RedisServer" ]
import java.io.IOException; import redis.embedded.RedisServer;
import java.io.*; import redis.embedded.*;
[ "java.io", "redis.embedded" ]
java.io; redis.embedded;
1,189,832
long getTagsCount() { return tagsCount; } class IngestJobQueryCallback implements CaseDbAccessManager.CaseDbAccessQueryCallback { private IngestJobStatusType jobStatus = null;
long getTagsCount() { return tagsCount; } class IngestJobQueryCallback implements CaseDbAccessManager.CaseDbAccessQueryCallback { private IngestJobStatusType jobStatus = null;
/** * Get the number of tagged content objects in this DataSource * * @return the tagsCount */
Get the number of tagged content objects in this DataSource
getTagsCount
{ "repo_name": "sleuthkit/autopsy", "path": "Core/src/org/sleuthkit/autopsy/datasourcesummary/ui/DataSourceSummary.java", "license": "apache-2.0", "size": 5962 }
[ "org.sleuthkit.datamodel.CaseDbAccessManager", "org.sleuthkit.datamodel.IngestJobInfo" ]
import org.sleuthkit.datamodel.CaseDbAccessManager; import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.*;
[ "org.sleuthkit.datamodel" ]
org.sleuthkit.datamodel;
1,258,496
@Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Channel.class)) { case EipPackage.CHANNEL__NAME: case EipPackage.CHANNEL__GUARANTEED: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Channel.class)) { case EipPackage.CHANNEL__NAME: case EipPackage.CHANNEL__GUARANTEED: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "lbroudoux/eip-designer", "path": "plugins/com.github.lbroudoux.dsl.eip.edit/src/com/github/lbroudoux/dsl/eip/provider/ChannelItemProvider.java", "license": "apache-2.0", "size": 6675 }
[ "com.github.lbroudoux.dsl.eip.Channel", "com.github.lbroudoux.dsl.eip.EipPackage", "org.eclipse.emf.common.notify.Notification", "org.eclipse.emf.edit.provider.ViewerNotification" ]
import com.github.lbroudoux.dsl.eip.Channel; import com.github.lbroudoux.dsl.eip.EipPackage; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification;
import com.github.lbroudoux.dsl.eip.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*;
[ "com.github.lbroudoux", "org.eclipse.emf" ]
com.github.lbroudoux; org.eclipse.emf;
2,568,766
public static String makeMetaDir(String specDir, String fromChkpt) { return makeMetaDir(new Date(), specDir, fromChkpt); }
static String function(String specDir, String fromChkpt) { return makeMetaDir(new Date(), specDir, fromChkpt); }
/** * The MetaDir is fromChkpt if it is not null. Otherwise, create a * new one based on the current time. * @param specDir the specification directory * @param fromChkpt, path of the checkpoints if recovering, or <code>null</code> * */
The MetaDir is fromChkpt if it is not null. Otherwise, create a new one based on the current time
makeMetaDir
{ "repo_name": "lemmy/tlaplus", "path": "tlatools/org.lamport.tlatools/src/util/FileUtil.java", "license": "mit", "size": 17256 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
803,533
@JsonProperty("notes") public String getNotes() { return notes; }
@JsonProperty("notes") String function() { return notes; }
/** * Notes * <p> * Any notes required to understand or interpret the given statistic. */
Notes Any notes required to understand or interpret the given statistic
getNotes
{ "repo_name": "devgateway/oc-explorer", "path": "persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/Statistic.java", "license": "mit", "size": 7966 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
2,183,537
private static TrieNode buildTrie(Text[] splits, int lower, int upper, Text prefix, int maxDepth) { int depth = prefix.getLength(); if (depth >= maxDepth || lower == upper) { return new LeafTrieNode(depth, splits, lower, upper); } InnerTrieNode result = new InnerTrieNode(depth); Text trial = new Text(prefix); // append an extra byte on to the prefix trial.append(new byte[1], 0, 1); int currentBound = lower; for(int ch = 0; ch < 255; ++ch) { trial.getBytes()[depth] = (byte) (ch + 1); lower = currentBound; while (currentBound < upper) { if (splits[currentBound].compareTo(trial) >= 0) { break; } currentBound += 1; } trial.getBytes()[depth] = (byte) ch; result.child[ch] = buildTrie(splits, lower, currentBound, trial, maxDepth); } // pick up the rest trial.getBytes()[depth] = 127; result.child[255] = buildTrie(splits, currentBound, upper, trial, maxDepth); return result; }
static TrieNode function(Text[] splits, int lower, int upper, Text prefix, int maxDepth) { int depth = prefix.getLength(); if (depth >= maxDepth lower == upper) { return new LeafTrieNode(depth, splits, lower, upper); } InnerTrieNode result = new InnerTrieNode(depth); Text trial = new Text(prefix); trial.append(new byte[1], 0, 1); int currentBound = lower; for(int ch = 0; ch < 255; ++ch) { trial.getBytes()[depth] = (byte) (ch + 1); lower = currentBound; while (currentBound < upper) { if (splits[currentBound].compareTo(trial) >= 0) { break; } currentBound += 1; } trial.getBytes()[depth] = (byte) ch; result.child[ch] = buildTrie(splits, lower, currentBound, trial, maxDepth); } trial.getBytes()[depth] = 127; result.child[255] = buildTrie(splits, currentBound, upper, trial, maxDepth); return result; }
/** * Given a sorted set of cut points, build a trie that will find the correct * partition quickly. * @param splits the list of cut points * @param lower the lower bound of partitions 0..numPartitions-1 * @param upper the upper bound of partitions 0..numPartitions-1 * @param prefix the prefix that we have already checked against * @param maxDepth the maximum depth we will build a trie for * @return the trie node that will divide the splits correctly */
Given a sorted set of cut points, build a trie that will find the correct partition quickly
buildTrie
{ "repo_name": "hanhlh/hadoop-0.20.2_FatBTree", "path": "src/examples/org/apache/hadoop/examples/terasort/TeraSort.java", "license": "apache-2.0", "size": 8906 }
[ "org.apache.hadoop.io.Text" ]
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,304,242
//public void publish(String pid, String publishCode) throws ValidateException; public void publish(FedoraObject fedoraObject, PublishLocation publishLocation) throws ValidateException;
void function(FedoraObject fedoraObject, PublishLocation publishLocation) throws ValidateException;
/** * publish * * Placeholder * * <pre> * Version Date Developer Description * 0.1 15/05/2012 Genevieve Turner (GT) Initial build * 0.5 28/03/2013 Genevieve Turner(GT) Updated the paremeters * </pre> * * @param fedoraObject The fedora object to publish * @param publishLocation The location to publish to * @throws ValidateException */
publish Placeholder <code> Version Date Developer Description 0.1 15/05/2012 Genevieve Turner (GT) Initial build 0.5 28/03/2013 Genevieve Turner(GT) Updated the paremeters </code>
publish
{ "repo_name": "anu-doi/anudc", "path": "DataCommons/src/main/java/au/edu/anu/datacommons/publish/Publish.java", "license": "gpl-3.0", "size": 3775 }
[ "au.edu.anu.datacommons.data.db.model.FedoraObject", "au.edu.anu.datacommons.data.db.model.PublishLocation", "au.edu.anu.datacommons.exception.ValidateException" ]
import au.edu.anu.datacommons.data.db.model.FedoraObject; import au.edu.anu.datacommons.data.db.model.PublishLocation; import au.edu.anu.datacommons.exception.ValidateException;
import au.edu.anu.datacommons.data.db.model.*; import au.edu.anu.datacommons.exception.*;
[ "au.edu.anu" ]
au.edu.anu;
2,565,956
public static Test territoryCollatedCaseInsensitiveDatabase(Test test, final String locale) { Properties attributes = new Properties(); attributes.setProperty("collation", "TERRITORY_BASED:SECONDARY"); if (locale != null) attributes.setProperty("territory", locale); return attributesDatabase(attributes, test); }
static Test function(Test test, final String locale) { Properties attributes = new Properties(); attributes.setProperty(STR, STR); if (locale != null) attributes.setProperty(STR, locale); return attributesDatabase(attributes, test); }
/** * Decorate a set of tests to use an single * use database with TERRITORY_BASED:SECONDARY collation * set to the passed in locale. * @param locale Locale used to set territory JDBC attribute. If null * then only collation=TERRITORY_BASED:SECONDARY will be set. */
Decorate a set of tests to use an single set to the passed in locale
territoryCollatedCaseInsensitiveDatabase
{ "repo_name": "scnakandala/derby", "path": "java/testing/org/apache/derbyTesting/junit/Decorator.java", "license": "apache-2.0", "size": 7788 }
[ "java.util.Properties", "junit.framework.Test" ]
import java.util.Properties; import junit.framework.Test;
import java.util.*; import junit.framework.*;
[ "java.util", "junit.framework" ]
java.util; junit.framework;
431,667
private static void d_uacmxx( double[] a, double[] c, int m, int n, double init, Builtin builtin, int rl, int ru ) { //init output (base for incremental agg) Arrays.fill(c, init); //execute builtin aggregate for( int i=rl, aix=rl*n; i<ru; i++, aix+=n ) builtinAgg( a, c, aix, n, builtin ); }
static void function( double[] a, double[] c, int m, int n, double init, Builtin builtin, int rl, int ru ) { Arrays.fill(c, init); for( int i=rl, aix=rl*n; i<ru; i++, aix+=n ) builtinAgg( a, c, aix, n, builtin ); }
/** * COLMIN/COLMAX, opcode: uacmin/uacmax, dense input. * * @param a * @param c * @param m * @param n * @param builtin */
COLMIN/COLMAX, opcode: uacmin/uacmax, dense input
d_uacmxx
{ "repo_name": "Myasuka/systemml", "path": "system-ml/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixAgg.java", "license": "apache-2.0", "size": 77315 }
[ "com.ibm.bi.dml.runtime.functionobjects.Builtin", "java.util.Arrays" ]
import com.ibm.bi.dml.runtime.functionobjects.Builtin; import java.util.Arrays;
import com.ibm.bi.dml.runtime.functionobjects.*; import java.util.*;
[ "com.ibm.bi", "java.util" ]
com.ibm.bi; java.util;
947,158
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<DeploymentExtendedInner> listAtScopeAsync(String scope);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<DeploymentExtendedInner> listAtScopeAsync(String scope);
/** * Get all the deployments at the given scope. * * @param scope The resource scope. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all the deployments at the given scope as paginated response with {@link PagedFlux}. */
Get all the deployments at the given scope
listAtScopeAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/DeploymentsClient.java", "license": "mit", "size": 218889 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.resources.fluent.models.DeploymentExtendedInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.resources.fluent.models.DeploymentExtendedInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.resources.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
217,430
final FileObject scratchFolder = getWriteFolder(); // Make sure the test folder is empty scratchFolder.delete(Selectors.EXCLUDE_SELF); scratchFolder.createFolder(); return scratchFolder; }
final FileObject scratchFolder = getWriteFolder(); scratchFolder.delete(Selectors.EXCLUDE_SELF); scratchFolder.createFolder(); return scratchFolder; }
/** * Sets up a scratch folder for the test to use. */
Sets up a scratch folder for the test to use
createScratchFolder
{ "repo_name": "apache/commons-vfs", "path": "commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java", "license": "apache-2.0", "size": 7019 }
[ "org.apache.commons.vfs2.FileObject", "org.apache.commons.vfs2.Selectors" ]
import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.Selectors;
import org.apache.commons.vfs2.*;
[ "org.apache.commons" ]
org.apache.commons;
1,092,779
@Test public void testGetColumnIndex() { TaskSeriesCollection c = createCollection1(); assertEquals(0, c.getColumnIndex("Task 1")); assertEquals(1, c.getColumnIndex("Task 2")); assertEquals(2, c.getColumnIndex("Task 3")); }
void function() { TaskSeriesCollection c = createCollection1(); assertEquals(0, c.getColumnIndex(STR)); assertEquals(1, c.getColumnIndex(STR)); assertEquals(2, c.getColumnIndex(STR)); }
/** * Some tests for the getColumnIndex() method. */
Some tests for the getColumnIndex() method
testGetColumnIndex
{ "repo_name": "akardapolov/ASH-Viewer", "path": "jfreechart-fse/src/test/java/org/jfree/data/gantt/TaskSeriesCollectionTest.java", "license": "gpl-3.0", "size": 23526 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,740,426
public VariableMap permuteVariables(int[] perms) { VariableMap result = new VariableMap(); String[] names = this.getNameArray(); Iterator<String> iter = this.keySet().iterator(); int idisp = 0; while (iter.hasNext()) { String key = iter.next(); int index = perms[idisp]; result.put(key, names[index]); idisp ++; } // while iter return result; } // permuteVariables
VariableMap function(int[] perms) { VariableMap result = new VariableMap(); String[] names = this.getNameArray(); Iterator<String> iter = this.keySet().iterator(); int idisp = 0; while (iter.hasNext()) { String key = iter.next(); int index = perms[idisp]; result.put(key, names[index]); idisp ++; } return result; }
/** Gets a map to permuted variable names * @param perms indexes for permutation of variable names * of the keys = variable names. * @return a new {@link VariableMap} with the variables mapped to some permutation */
Gets a map to permuted variable names
permuteVariables
{ "repo_name": "gfis/ramath", "path": "src/main/java/org/teherba/ramath/symbolic/VariableMap.java", "license": "apache-2.0", "size": 21964 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,732,492
public void saveToRepository(RepositoryAttributeInterface attributeInterface) throws KettleException;
void function(RepositoryAttributeInterface attributeInterface) throws KettleException;
/** * Saves the log table to a repository. * @param attributeInterface The attribute interface used to store the attributes */
Saves the log table to a repository
saveToRepository
{ "repo_name": "dianhu/Kettle-Research", "path": "src-db/org/pentaho/di/core/logging/LogTableInterface.java", "license": "lgpl-2.1", "size": 4096 }
[ "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.repository.RepositoryAttributeInterface" ]
import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.RepositoryAttributeInterface;
import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*;
[ "org.pentaho.di" ]
org.pentaho.di;
303,131
public void finish(int maxDeterminizedStates) { Automaton automaton = builder.finish(); // System.out.println("before det:\n" + automaton.toDot()); Transition t = new Transition(); // TODO: should we add "eps back to initial node" for all states, // and det that? then we don't need to revisit initial node at // every position? but automaton could blow up? And, this makes it // harder to skip useless positions at search time? if (anyTermID != -1) { // Make sure there are no leading or trailing ANY: int count = automaton.initTransition(0, t); for(int i=0;i<count;i++) { automaton.getNextTransition(t); if (anyTermID >= t.min && anyTermID <= t.max) { throw new IllegalStateException("automaton cannot lead with an ANY transition"); } } int numStates = automaton.getNumStates(); for(int i=0;i<numStates;i++) { count = automaton.initTransition(i, t); for(int j=0;j<count;j++) { automaton.getNextTransition(t); if (automaton.isAccept(t.dest) && anyTermID >= t.min && anyTermID <= t.max) { throw new IllegalStateException("automaton cannot end with an ANY transition"); } } } int termCount = termToID.size(); // We have to carefully translate these transitions so automaton // realizes they also match all other terms: Automaton newAutomaton = new Automaton(); for(int i=0;i<numStates;i++) { newAutomaton.createState(); newAutomaton.setAccept(i, automaton.isAccept(i)); } for(int i=0;i<numStates;i++) { count = automaton.initTransition(i, t); for(int j=0;j<count;j++) { automaton.getNextTransition(t); int min, max; if (t.min <= anyTermID && anyTermID <= t.max) { // Match any term min = 0; max = termCount-1; } else { min = t.min; max = t.max; } newAutomaton.addTransition(t.source, t.dest, min, max); } } newAutomaton.finishState(); automaton = newAutomaton; } det = Operations.removeDeadStates(Operations.determinize(automaton, maxDeterminizedStates)); }
void function(int maxDeterminizedStates) { Automaton automaton = builder.finish(); Transition t = new Transition(); if (anyTermID != -1) { int count = automaton.initTransition(0, t); for(int i=0;i<count;i++) { automaton.getNextTransition(t); if (anyTermID >= t.min && anyTermID <= t.max) { throw new IllegalStateException(STR); } } int numStates = automaton.getNumStates(); for(int i=0;i<numStates;i++) { count = automaton.initTransition(i, t); for(int j=0;j<count;j++) { automaton.getNextTransition(t); if (automaton.isAccept(t.dest) && anyTermID >= t.min && anyTermID <= t.max) { throw new IllegalStateException(STR); } } } int termCount = termToID.size(); Automaton newAutomaton = new Automaton(); for(int i=0;i<numStates;i++) { newAutomaton.createState(); newAutomaton.setAccept(i, automaton.isAccept(i)); } for(int i=0;i<numStates;i++) { count = automaton.initTransition(i, t); for(int j=0;j<count;j++) { automaton.getNextTransition(t); int min, max; if (t.min <= anyTermID && anyTermID <= t.max) { min = 0; max = termCount-1; } else { min = t.min; max = t.max; } newAutomaton.addTransition(t.source, t.dest, min, max); } } newAutomaton.finishState(); automaton = newAutomaton; } det = Operations.removeDeadStates(Operations.determinize(automaton, maxDeterminizedStates)); }
/** * Call this once you are done adding states/transitions. * @param maxDeterminizedStates Maximum number of states created when * determinizing the automaton. Higher numbers allow this operation to * consume more memory but allow more complex automatons. */
Call this once you are done adding states/transitions
finish
{ "repo_name": "q474818917/solr-5.2.0", "path": "lucene/sandbox/src/java/org/apache/lucene/search/TermAutomatonQuery.java", "license": "apache-2.0", "size": 14179 }
[ "org.apache.lucene.util.automaton.Automaton", "org.apache.lucene.util.automaton.Operations", "org.apache.lucene.util.automaton.Transition" ]
import org.apache.lucene.util.automaton.Automaton; import org.apache.lucene.util.automaton.Operations; import org.apache.lucene.util.automaton.Transition;
import org.apache.lucene.util.automaton.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,210,455
public RemoteMethodControl newMainProxy(Object impl) { TestClassLoader cl = new TestClassLoader(); InvocationHandler ih = new InvHandler(impl); return (RemoteMethodControl) ProxyTrustUtil.newProxyInstance(impl, ih, cl); }
RemoteMethodControl function(Object impl) { TestClassLoader cl = new TestClassLoader(); InvocationHandler ih = new InvHandler(impl); return (RemoteMethodControl) ProxyTrustUtil.newProxyInstance(impl, ih, cl); }
/** * Creates main proxy. * * @param impl * @return proxy created */
Creates main proxy
newMainProxy
{ "repo_name": "pfirmstone/JGDMS", "path": "qa/src/org/apache/river/test/spec/security/proxytrust/util/AbstractTestBase.java", "license": "apache-2.0", "size": 26594 }
[ "java.lang.reflect.InvocationHandler", "net.jini.core.constraint.RemoteMethodControl" ]
import java.lang.reflect.InvocationHandler; import net.jini.core.constraint.RemoteMethodControl;
import java.lang.reflect.*; import net.jini.core.constraint.*;
[ "java.lang", "net.jini.core" ]
java.lang; net.jini.core;
579,142
public List<HybridConnectionInner> hybridConnectionsV2() { return this.hybridConnectionsV2; }
List<HybridConnectionInner> function() { return this.hybridConnectionsV2; }
/** * Get the hybridConnectionsV2 property: The Hybrid Connection V2 (Service Bus) view. * * @return the hybridConnectionsV2 value. */
Get the hybridConnectionsV2 property: The Hybrid Connection V2 (Service Bus) view
hybridConnectionsV2
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/fluent/models/NetworkFeaturesInner.java", "license": "mit", "size": 3282 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,569,199
EReference getTypeResult_T7();
EReference getTypeResult_T7();
/** * Returns the meta object for the containment reference '{@link com.euclideanspace.spad.editor.TypeResult#getT7 <em>T7</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>T7</em>'. * @see com.euclideanspace.spad.editor.TypeResult#getT7() * @see #getTypeResult() * @generated */
Returns the meta object for the containment reference '<code>com.euclideanspace.spad.editor.TypeResult#getT7 T7</code>'.
getTypeResult_T7
{ "repo_name": "martinbaker/euclideanspace", "path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java", "license": "agpl-3.0", "size": 593321 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,228,655
protected Path getLinkTarget(final Path f) throws IOException { throw new AssertionError(); }
Path function(final Path f) throws IOException { throw new AssertionError(); }
/** * The specification of this method matches that of * {@link FileContext#getLinkTarget(Path)}; */
The specification of this method matches that of <code>FileContext#getLinkTarget(Path)</code>
getLinkTarget
{ "repo_name": "ekoontz/hadoop-common", "path": "src/java/org/apache/hadoop/fs/AbstractFileSystem.java", "license": "apache-2.0", "size": 29476 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
368,975
void updateTeTopology(TeTopology teTopology);
void updateTeTopology(TeTopology teTopology);
/** * Creates or updates a TE topology. * * @param teTopology value of the TE topology to be updated */
Creates or updates a TE topology
updateTeTopology
{ "repo_name": "y-higuchi/onos", "path": "apps/tetopology/app/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyStore.java", "license": "apache-2.0", "size": 8169 }
[ "org.onosproject.tetopology.management.api.TeTopology" ]
import org.onosproject.tetopology.management.api.TeTopology;
import org.onosproject.tetopology.management.api.*;
[ "org.onosproject.tetopology" ]
org.onosproject.tetopology;
496,686
@ManyToOne(cascade = {}, fetch = FetchType.LAZY) @JoinColumn(name = "LoanID", unique = false, nullable = false, insertable = true, updatable = true) public Loan getLoan() { return this.loan; }
@ManyToOne(cascade = {}, fetch = FetchType.LAZY) @JoinColumn(name = STR, unique = false, nullable = false, insertable = true, updatable = true) Loan function() { return this.loan; }
/** * * ID of loan agent at AgentID played a role in */
ID of loan agent at AgentID played a role in
getLoan
{ "repo_name": "specify/specify6", "path": "src/edu/ku/brc/specify/datamodel/LoanAgent.java", "license": "gpl-2.0", "size": 5586 }
[ "javax.persistence.FetchType", "javax.persistence.JoinColumn", "javax.persistence.ManyToOne" ]
import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
752,907
PagedIterable<DedicatedCapacity> listByResourceGroup(String resourceGroupName, Context context);
PagedIterable<DedicatedCapacity> listByResourceGroup(String resourceGroupName, Context context);
/** * Gets all the Dedicated capacities for the given resource group. * * @param resourceGroupName The name of the Azure Resource group of which a given PowerBIDedicated capacity is part. * This name must be at least 1 character in length, and no more than 90. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all the Dedicated capacities for the given resource group. */
Gets all the Dedicated capacities for the given resource group
listByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/src/main/java/com/azure/resourcemanager/powerbidedicated/models/Capacities.java", "license": "mit", "size": 17073 }
[ "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context" ]
import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context;
import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,232,789
public void saveThingsToDo(PracticeDto practice);
void function(PracticeDto practice);
/** * Save the practice's things to do elements * * @param practice */
Save the practice's things to do elements
saveThingsToDo
{ "repo_name": "dads-software-brotherhood/sekc", "path": "src/main/java/mx/infotec/dads/sekc/admin/practice/service/PracticeHelperService.java", "license": "apache-2.0", "size": 1687 }
[ "mx.infotec.dads.sekc.admin.practice.dto.PracticeDto" ]
import mx.infotec.dads.sekc.admin.practice.dto.PracticeDto;
import mx.infotec.dads.sekc.admin.practice.dto.*;
[ "mx.infotec.dads" ]
mx.infotec.dads;
678,221
public IgniteInternalFuture<TxDeadlock> detectDeadlock( IgniteInternalTx tx, Set<IgniteTxKey> keys ) { return txDeadlockDetection.detectDeadlock(tx, keys); }
IgniteInternalFuture<TxDeadlock> function( IgniteInternalTx tx, Set<IgniteTxKey> keys ) { return txDeadlockDetection.detectDeadlock(tx, keys); }
/** * Performs deadlock detection for given keys. * * @param tx Target tx. * @param keys Keys. * @return Detection result. */
Performs deadlock detection for given keys
detectDeadlock
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java", "license": "apache-2.0", "size": 141099 }
[ "java.util.Set", "org.apache.ignite.internal.IgniteInternalFuture" ]
import java.util.Set; import org.apache.ignite.internal.IgniteInternalFuture;
import java.util.*; import org.apache.ignite.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,160,479
@Override public void clearExceptionInThreads() { exceptionInThreads = false; LoggingUncaughtExceptionHandler.clearUncaughtExceptionsCount(); }
void function() { exceptionInThreads = false; LoggingUncaughtExceptionHandler.clearUncaughtExceptionsCount(); }
/** * Clears the boolean that determines whether or not an exception occurred in one of the worker * threads. This method should be used for testing purposes only! */
Clears the boolean that determines whether or not an exception occurred in one of the worker threads. This method should be used for testing purposes only
clearExceptionInThreads
{ "repo_name": "davebarnes97/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java", "license": "apache-2.0", "size": 93878 }
[ "org.apache.geode.logging.internal.executors.LoggingUncaughtExceptionHandler" ]
import org.apache.geode.logging.internal.executors.LoggingUncaughtExceptionHandler;
import org.apache.geode.logging.internal.executors.*;
[ "org.apache.geode" ]
org.apache.geode;
2,724,647
public void testDescendingCeiling() { NavigableSet q = dset5(); Object e1 = q.ceiling(m3); assertEquals(m3, e1); Object e2 = q.ceiling(zero); assertEquals(m1, e2); Object e3 = q.ceiling(m5); assertEquals(m5, e3); Object e4 = q.ceiling(m6); assertNull(e4); }
void function() { NavigableSet q = dset5(); Object e1 = q.ceiling(m3); assertEquals(m3, e1); Object e2 = q.ceiling(zero); assertEquals(m1, e2); Object e3 = q.ceiling(m5); assertEquals(m5, e3); Object e4 = q.ceiling(m6); assertNull(e4); }
/** * ceiling returns next element */
ceiling returns next element
testDescendingCeiling
{ "repo_name": "debian-pkg-android-tools/android-platform-libcore", "path": "jsr166-tests/src/test/java/jsr166/TreeSubSetTest.java", "license": "gpl-2.0", "size": 30800 }
[ "java.util.NavigableSet" ]
import java.util.NavigableSet;
import java.util.*;
[ "java.util" ]
java.util;
2,396,974
private void createGUI () throws IOException { // Set title setTitle (TITLE); // Create menu setJMenuBar(getMenu()); // Create main panel getContentPane().add (getMainPanel (), BorderLayout.CENTER); pack(); setSize(800, 300); Dimension size = getSize(); Dimension screenSize = getToolkit().getScreenSize(); Point p = new Point ( (int)(screenSize.getWidth() / 2 - size.getWidth() / 2), (int)(screenSize.getHeight() / 2 - size.getHeight() / 2)); setLocation (p.x, p.y); setVisible (true); }
void function () throws IOException { setTitle (TITLE); setJMenuBar(getMenu()); getContentPane().add (getMainPanel (), BorderLayout.CENTER); pack(); setSize(800, 300); Dimension size = getSize(); Dimension screenSize = getToolkit().getScreenSize(); Point p = new Point ( (int)(screenSize.getWidth() / 2 - size.getWidth() / 2), (int)(screenSize.getHeight() / 2 - size.getHeight() / 2)); setLocation (p.x, p.y); setVisible (true); }
/** * Create GUI items. */
Create GUI items
createGUI
{ "repo_name": "lsilvestre/Jogre", "path": "util/src/org/jogre/properties/JogrePropertiesEditor.java", "license": "gpl-2.0", "size": 10185 }
[ "java.awt.BorderLayout", "java.awt.Dimension", "java.awt.Point", "java.io.IOException" ]
import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; import java.io.IOException;
import java.awt.*; import java.io.*;
[ "java.awt", "java.io" ]
java.awt; java.io;
2,284,720
@Endpoint( describeByClass = true ) public static <T extends TType> CollectivePermute<T> create(Scope scope, Operand<T> input, Operand<TInt32> sourceTargetPairs) { OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectivePermute"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(sourceTargetPairs.asOutput()); return new CollectivePermute<>(opBuilder.build()); }
@Endpoint( describeByClass = true ) static <T extends TType> CollectivePermute<T> function(Scope scope, Operand<T> input, Operand<TInt32> sourceTargetPairs) { OperationBuilder opBuilder = scope.opBuilder(OP_NAME, STR); opBuilder.addInput(input.asOutput()); opBuilder.addInput(sourceTargetPairs.asOutput()); return new CollectivePermute<>(opBuilder.build()); }
/** * Factory method to create a class wrapping a new CollectivePermute operation. * * @param scope current scope * @param input The local input to be permuted. Currently only supports float and * bfloat16. * @param sourceTargetPairs A tensor with shape [num_pairs, 2]. * @param <T> data type for {@code CollectivePermute} output and operands * @return a new instance of CollectivePermute */
Factory method to create a class wrapping a new CollectivePermute operation
create
{ "repo_name": "tensorflow/java", "path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectivePermute.java", "license": "apache-2.0", "size": 4031 }
[ "org.tensorflow.Operand", "org.tensorflow.OperationBuilder", "org.tensorflow.op.Scope", "org.tensorflow.op.annotation.Endpoint", "org.tensorflow.types.TInt32", "org.tensorflow.types.family.TType" ]
import org.tensorflow.Operand; import org.tensorflow.OperationBuilder; import org.tensorflow.op.Scope; import org.tensorflow.op.annotation.Endpoint; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType;
import org.tensorflow.*; import org.tensorflow.op.*; import org.tensorflow.op.annotation.*; import org.tensorflow.types.*; import org.tensorflow.types.family.*;
[ "org.tensorflow", "org.tensorflow.op", "org.tensorflow.types" ]
org.tensorflow; org.tensorflow.op; org.tensorflow.types;
2,781,442
public void layoutContainer (Container parent) { Insets insets = parent.getInsets(); // int width = insets.left; int height = insets.top; // We need to layout if (needLayout(parent)) { int x = 5; int y = 5; // Go through all components for (int i = 0; i < parent.getComponentCount(); i++) { Component comp = parent.getComponent(i); if (comp.isVisible() && comp instanceof WFNode) { Dimension ps = comp.getPreferredSize(); comp.setLocation(x, y); comp.setBounds(x, y, ps.width, ps.height); // width = x + ps.width; height = y + ps.height; // next pos if (x == 5) x = 230; else { x = 5; y += 100; } // x += ps.width-20; // y += ps.height+20; } } } else // we have an Layout { // Go through all components for (int i = 0; i < parent.getComponentCount(); i++) { Component comp = parent.getComponent(i); if (comp.isVisible() && comp instanceof WFNode) { Dimension ps = comp.getPreferredSize(); Point loc = comp.getLocation(); int maxWidth = comp.getX() + ps.width; int maxHeight = comp.getY() + ps.height; if (width < maxWidth) width = maxWidth; if (height < maxHeight) height = maxHeight; comp.setBounds(loc.x, loc.y, ps.width, ps.height); } } // for all components } // have layout // Create Lines WFContentPanel panel = (WFContentPanel)parent; panel.createLines(); // Calculate size width += insets.right; height += insets.bottom; // return size m_size = new Dimension(width, height); log.finer("Size=" + m_size); } // layoutContainer
void function (Container parent) { Insets insets = parent.getInsets(); int width = insets.left; int height = insets.top; if (needLayout(parent)) { int x = 5; int y = 5; for (int i = 0; i < parent.getComponentCount(); i++) { Component comp = parent.getComponent(i); if (comp.isVisible() && comp instanceof WFNode) { Dimension ps = comp.getPreferredSize(); comp.setLocation(x, y); comp.setBounds(x, y, ps.width, ps.height); width = x + ps.width; height = y + ps.height; if (x == 5) x = 230; else { x = 5; y += 100; } } } } else { for (int i = 0; i < parent.getComponentCount(); i++) { Component comp = parent.getComponent(i); if (comp.isVisible() && comp instanceof WFNode) { Dimension ps = comp.getPreferredSize(); Point loc = comp.getLocation(); int maxWidth = comp.getX() + ps.width; int maxHeight = comp.getY() + ps.height; if (width < maxWidth) width = maxWidth; if (height < maxHeight) height = maxHeight; comp.setBounds(loc.x, loc.y, ps.width, ps.height); } } } WFContentPanel panel = (WFContentPanel)parent; panel.createLines(); width += insets.right; height += insets.bottom; m_size = new Dimension(width, height); log.finer("Size=" + m_size); }
/************************************************************************** * Lays out the specified container. * @param parent the container to be laid out * @see java.awt.LayoutManager#layoutContainer(Container) */
Lays out the specified container
layoutContainer
{ "repo_name": "neuroidss/adempiere", "path": "client/src/org/compiere/apps/wf/WFLayoutManager.java", "license": "gpl-2.0", "size": 6252 }
[ "java.awt.Component", "java.awt.Container", "java.awt.Dimension", "java.awt.Insets", "java.awt.Point" ]
import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,573,327
public List<String> getAvailableActions(String orderId) throws Exception { MozuClient<List<String>> client = com.mozu.api.clients.commerce.OrderClient.getAvailableActionsClient( orderId); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
List<String> function(String orderId) throws Exception { MozuClient<List<String>> client = com.mozu.api.clients.commerce.OrderClient.getAvailableActionsClient( orderId); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
/** * * <p><pre><code> * Order order = new Order(); * string string = order.getAvailableActions( orderId); * </code></pre></p> * @param orderId Unique identifier of the order. * @return List<string> * @see string */
<code><code> Order order = new Order(); string string = order.getAvailableActions( orderId); </code></code>
getAvailableActions
{ "repo_name": "Mozu/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/resources/commerce/OrderResource.java", "license": "mit", "size": 27247 }
[ "com.mozu.api.MozuClient", "java.util.List" ]
import com.mozu.api.MozuClient; import java.util.List;
import com.mozu.api.*; import java.util.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
880,688
public synchronized InternetHeaders fetchHeaders(int sequenceNumber, String part) throws MessagingException { IMAPCommand command = new IMAPCommand("FETCH"); command.appendInteger(sequenceNumber); command.startList(); command.appendAtom("BODY.PEEK"); command.appendBodySection(part, "HEADER"); command.endList(); // we want all of the envelope information about the message, which involves multiple FETCH chunks. sendCommand(command); IMAPInternetHeader header = (IMAPInternetHeader)extractFetchDataItem(sequenceNumber, IMAPFetchDataItem.HEADER); if (header == null) { throw new MessagingException("No HEADER information received from IMAP server"); } // and return the body structure directly. return header.headers; }
synchronized InternetHeaders function(int sequenceNumber, String part) throws MessagingException { IMAPCommand command = new IMAPCommand("FETCH"); command.appendInteger(sequenceNumber); command.startList(); command.appendAtom(STR); command.appendBodySection(part, STR); command.endList(); sendCommand(command); IMAPInternetHeader header = (IMAPInternetHeader)extractFetchDataItem(sequenceNumber, IMAPFetchDataItem.HEADER); if (header == null) { throw new MessagingException(STR); } return header.headers; }
/** * Issue a FETCH command to retrieve the message RFC822.HEADERS structure containing the message headers (using PEEK). * * @param sequenceNumber The sequence number of the message. * * @return The IMAPRFC822Headers item for the message. * All other untagged responses are queued for processing. */
Issue a FETCH command to retrieve the message RFC822.HEADERS structure containing the message headers (using PEEK)
fetchHeaders
{ "repo_name": "apache/geronimo-javamail", "path": "geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPConnection.java", "license": "apache-2.0", "size": 75320 }
[ "javax.mail.MessagingException", "javax.mail.internet.InternetHeaders" ]
import javax.mail.MessagingException; import javax.mail.internet.InternetHeaders;
import javax.mail.*; import javax.mail.internet.*;
[ "javax.mail" ]
javax.mail;
557,998
public static void loadTestResults(InputStream reader, ResultCollectorHelper resultCollectorHelper) throws IOException { // Get the InputReader to use InputStreamReader inputStreamReader = getInputStreamReader(reader); DataHolder dh = JTLSAVER.newDataHolder(); dh.put(RESULTCOLLECTOR_HELPER_OBJECT, resultCollectorHelper); // Allow TestResultWrapper to feed back the samples // This is effectively the same as saver.fromXML(InputStream) except we get to provide the DataHolder // Don't know why there is no method for this in the XStream class JTLSAVER.unmarshal(new XppDriver().createReader(reader), null, dh); inputStreamReader.close(); }
static void function(InputStream reader, ResultCollectorHelper resultCollectorHelper) throws IOException { InputStreamReader inputStreamReader = getInputStreamReader(reader); DataHolder dh = JTLSAVER.newDataHolder(); dh.put(RESULTCOLLECTOR_HELPER_OBJECT, resultCollectorHelper); JTLSAVER.unmarshal(new XppDriver().createReader(reader), null, dh); inputStreamReader.close(); }
/** * Read results from JTL file. * * @param reader of the file * @param resultCollectorHelper helper class to enable TestResultWrapperConverter to deliver the samples * @throws IOException */
Read results from JTL file
loadTestResults
{ "repo_name": "saketh7/Jmeter", "path": "src/core/org/apache/jmeter/save/SaveService.java", "license": "apache-2.0", "size": 28164 }
[ "com.thoughtworks.xstream.converters.DataHolder", "com.thoughtworks.xstream.io.xml.XppDriver", "java.io.IOException", "java.io.InputStream", "java.io.InputStreamReader", "org.apache.jmeter.reporters.ResultCollectorHelper" ]
import com.thoughtworks.xstream.converters.DataHolder; import com.thoughtworks.xstream.io.xml.XppDriver; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.jmeter.reporters.ResultCollectorHelper;
import com.thoughtworks.xstream.converters.*; import com.thoughtworks.xstream.io.xml.*; import java.io.*; import org.apache.jmeter.reporters.*;
[ "com.thoughtworks.xstream", "java.io", "org.apache.jmeter" ]
com.thoughtworks.xstream; java.io; org.apache.jmeter;
1,730,179
Object conditionalCopy(Object o) { if (isCopyOnRead() && !Token.isInvalid(o)) { return CopyHelper.copy(o); } return o; } private final String fullPath;
Object conditionalCopy(Object o) { if (isCopyOnRead() && !Token.isInvalid(o)) { return CopyHelper.copy(o); } return o; } private final String fullPath;
/** * Makes a copy, if copy-on-get is enabled, of the specified object. * * @since GemFire 4.0 */
Makes a copy, if copy-on-get is enabled, of the specified object
conditionalCopy
{ "repo_name": "davebarnes97/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java", "license": "apache-2.0", "size": 394235 }
[ "org.apache.geode.CopyHelper" ]
import org.apache.geode.CopyHelper;
import org.apache.geode.*;
[ "org.apache.geode" ]
org.apache.geode;
1,785,458
public String toString() { GsonBuilder gbuilder = new GsonBuilder(); Gson gson = gbuilder.setPrettyPrinting().create(); return gson.toJson(this); }
String function() { GsonBuilder gbuilder = new GsonBuilder(); Gson gson = gbuilder.setPrettyPrinting().create(); return gson.toJson(this); }
/** * print out as a json file */
print out as a json file
toString
{ "repo_name": "jravila08/PBPParser", "path": "src/player/PlayerStats.java", "license": "apache-2.0", "size": 3558 }
[ "com.google.gson.Gson", "com.google.gson.GsonBuilder" ]
import com.google.gson.Gson; import com.google.gson.GsonBuilder;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
2,342,947
public static void assertServiceUnavailable(String message, String className, long timeout, TimeUnit timeUnit) { assertThat("Class name is null", className, notNullValue()); assertThat("TimeUnit is null", timeUnit, notNullValue()); //noinspection unchecked Object service = getService(getBundleContext(), className, timeout, timeUnit); assertThat(message, service, nullValue()); }
static void function(String message, String className, long timeout, TimeUnit timeUnit) { assertThat(STR, className, notNullValue()); assertThat(STR, timeUnit, notNullValue()); Object service = getService(getBundleContext(), className, timeout, timeUnit); assertThat(message, service, nullValue()); }
/** * Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected * {@link AssertionError} is thrown with the given message * * @param message message * @param className service class name * @param timeout time interval in milliseconds to wait. If zero, the method will wait indefinitely. * @param timeUnit timeout time unit * @since 1.0 */
Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected <code>AssertionError</code> is thrown with the given message
assertServiceUnavailable
{ "repo_name": "dpishchukhin/org.knowhowlab.osgi.testing", "path": "org.knowhowlab.osgi.testing.assertions/src/main/java/org/knowhowlab/osgi/testing/assertions/ServiceAssert.java", "license": "apache-2.0", "size": 42585 }
[ "java.util.concurrent.TimeUnit", "org.hamcrest.CoreMatchers", "org.hamcrest.MatcherAssert", "org.knowhowlab.osgi.testing.utils.ServiceUtils" ]
import java.util.concurrent.TimeUnit; import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.knowhowlab.osgi.testing.utils.ServiceUtils;
import java.util.concurrent.*; import org.hamcrest.*; import org.knowhowlab.osgi.testing.utils.*;
[ "java.util", "org.hamcrest", "org.knowhowlab.osgi" ]
java.util; org.hamcrest; org.knowhowlab.osgi;
2,203,884
public static void renameExport() { EditWindow wnd = EditWindow.getCurrent(); Highlight h = wnd.getHighlighter().getOneHighlight(); if (h == null || h.getVarKey() != Export.EXPORT_NAME || !(h.getElectricObject() instanceof Export)) { System.out.println("Must select an export name before renaming it"); return; } Export pp = (Export)h.getElectricObject(); String response = JOptionPane.showInputDialog(Main.getCurrentJFrame(), "Rename export", pp.getName()); if (response == null) return; new RenameExport(pp, response); } public static class RenameExport extends Job { private Export pp; private String newName; public RenameExport(Export pp, String newName) { super("Rename Export" + pp.getName(), User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.pp = pp; this.newName = newName; startJob(); }
static void function() { EditWindow wnd = EditWindow.getCurrent(); Highlight h = wnd.getHighlighter().getOneHighlight(); if (h == null h.getVarKey() != Export.EXPORT_NAME !(h.getElectricObject() instanceof Export)) { System.out.println(STR); return; } Export pp = (Export)h.getElectricObject(); String response = JOptionPane.showInputDialog(Main.getCurrentJFrame(), STR, pp.getName()); if (response == null) return; new RenameExport(pp, response); } public static class RenameExport extends Job { private Export pp; private String newName; public RenameExport(Export pp, String newName) { super(STR + pp.getName(), User.getUserTool(), Job.Type.CHANGE, null, null, Job.Priority.USER); this.pp = pp; this.newName = newName; startJob(); }
/** * Method to rename the currently selected export. */
Method to rename the currently selected export
renameExport
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/tool/user/ExportChanges.java", "license": "gpl-3.0", "size": 60558 }
[ "com.sun.electric.Main", "com.sun.electric.database.hierarchy.Export", "com.sun.electric.tool.Job", "com.sun.electric.tool.user.ui.EditWindow", "javax.swing.JOptionPane" ]
import com.sun.electric.Main; import com.sun.electric.database.hierarchy.Export; import com.sun.electric.tool.Job; import com.sun.electric.tool.user.ui.EditWindow; import javax.swing.JOptionPane;
import com.sun.electric.*; import com.sun.electric.database.hierarchy.*; import com.sun.electric.tool.*; import com.sun.electric.tool.user.ui.*; import javax.swing.*;
[ "com.sun.electric", "javax.swing" ]
com.sun.electric; javax.swing;
2,388,376