code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public void testStopClock(){
AbstractThrottle instance=new AbstractThrottleImpl();
instance.stopClock();
}
| Test of stopClock method, of class AbstractThrottle. |
public synchronized void dump(){
if (log.isDebugEnabled()) {
log.debug("dumping allocations {}",events.size());
for ( Entry<BaseEvent,Info> entry : events.entrySet()) {
log.debug("{} {}",entry.getKey(),entry.getValue().refcount);
}
}
}
| Dumps allocations |
public static Sdk findAndroidSDK(){
Sdk[] allJDKs=ProjectJdkTable.getInstance().getAllJdks();
for ( Sdk sdk : allJDKs) {
if (sdk.getSdkType().getName().toLowerCase().contains("android")) {
return sdk;
}
}
return null;
}
| Is using Android SDK? |
public static boolean checkIfRightExpressionRequireEvaluation(Expression expression){
if (expression.getFilterExpressionType() == ExpressionType.UNKNOWN || !(expression instanceof LiteralExpression) && !(expression instanceof ListExpression)) {
return true;
}
for ( Expression child : expression.getChildren()) {
if (checkIfRightExpressionRequireEvaluation(child)) {
return true;
}
}
return false;
}
| This method will check if a given expression contains a column expression recursively. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public static CGPoint ccp(float x,float y){
return new CGPoint(x,y);
}
| Helper macro that creates a CCPoint |
public BusinessObjectFormatEntity createBusinessObjectFormatEntity(String namespaceCode,String businessObjectDefinitionName,String businessObjectFormatUsage,String fileType,Integer businessObjectFormatVersion,String businessObjectFormatDescription,Boolean businessObjectFormatLatestVersion,String businessObjectFormatPartitionKey,String partitionKeyGroupName,List<Attribute> attributes){
return createBusinessObjectFormatEntity(namespaceCode,businessObjectDefinitionName,businessObjectFormatUsage,fileType,businessObjectFormatVersion,businessObjectFormatDescription,businessObjectFormatLatestVersion,businessObjectFormatPartitionKey,partitionKeyGroupName,attributes,null,null,null,null,null);
}
| Creates and persists a new business object format entity. |
public synchronized void mountBLOB(final File location,final boolean full) throws IOException {
Date d;
try {
d=my_SHORT_MILSEC_FORMATTER.parse(location.getName().substring(this.prefix.length() + 1,this.prefix.length() + 18),0).getTime();
}
catch ( final ParseException e) {
throw new IOException("date parse problem with file " + location.toString() + ": "+ e.getMessage());
}
BLOB oneBlob;
if (full && this.buffersize > 0 && !this.trimall) {
oneBlob=new Heap(location,this.keylength,this.ordering,this.buffersize);
}
else {
oneBlob=new HeapModifier(location,this.keylength,this.ordering);
oneBlob.optimize();
}
this.blobs.add(new blobItem(d,location,oneBlob));
}
| add a blob file to the array. note that this file must be generated with a file name from newBLOB() |
public CodeType findByName(String name){
try {
EntityManager entityManager=EntityManagerHelper.getEntityManager();
entityManager.getTransaction().begin();
CriteriaBuilder builder=entityManager.getCriteriaBuilder();
CriteriaQuery<CodeType> query=builder.createQuery(CodeType.class);
Root<CodeType> from=query.from(CodeType.class);
query.select(from);
query.where(builder.equal(from.get("name"),name));
List<CodeType> items=entityManager.createQuery(query).getResultList();
entityManager.getTransaction().commit();
if (items.size() > 0) {
return items.get(0);
}
return null;
}
catch ( Exception re) {
EntityManagerHelper.rollback();
throw re;
}
finally {
EntityManagerHelper.close();
}
}
| Method findByName. |
public static void main(String[] args){
doMain(args);
}
| Application entry point. |
public boolean showChatColors(){
return chatColors;
}
| Get if the client has chat colors enabled. |
public Object eval(Reader reader) throws ScriptException {
return eval(reader,context);
}
| <code>eval(Reader)</code> calls the abstract <code>eval(Reader, ScriptContext)</code> passing the value of the <code>context</code> field. |
public void loading(){
mHintView.setVisibility(View.GONE);
mProgressBar.setVisibility(View.VISIBLE);
}
| loading status |
@SuppressWarnings({"UnusedDeclaration"}) public static MixtureOfGaussians serializableInstance(){
return new MixtureOfGaussians(.5,-2,2,2,2);
}
| Generates a simple exemplar of this class to test serialization. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-24 13:04:40.439 -0500",hash_original_method="EFD9495A1C7E86FA87C6E18B7AEF10E0",hash_generated_method="81482A8F6DCF884684552385CD88BCFE") public OrientedBoundingBox computeOrientedBoundingBox(){
return GestureUtils.computeOrientedBoundingBox(points);
}
| Computes an oriented bounding box of the stroke. |
@Override public String toString(){
if (m_Classifiers == null) {
return "Bagging: No model built yet.";
}
StringBuffer text=new StringBuffer();
text.append("All the base classifiers: \n\n");
for (int i=0; i < m_Classifiers.length; i++) text.append(m_Classifiers[i].toString() + "\n\n");
if (m_CalcOutOfBag) {
text.append("Out of bag error: " + Utils.doubleToString(m_OutOfBagError,4) + "\n\n");
}
return text.toString();
}
| Returns description of the bagged classifier. |
public static double futureInvestmentValue(double investmentAmount,double monthlyInterestRate,int years){
return investmentAmount * Math.pow(1 + monthlyInterestRate,years * 12);
}
| Method futureInvestmentValue computes future investement value |
public void parseForClass(GenericDeclaration genericDecl,String signature){
setInput(genericDecl,signature);
if (!eof) {
parseClassSignature();
}
else {
if (genericDecl instanceof Class) {
Class c=(Class)genericDecl;
this.formalTypeParameters=EmptyArray.TYPE_VARIABLE;
this.superclassType=c.getSuperclass();
Class<?>[] interfaces=c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes=ListOfTypes.EMPTY;
}
else {
this.interfaceTypes=new ListOfTypes(interfaces);
}
}
else {
this.formalTypeParameters=EmptyArray.TYPE_VARIABLE;
this.superclassType=Object.class;
this.interfaceTypes=ListOfTypes.EMPTY;
}
}
}
| Parses the generic signature of a class and creates the data structure representing the signature. |
public BufferedRuleBasedScannerExt(int size){
super();
setBufferSize(size);
}
| Creates a new buffered rule based scanner which does not have any rule. The buffer size is set to the given number of characters. |
@HLEUnimplemented @HLEFunction(nid=0x03D9526F,version=150) public int sceHttpSetResolveRetry(int templateId,int count){
return 0;
}
| Set resolver retry |
public GVTGlyphVector createGlyphVector(FontRenderContext frc,int[] glyphCodes,CharacterIterator ci){
return new AWTGVTGlyphVector(awtFont.createGlyphVector(frc,glyphCodes),this,scale,ci);
}
| Returns a new GlyphVector object created with the specified integer array and the specified FontRenderContext. |
public static double sqrt(double x){
return Math.sqrt(x);
}
| Returns the positive square root of the specified value. |
public static IngredientsFragment newInstance(Recipe recipe,int sectionNumber){
IngredientsFragment fragment=new IngredientsFragment();
fragment.recipe=recipe;
Bundle args=new Bundle();
args.putInt(ARG_SECTION_NUMBER,sectionNumber);
fragment.setArguments(args);
return fragment;
}
| Returns a new instance of this fragment for the given section number. |
public void actionPerformed(ActionEvent e){
DataModel dataModel=getDataEditor().getSelectedDataModel();
if (dataModel instanceof DataSet) {
DataSet dataSet=(DataSet)dataModel;
if (dataSet.getNumRows() == 0) {
JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),"Data set is empty.");
return;
}
JComponent editor=editor();
int selection=JOptionPane.showOptionDialog(JOptionUtils.centeringComp(),editor,"Sample Size",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,new String[]{"Done","Cancel"},"Done");
if (selection != 0) {
return;
}
try {
DataSet newDataSet=RandomSampler.sample(dataSet,getSampleSize());
DataModelList list=new DataModelList();
list.add(newDataSet);
getDataEditor().reset(list);
getDataEditor().selectFirstTab();
}
catch ( Exception e1) {
String s=e1.getMessage();
if (s == null || "".equals(s)) {
s="Could not construct random sample.";
}
JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),s);
}
}
else {
JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),"Must be a tabular data set.");
}
}
| Performs the action of loading a session from a file. |
public void insertAddress(LocoNetMessage m){
m.setElement(1,getLowBits());
m.setElement(2,getHighBits() | getASBit());
}
| Update a LocoNet message to have this address. |
public static void main(String[] args) throws Exception {
String fileName=args[0];
JdkHelloWorld helloWorld=new JdkHelloWorld();
System.out.println(" ***" + fileName + " line count="+ helloWorld.readFile(fileName));
String url="http://www.google.com";
System.out.println(" ***" + url + " line count="+ helloWorld.readUrl(url));
url="http://example.com";
System.out.println(" ***" + url + " status code="+ helloWorld.urlWithConnection(url));
System.out.println(" *** jdbc interactions");
helloWorld.jdbcInteractions();
}
| Read a file, execute http requests, and make jdbc calls. |
public void testCase13(){
byte aBytes[]={15,48,-29,7,98,-1,39,-128};
int aSign=1;
byte rBytes[]={15,48,-29,7,98,-1,39,-128};
BigInteger aNumber=new BigInteger(aSign,aBytes);
BigInteger bNumber=BigInteger.ONE;
BigInteger result=aNumber.divide(bNumber);
byte resBytes[]=new byte[rBytes.length];
resBytes=result.toByteArray();
for (int i=0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign",1,result.signum());
}
| Divide a positive number by ONE. |
private static final byte[] hash(final byte[] value) throws NoSuchAlgorithmException {
MessageDigest md=MessageDigest.getInstance("MD5");
md.reset();
md.update(value);
return md.digest();
}
| Return the hash of an array of bytes. This method is thread safe. |
@Override public boolean supportsDataDefinitionAndDataManipulationTransactions(){
debugCodeCall("supportsDataDefinitionAndDataManipulationTransactions");
return false;
}
| Returns whether data manipulation and CREATE/DROP is supported in transactions. |
public final void showToolButton(@NotNull IsWidget button){
if (button != null) {
toolbarHeader.setWidgetHidden(button.asWidget(),false);
}
}
| Sets button visible on part toolbar. |
public Node item(int index){
ElemTemplateElement node=m_firstChild;
for (int i=0; i < index && node != null; i++) {
node=node.m_nextSibling;
}
return node;
}
| NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds. |
public boolean isCanceled(){
return name.get() == Canceled.name.get();
}
| <p>Return <code>true</code> iff this object represents a <em>Canceled</em> state.</p> |
private void saveUidValidity(long uidValidity) throws IOException {
File validityFile=new File(rootFolder,VALIDITY_FILE);
if (!validityFile.createNewFile()) throw new IOException("Could not create file " + validityFile);
FileOutputStream fos=new FileOutputStream(validityFile);
try {
fos.write(String.valueOf(uidValidity).getBytes());
}
finally {
IOUtils.closeQuietly(fos);
}
}
| Save the given uidValidity to the file system |
public boolean reset(){
boolean wasReset=false;
if (super.reset()) {
wasReset=true;
}
return wasReset;
}
| Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons). |
public boolean save(String filename){
try {
mOutput=new FileOutputStream(filename);
byte[] output=new byte[BUFFER_SIZE];
while (mInput.available() > 0) {
int size=read(output);
if (size > 0) {
mOutput.write(output,0,size);
}
else break;
}
mInput.close();
mOutput.close();
return true;
}
catch ( Exception e) {
e.printStackTrace();
}
try {
if (mInput != null) mInput.close();
if (mOutput != null) mOutput.close();
}
catch ( IOException e) {
e.printStackTrace();
}
return false;
}
| Saves an unencrypted copy of the music file as an Mp3 |
@Override public boolean isSingleton(){
return true;
}
| Always returns <code>true</code>. |
public final void append(String s){
compoundID.append(s);
}
| Append a new segment to the compound name of the operator |
@Override public void eUnset(int featureID){
switch (featureID) {
case TypesPackage.TSTRUCT_GETTER__DEFINED_MEMBER:
setDefinedMember((TStructMember)null);
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void doSetRhythmDrawable(@Nullable RhythmDrawable drawable){
if (mRhythmDrawable != null) {
mRhythmDrawable.setCallback(null);
}
mRhythmDrawable=drawable;
if (mRhythmDrawable != null) {
mRhythmDrawable.setBounds(mBounds);
mRhythmDrawable.setCallback(this);
}
}
| Links new drawable to this view |
protected AbstractSVGFilterPrimitiveElementBridge(){
}
| Constructs a new bridge for a filter primitive element. |
@Pointcut("within(@javax.persistence.Entity *) || " + "within(@javax.persistence.MappedSuperclass *) || " + "within(@javax.persistence.Embeddable *)") public void jpa(){
}
| Pointcut for jpa entities |
public OMGrid(double lat,double lon,int x,int y,double vResolution,double hResolution,int[][] data){
setRenderType(RENDERTYPE_OFFSET);
set(lat,lon,x,y,vResolution,hResolution,data);
}
| Create a OMGrid that covers a x/y screen area, anchored to a lat/lon point. Column major by default. If your data is row major, use null for the data, set the major direction, and then set the data. |
@Override public int compareTo(SpatialObjectPair other){
return Double.compare(this.distance,other.distance);
}
| Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. <p/> |
void checkLabel(final Label label,final boolean checkVisited,final String msg){
if (label == null) {
throw new IllegalArgumentException("Invalid " + msg + " (must not be null)");
}
if (checkVisited && labels.get(label) == null) {
throw new IllegalArgumentException("Invalid " + msg + " (must be visited first)");
}
}
| Checks that the given label is not null. This method can also check that the label has been visited. |
public MinecraftlyLogger(MinecraftlyCore core,Logger parentLogger) throws MissingResourceException {
super("Core " + parentLogger.getName(),parentLogger.getResourceBundleName());
this.core=core;
this.debug=new File(core.getMinecraftlyDataFolder(),".debugging").exists();
setParent(parentLogger);
setUseParentHandlers(true);
}
| Method to construct a logger for Minecraftly's Core. |
public void cleanIndex(RowMutator mutator,DataObjectType doType,SoftReference<IndexCleanupList> listToCleanRef){
IndexCleanupList listToClean=listToCleanRef.get();
if (listToClean == null) {
_log.warn("clean up list for {} has been recycled by GC, skip it",doType.getClass().getName());
return;
}
Map<String,List<Column<CompositeColumnName>>> cleanList=listToClean.getColumnsToClean();
Iterator<Map.Entry<String,List<Column<CompositeColumnName>>>> entryIt=cleanList.entrySet().iterator();
Map<String,ColumnField> dependentFields=new HashMap<>();
while (entryIt.hasNext()) {
Map.Entry<String,List<Column<CompositeColumnName>>> entry=entryIt.next();
String rowKey=entry.getKey();
List<Column<CompositeColumnName>> cols=entry.getValue();
for (int i=0; i < cols.size(); i++) {
Column<CompositeColumnName> column=cols.get(i);
ColumnField field=doType.getColumnField(column.getName().getOne());
field.removeColumn(rowKey,column,mutator,listToClean.getAllColumns(rowKey));
for ( ColumnField depField : field.getDependentFields()) {
dependentFields.put(depField.getName(),depField);
}
}
for ( ColumnField depField : dependentFields.values()) {
depField.removeIndex(rowKey,null,mutator,listToClean.getAllColumns(rowKey),listToClean.getObject(rowKey));
}
}
removeIndexOfInactiveObjects(mutator,doType,(IndexCleanupList)listToClean,true);
mutator.executeIndexFirst();
}
| Clean out old column / index entries synchronously |
protected void onPrepareRequest(HttpUriRequest request) throws IOException {
}
| Called before the request is executed using the underlying HttpClient. <p>Overwrite in subclasses to augment the request.</p> |
public String toString(){
return (super.toString() + "NameConstraints: [" + ((permitted == null) ? "" : ("\n Permitted:" + permitted.toString()))+ ((excluded == null) ? "" : ("\n Excluded:" + excluded.toString()))+ " ]\n");
}
| Return the printable string. |
public LRUCache(int initialSize,int maxSize){
this(initialSize,maxSize,1);
}
| Create a new LRU cache. |
public HarCapabilityContainerTest(String testName,EnvironmentTestData testData) throws Exception {
super(testName,testData);
}
| Initializes the test case. |
private final File locate(String name){
String prefix="";
File sourceFile=null;
int idx=0;
while (true) {
if ((idx == 0) && (ToolIO.getUserDir() != null)) {
sourceFile=new File(ToolIO.getUserDir(),name);
}
else {
sourceFile=new File(prefix + name);
}
if (sourceFile.exists()) break;
if (idx >= libraryPathEntries.size()) break;
prefix=(String)libraryPathEntries.elementAt(idx++);
}
return sourceFile;
}
| Searches for the file in current directory (ToolIO.userDirectory) and in library paths |
public static void main(String args[]){
TimeResolution timeResolution=new TimeResolution();
timeResolution.measureTimer();
timeResolution.measureTimeFunctions(INCREMENT,MAX);
timeResolution.measureSleep();
timeResolution.measureWait();
}
| Execute the various timer resolution tests. |
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
try {
s.defaultReadObject();
this.queue=new Object[q.size()];
comparator=q.comparator();
addAll(q);
}
finally {
q=null;
}
}
| Reconstitutes this queue from a stream (that is, deserializes it). |
public Edge createEdge(BasicBlock source,BasicBlock dest,@Edge.Type int type){
Edge edge=createEdge(source,dest);
edge.setType(type);
return edge;
}
| Add a unique edge to the graph. There must be no other edge already in the CFG with the same source and destination blocks. |
private void initialize(){
this.setContentPane(getJPanel());
this.pack();
}
| This method initializes this |
public void translate(float x,float y,float z){
Matrix4f tmp=new Matrix4f();
tmp.loadTranslate(x,y,z);
multiply(tmp);
}
| Modifies the current matrix by post-multiplying it with a translation matrix of given dimensions |
public AdaptiveJobCountLoadProbe(){
}
| Initializes active job probe. |
void primeFncName(Session s,int line){
primeAllFncNames(s);
}
| Called in order to make sure that we have a function name available at the given location. For AVM+ swfs we don't need a swd and therefore don't have access to function names in the same fashion. We need to ask the player for a particular function name. |
public static <V>boolean addDistinctEntry(List<V> sourceList,V entry){
return (sourceList != null && !sourceList.contains(entry)) ? sourceList.add(entry) : false;
}
| add distinct entry to list |
protected void initFromJar(File file){
JarFile jar;
JarEntry entry;
Enumeration<JarEntry> enm;
if (VERBOSE) {
System.out.println("Analyzing jar: " + file);
}
if (!file.exists()) {
System.out.println("Jar does not exist: " + file);
return;
}
try {
jar=new JarFile(file);
enm=jar.entries();
while (enm.hasMoreElements()) {
entry=enm.nextElement();
if (entry.getName().endsWith(".class")) {
add(entry.getName());
}
}
initFromManifest(jar.getManifest());
}
catch ( Exception e) {
e.printStackTrace();
}
}
| Fills the class cache with classes from the specified jar. |
public List<BakedQuad> build(@Nullable Consumer<UnpackedBakedQuad.Builder> quadConsumer){
List<BakedQuad> quads=new ArrayList<BakedQuad>(this.vertices.size() / 4);
if (this.vertices.size() % 4 != 0) throw new RuntimeException("Invalid number of vertices");
for (int i=0; i < this.vertices.size(); i+=4) {
Vertex vert1=this.vertices.get(i);
Vertex vert2=this.vertices.get(i + 1);
Vertex vert3=this.vertices.get(i + 2);
Vertex vert4=this.vertices.get(i + 3);
quads.add(this.createQuad(this.format,vert1,vert2,vert3,vert4,quadConsumer));
}
this.vertices.clear();
return quads;
}
| Builds the quads. Specify a consumer to modify the quads |
public static SQLExceptionTranslator newJdbcExceptionTranslator(){
return new SQLStateSQLExceptionTranslator();
}
| Create an appropriate SQLExceptionTranslator for the given TransactionManager. If a DataSource is found, a SQLErrorCodeSQLExceptionTranslator for the DataSource is created; else, a SQLStateSQLExceptionTranslator as fallback. |
public void onSaveInstanceState(Bundle outState){
outState.putBoolean("SlidingActivityHelper.open",mSlidingMenu.isMenuShowing());
outState.putBoolean("SlidingActivityHelper.secondary",mSlidingMenu.isSecondaryMenuShowing());
}
| Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method will be passed to both). |
public SymbolTableEntryInternal steFor_$fieldInit(){
return getSymbolTableEntryInternal("$fieldInit",true);
}
| "$fieldInit" - retrieve the internal symbol table entry for the symbol "$fieldInit" |
public boolean isProcessing(){
Object oo=get_Value(COLUMNNAME_Processing);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Process Now. |
public static Profile createFromCommandline(String[] args){
Profile profile=new Profile();
int i=0;
while (i != args.length) {
if (args[i].equals("-u")) {
profile.setUser(args[i + 1]);
}
else if (args[i].equals("-p")) {
profile.setPassword(args[i + 1]);
}
else if (args[i].equals("-c")) {
profile.setCharacter(args[i + 1]);
}
else if (args[i].equals("-h")) {
profile.setHost(args[i + 1]);
}
else if (args[i].equals("-P")) {
profile.setPort(Integer.parseInt(args[i + 1]));
}
else if (args[i].equals("-S")) {
profile.setSeed(args[i + 1]);
}
i++;
}
if (profile.getCharacter() == null) {
profile.setCharacter(profile.getUser());
}
return profile;
}
| create a profile based on command line arguments <ul> <li>-u: username</li> <li>-p: password</li> <li>-c: character name (defaults to username)</li> <li>-h: hostname</li> <li>-P: port</li> <li>-S: pre authentication seed</li> </ul> |
public MainWindow(){
super("Main Window");
settings=new Settings();
update=new UpdateWindow();
blocksWindow=new BlockListWindow();
consoleLog=new GUIConsoleLog();
if (settings.getPreferences().getBoolean("OPEN_CONSOLE_ON_START",true)) {
consoleLog.setVisible(true);
}
export=new ExportWindow();
main=this;
setSize(1000,800);
setMinimumSize(new Dimension(400,400));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("jMC2Obj");
setLocationRelativeTo(null);
panel=new MainPanel();
add(panel);
setVisible(true);
}
| Window contructor. |
public void findAndInit(Iterator<?> it){
while (it.hasNext()) {
findAndInit(it.next());
}
}
| Eventually gets called when the MouseDelegator is added to the BeanContext, and when other objects are added to the BeanContext anytime after that. The MouseDelegator looks for a MapBean to manage MouseEvents for, and MouseModes to use to manage those events. If a MapBean is added to the BeanContext while another already is in use, the second MapBean will take the place of the first. |
boolean wantsFutureVariantBases(){
return mHaplotypeA.wantsFutureVariantBases() || mHaplotypeB.wantsFutureVariantBases();
}
| Test whether a deficit of variant bases are upstream in the queue in order to perform a step. |
public PotentialProducer createPotentialProducer(final Object baseObject,final String methodName,final Class<?> dataType){
String description=getDescriptionString(baseObject,methodName,dataType);
return new PotentialProducer(parentComponent,baseObject,methodName,dataType,null,null,description);
}
| Create a potential producer (without auxiliary arguments). This is probably the main method to use in a script. |
public Hashtable(){
this(11,0.75f);
}
| Constructs a new, empty hashtable with a default initial capacity (11) and load factor, which is <tt>0.75</tt>. |
private void runRoutesDistance(final String runNr,final Scenario sc){
UserGroup ug=UserGroup.URBAN;
int lastIteration=sc.getConfig().controler().getLastIteration();
String eventsFile=sc.getConfig().controler().getOutputDirectory() + "/ITERS/it." + lastIteration+ "/"+ lastIteration+ ".events.xml.gz";
LegModeRouteDistanceDistributionAnalyzer lmdfed=new LegModeRouteDistanceDistributionAnalyzer();
lmdfed.init(sc,eventsFile);
lmdfed.preProcessData();
lmdfed.postProcessData();
new File(RUN_DIR + "/analysis/legModeDistributions/").mkdirs();
lmdfed.writeResults(RUN_DIR + "/analysis/legModeDistributions/" + runNr+ "_it."+ lastIteration+ "_");
}
| It will write route distance distribution from events and take the beeline distance for teleported modes |
public List<String> findAvailableStrings(String uri) throws IOException {
_resourcesNotLoaded.clear();
String fulluri=_path + uri;
List<String> strings=new ArrayList<>();
Enumeration<URL> resources=getResources(fulluri);
while (resources.hasMoreElements()) {
URL url=resources.nextElement();
try {
String string=readContents(url);
strings.add(string);
}
catch ( IOException notAvailable) {
_resourcesNotLoaded.add(url.toExternalForm());
}
}
return strings;
}
| Reads the contents of the found URLs as a Strings and returns them. Individual URLs that cannot be read are skipped and added to the list of 'resourcesNotLoaded' |
public double computeInPlace(double... dataset){
checkArgument(dataset.length > 0,"Cannot calculate quantiles of an empty dataset");
if (containsNaN(dataset)) {
return NaN;
}
long numerator=(long)index * (dataset.length - 1);
int quotient=(int)LongMath.divide(numerator,scale,RoundingMode.DOWN);
int remainder=(int)(numerator - (long)quotient * scale);
selectInPlace(quotient,dataset,0,dataset.length - 1);
if (remainder == 0) {
return dataset[quotient];
}
else {
selectInPlace(quotient + 1,dataset,quotient + 1,dataset.length - 1);
return interpolate(dataset[quotient],dataset[quotient + 1],remainder,scale);
}
}
| Computes the quantile value of the given dataset, performing the computation in-place. |
public Ellipse scale(double factor){
RotatedRect r=rect.clone();
r.size=new Size(factor * rect.size.width,factor * rect.size.height);
return new Ellipse(r);
}
| Scale this ellipse by a scaling factor about its center |
private static File waitForReportRunCompletion(Dfareporting reporting,long userProfileId,File file) throws Exception {
Integer interval;
for (int i=0; i <= MAX_POLLING_ATTEMPTS; i++) {
if (!file.getStatus().equals("PROCESSING")) {
break;
}
interval=(int)(POLL_TIME_INCREMENT * (Math.pow(1.6,i)));
System.out.printf("Polling again in %s ms.%n",interval);
Thread.sleep(interval);
file=reporting.reports().files().get(userProfileId,file.getReportId(),file.getId()).execute();
}
return file;
}
| Waits for a report file to generate with exponential back-off. |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public AllocationSite(){
this(0,0);
}
| An anonymous allocation site |
public synchronized boolean equals(Object o){
return super.equals(o);
}
| Compares the specified Object with this Vector for equality. Returns true if and only if the specified Object is also a List, both Lists have the same size, and all corresponding pairs of elements in the two Lists are <em>equal</em>. (Two elements <code>e1</code> and <code>e2</code> are <em>equal</em> if <code>(e1==null ? e2==null : e1.equals(e2))</code>.) In other words, two Lists are defined to be equal if they contain the same elements in the same order. |
protected DateTimeConverter makeConverter(){
return new DateConverter();
}
| Create the Converter with no default value. |
public final boolean skip(String str,CharSequence csq){
if (this.at(str,csq)) {
index+=str.length();
return true;
}
else {
return false;
}
}
| Moves this cursor forward only if at the specified string. This method is equivalent to: [code] if (at(str, csq)) increment(str.length()); [/code] |
@Override public ExpectedPartitionValuesInformation deleteExpectedPartitionValues(ExpectedPartitionValuesDeleteRequest expectedPartitionValuesDeleteRequest){
validateExpectedPartitionValuesDeleteRequest(expectedPartitionValuesDeleteRequest);
PartitionKeyGroupEntity partitionKeyGroupEntity=partitionKeyGroupDaoHelper.getPartitionKeyGroupEntity(expectedPartitionValuesDeleteRequest.getPartitionKeyGroupKey());
Map<String,ExpectedPartitionValueEntity> expectedPartitionValueEntityMap=getExpectedPartitionValueEntityMap(partitionKeyGroupEntity.getExpectedPartitionValues());
Collection<ExpectedPartitionValueEntity> deletedExpectedPartitionValueEntities=new ArrayList<>();
for ( String expectedPartitionValue : expectedPartitionValuesDeleteRequest.getExpectedPartitionValues()) {
ExpectedPartitionValueEntity expectedPartitionValueEntity=expectedPartitionValueEntityMap.get(expectedPartitionValue);
if (expectedPartitionValueEntity != null) {
deletedExpectedPartitionValueEntities.add(expectedPartitionValueEntity);
}
else {
throw new ObjectNotFoundException(String.format("Expected partition value \"%s\" doesn't exist in \"%s\" partition key group.",expectedPartitionValue,partitionKeyGroupEntity.getPartitionKeyGroupName()));
}
}
for ( ExpectedPartitionValueEntity expectedPartitionValueEntity : deletedExpectedPartitionValueEntities) {
partitionKeyGroupEntity.getExpectedPartitionValues().remove(expectedPartitionValueEntity);
}
expectedPartitionValueDao.saveAndRefresh(partitionKeyGroupEntity);
return createExpectedPartitionValuesInformationFromEntities(partitionKeyGroupEntity,deletedExpectedPartitionValueEntities);
}
| Deletes specified expected partition values from an existing partition key group which is identified by name. |
public static void main(final String[] args){
DOMTestCase.doMain(hasAttribute01.class,args);
}
| Runs this test from the command line. |
public void launch(){
final Activity parentActivity=ActivityDelegate.getActivityForTabId(mParentId);
mLaunchedId=ChromeLauncherActivity.launchDocumentInstance(parentActivity,mIsIncognito,mAsyncParams);
mLaunchTimestamp=SystemClock.elapsedRealtime();
run();
}
| Starts an Activity to with the stored parameters. |
final boolean unlink(Index<V> succ){
return !indexesDeletedNode() && casRight(succ,succ.right);
}
| Tries to CAS right field to skip over apparent successor succ. Fails (forcing a retraversal by caller) if this node is known to be deleted. |
public static LeafReader wrap(LeafReader reader,Sort sort) throws IOException {
return wrap(reader,new Sorter(sort).sort(reader));
}
| Return a sorted view of <code>reader</code> according to the order defined by <code>sort</code>. If the reader is already sorted, this method might return the reader as-is. |
private static int fillPomsFromChildren(final Collection<ArtifactInformation> poms,final ArtifactInformation art,final Map<String,ArtifactInformation> artifacts){
int cnt=0;
for ( final String childId : art.getChildIds()) {
final ArtifactInformation child=artifacts.get(childId);
if (child != null) {
final String childName=child.getName();
if (isPomFileName(childName)) {
poms.add(child);
++cnt;
}
}
}
return cnt;
}
| Fill a collection with all POMs for the children of an artifact. |
public AxisSpace(){
this.top=0.0;
this.bottom=0.0;
this.left=0.0;
this.right=0.0;
}
| Creates a new axis space record. |
public FontConverter(final Mapper mapper){
this.mapper=mapper;
if (mapper == null) {
textAttributeConverter=null;
}
else {
textAttributeConverter=new TextAttributeConverter();
}
}
| Constructs a FontConverter. |
public String typeName(){
return "long";
}
| Returns a String description of what kind of entry this is. |
public static void d(String tag,String s){
if (LOG.DEBUG >= LOGLEVEL) Log.d(tag,s);
}
| Debug log message. |
public EdgeInfo(int start,int end,int cap){
this(start,end,cap,0);
}
| Construct EdgeInfo from (start,end) vertices with given capacity. |
private boolean isSessionPaused(FileSharingSession session){
if (session == null) {
throw new ServerApiGenericException("Unable to check if transfer is paused since session with file transfer ID '" + mFileTransferId + "' not available!");
}
return session.isFileTransferPaused();
}
| Is session paused (only for HTTP transfer) |
private RawProtein processProtein(final RawProtein<PfamHmmer3RawMatch> rawProteinUnfiltered,final List<SeedAlignment> seedAlignments){
RawProtein<PfamHmmer3RawMatch> filteredMatches=new RawProtein<PfamHmmer3RawMatch>(rawProteinUnfiltered.getProteinIdentifier());
final Set<PfamHmmer3RawMatch> seedMatches=new HashSet<PfamHmmer3RawMatch>();
if (seedAlignments != null) {
for ( final SeedAlignment seedAlignment : seedAlignments) {
for ( final PfamHmmer3RawMatch candidateMatch : rawProteinUnfiltered.getMatches()) {
if (!seedMatches.contains(candidateMatch)) {
if (seedAlignment.getModelAccession().equals(candidateMatch.getModelId()) && seedAlignment.getAlignmentStart() <= candidateMatch.getLocationStart() && seedAlignment.getAlignmentEnd() >= candidateMatch.getLocationEnd()) {
filteredMatches.addMatch(candidateMatch);
seedMatches.add(candidateMatch);
}
}
}
}
}
final Set<PfamHmmer3RawMatch> unfilteredByEvalue=new TreeSet<PfamHmmer3RawMatch>(rawProteinUnfiltered.getMatches());
for ( final RawMatch rawMatch : unfilteredByEvalue) {
final PfamHmmer3RawMatch candidateMatch=(PfamHmmer3RawMatch)rawMatch;
if (!seedMatches.contains(candidateMatch)) {
final PfamClan candidateMatchClan=clanData.getClanByModelAccession(candidateMatch.getModelId());
boolean passes=true;
if (candidateMatchClan != null) {
for ( final PfamHmmer3RawMatch match : filteredMatches.getMatches()) {
final PfamClan passedMatchClan=clanData.getClanByModelAccession(match.getModelId());
if (candidateMatchClan.equals(passedMatchClan)) {
if (matchesOverlap(candidateMatch,match)) {
if (!matchesAreNested(candidateMatch,match)) {
passes=false;
break;
}
}
}
}
}
if (passes) {
filteredMatches.addMatch(candidateMatch);
}
}
}
return filteredMatches;
}
| Implementation of Rob Finn's algorithm for post processing, translated from Perl to Java. <p/> Also includes additional code to ensure seed alignments are included as matches, regardless of score. |
@Override public void execute(MetricTimeSeries timeSeries,FunctionValueMap functionValueMap){
if (timeSeries.size() <= 0) {
functionValueMap.add(this,Double.NaN);
return;
}
double[] values=timeSeries.getValuesAsArray();
double min=values[0];
double max=values[0];
for (int i=1; i < values.length; i++) {
double current=values[i];
if (current < min) {
min=current;
}
if (current > max) {
max=current;
}
}
functionValueMap.add(this,Math.abs(max - min));
}
| Gets difference between the maximum and the minimum value. It is always a positive value. |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
public ImpliedCovTable(SemImWrapper wrapper,boolean measured,boolean correlations){
this.wrapper=wrapper;
this.measured=measured;
this.correlations=correlations;
this.nf=NumberFormatUtil.getInstance().getNumberFormat();
if (measured() && covariances()) {
matrix=getSemIm().getImplCovarMeas().toArray();
}
else if (measured() && !covariances()) {
matrix=corr(getSemIm().getImplCovarMeas().toArray());
}
else if (!measured() && covariances()) {
TetradMatrix implCovarC=getSemIm().getImplCovar(false);
matrix=implCovarC.toArray();
}
else if (!measured() && !covariances()) {
TetradMatrix implCovarC=getSemIm().getImplCovar(false);
matrix=corr(implCovarC.toArray());
}
}
| Constructs a new table for the given covariance matrix, the nodes for which are as specified (in the order they appear in the matrix). |
public Graphics create(){
return new PSPathGraphics((Graphics2D)getDelegate().create(),getPrinterJob(),getPrintable(),getPageFormat(),getPageIndex(),canDoRedraws());
}
| Creates a new <code>Graphics</code> object that is a copy of this <code>Graphics</code> object. |
public static DeterministicKey deriveThisOrNextChildKey(DeterministicKey parent,int childNumber){
int nAttempts=0;
ChildNumber child=new ChildNumber(childNumber);
boolean isHardened=child.isHardened();
while (nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS) {
try {
child=new ChildNumber(child.num() + nAttempts,isHardened);
return deriveChildKey(parent,child);
}
catch ( HDDerivationException ignore) {
}
nAttempts++;
}
throw new HDDerivationException("Maximum number of child derivation attempts reached, this is probably an indication of a bug.");
}
| Derives a key of the "extended" child number, ie. with the 0x80000000 bit specifying whether to use hardened derivation or not. If derivation fails, tries a next child. |
public LR1State merge(LR1State state){
HashSet<LR1Item> items=new HashSet<LR1Item>();
for ( LR1Item item1 : this.items) {
LR1Item newItem=item1;
LR1Item item2=state.getItemByLR0Kernel(item1.getLR0Kernel());
newItem=newItem.merge(item2);
items.add(newItem);
}
return new LR1State(items);
}
| Merges this state with the given one and returns the result. Only works, if both states have equal LR(0) kernels. |
Subsets and Splits