code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public Class load(String type) throws Exception {
ClassLoader loader=getClassLoader();
if (loader == null) {
loader=getCallerClassLoader();
}
return loader.loadClass(type);
}
| This method is used to acquire the class of the specified name. Loading is performed by the thread context class loader as this will ensure that the class loading strategy can be changed as requirements dictate. Typically the thread context class loader can handle all serialization requirements. |
private double euclideanDistance(DoubleArrayListWritable v1,DoubleArrayListWritable v2,int dim){
double distance=0.0;
for (int i=0; i < dim; i++) {
distance+=math.pow(v1.get(i).get() - v2.get(i).get(),2);
}
return math.sqrt(distance);
}
| Calculates the Euclidean distance between two vectors of doubles |
private List<FacetResult> facetsWithSearch() throws IOException {
DirectoryReader indexReader=DirectoryReader.open(indexDir);
IndexSearcher searcher=new IndexSearcher(indexReader);
TaxonomyReader taxoReader=new DirectoryTaxonomyReader(taxoDir);
FacetsCollector fc=new FacetsCollector();
FacetsCollector.search(... | User runs a query and counts facets. |
public boolean wasAtRest(){
return mWasAtRest;
}
| Check if the spring was at rest in the prior iteration. This is used for ensuring the ending callbacks are fired as the spring comes to a rest. |
protected CIMObjectPath createSubscription(CimFilterInfo filterInfo) throws WBEMException, ConnectionManagerException {
CIMObjectPath filterPath;
if (filterInfo instanceof CimManagedFilterInfo) {
filterPath=createFilter((CimManagedFilterInfo)filterInfo);
}
else {
filterPath=getInstance(CimConstants.CIM_F... | Creates an indication subscription in the CIMOM for the given filter. |
private void updatePopulation(int[] ids){
List<Integer> archivedIds=new ArrayList<Integer>();
for ( int id : ids) {
archivedIds.add(id);
}
solutions.keySet().retainAll(archivedIds);
}
| Updates the population, retaining only those solutions with the specified identifiers. |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
private void initializeSparseSlider(){
sparsitySlider.setMajorTickSpacing(10);
sparsitySlider.setMinorTickSpacing(2);
sparsitySlider.setPaintTicks(true);
Hashtable<Integer,JLabel> labelTable2=new Hashtable<Integer,JLabel>();
labelTable2.put(new Integer(0),new JLabel("0%"));
labelTable2.put(new Integer(100),... | Initializes the sparse slider. |
public boolean isStereo(){
return (channelMode != 3);
}
| Whether stereo playback mode is used |
@Override public Overlay buildOverlay(MapView map,Style defaultStyle,Styler styler,KmlPlacemark kmlPlacemark,KmlDocument kmlDocument){
Marker marker=new Marker(map);
marker.setTitle(kmlPlacemark.mName);
marker.setSnippet(kmlPlacemark.mDescription);
marker.setSubDescription(kmlPlacemark.getExtendedDataAsText());... | Build the corresponding Marker overlay |
public static boolean startsWithIgnoreCase(String searchIn,String searchFor){
return startsWithIgnoreCase(searchIn,0,searchFor);
}
| Determines whether or not the string 'searchIn' contains the string 'searchFor', dis-regarding case. Shorthand for a String.regionMatch(...) |
public void removeListener(ColorMapListener listener){
if (listener == null) return;
listeners.remove(listener);
}
| Remove a color map listener |
public T adwordsId(String value){
setString(ADWORDS_ID,value);
return (T)this;
}
| <div class="ind"> <p> Optional. </p> <p>Specifies the Google AdWords Id.</p> <table border="1"> <tbody> <tr> <th>Parameter</th> <th>Value Type</th> <th>Default Value</th> <th>Max Length</th> <th>Supported Hit Types</th> </tr> <tr> <td><code>gclid</code></td> <td>text</td> <td><span class="none">None</span> </td> <td><s... |
@HLEUnimplemented @HLEFunction(nid=0x9E8AAF8D,version=271) public int sceUsbCamGetZoom(TPointer32 zoomAddr){
zoomAddr.setValue(zoom);
return 0;
}
| Gets the current zoom. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case MappingPackage.OPERATION_SOURCE__OPERATION:
if (resolve) return getOperation();
return basicGetOperation();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static boolean screenshot(Activity activity,String filePath){
View decorView=activity.getWindow().getDecorView();
decorView.setDrawingCacheEnabled(true);
decorView.buildDrawingCache();
Bitmap bitmap=decorView.getDrawingCache();
File imagePath=new File(filePath);
FileOutputStream fos=null;
try {
... | take a screenshot |
private Counter<String> computeGradient(List<Datum> dataset,Counter<String> weights,int batchSize){
Counter<String> gradient=new ClassicCounter<String>(weights.keySet().size());
for ( Datum datum : dataset) {
double sum=0;
for ( String feature : datum.vX.keySet()) {
sum+=weights.getCount(feature) ... | Compute the gradient for the specified set of PRO samples. |
public void testSizingWithWidthConstraint(){
RectangleConstraint constraint=new RectangleConstraint(10.0,new Range(10.0,10.0),LengthConstraintType.FIXED,0.0,new Range(0.0,0.0),LengthConstraintType.NONE);
BlockContainer container=new BlockContainer(new BorderArrangement());
BufferedImage image=new BufferedImage(20... | Run some checks on sizing when there is a fixed width constraint. |
private void receivedFollowerOrSubscriberCount(FollowerInfo followerInfo){
if (followerInfo.requestError) {
return;
}
StreamInfo streamInfo=api.getStreamInfo(followerInfo.stream,null);
boolean changed=false;
if (followerInfo.type == Follower.Type.SUBSCRIBER) {
changed=streamInfo.setSubscriberCount(fol... | Set follower/subscriber count in StreamInfo and send to Stream Status Writer. |
public FrameSlot findOrAddFrameSlot(Object identifier,FrameSlotKind kind){
FrameSlot result=findFrameSlot(identifier);
if (result != null) {
return result;
}
return addFrameSlot(identifier,kind);
}
| Finds an existing slot or creates new one. This is a slow operation. |
private static boolean isValidVersionNumber(final String version){
if (version == null) {
return false;
}
final String[] parts=version.split("\\.");
if (parts.length != 3) {
return false;
}
for ( final String part : parts) {
if (!Convert.isDecString(part)) {
return false;
}
}
retu... | Checks whether a given version string is a valid version string. |
@ObjectiveCName("isInAppNotificationsEnabled") public boolean isInAppNotificationsEnabled(){
return modules.getSettingsModule().isInAppEnabled();
}
| Is in-app notifications enabled |
@Override public void intervalAdded(ListDataEvent event){
calculatePositionArray();
setPreferredSize(calculatePreferredSize());
}
| Listen for items being added to the model. |
public static MaterialColor fromInt(@ColorInt int color){
return new MaterialColor(color);
}
| Create a MaterialColor from the provided color value. |
public void shouldHandleThrowingFutureCallable(){
assertThrows(null,ExecutionException.class,IllegalArgumentException.class);
assertThrows(null,ExecutionException.class,IllegalArgumentException.class);
assertThrows(null,ExecutionException.class,IllegalArgumentException.class);
}
| Assert handles a callable that throws instead of returning a future. |
public CategoricalColumn(){
super(ColumnType.CATEGORICAL);
}
| Instantiates a new categorical column. |
@MethodDesc(description="Starts the replicator service",usage="start") public void start(boolean forceOffline) throws Exception {
try {
handleEventSynchronous(new StartEvent());
if (sm.getState().getName().equals("OFFLINE:NORMAL")) {
boolean autoEnabled=new Boolean(properties.getBoolean(ReplicatorConf.A... | Start Replicator Node Manager JMX service. |
Alerter(AlertService service,int timeout,AtomicInteger jobCounter){
this.service=service;
this.timeout=timeout;
this.jobCounter=jobCounter;
}
| Creates a new Alerter object. |
private void removeAnyCallbacks(){
if (mPerformSearchRunnable != null) {
mHandler.removeCallbacks(mPerformSearchRunnable);
}
}
| Removes any pending callbacks(if any) from the handler |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case EipPackage.GATEWAY__NAME:
return getName();
case EipPackage.GATEWAY__TO_CHANNELS:
return getToChannels();
case EipPackage.GATEWAY__FROM_CHANNELS:
return getFromChannels();
}
return super.eGet(featureID,resolve,... | <!-- begin-user-doc --> <!-- end-user-doc --> |
static void appendDate(StringBuilder buff,long dateValue){
int y=DateTimeUtils.yearFromDateValue(dateValue);
int m=DateTimeUtils.monthFromDateValue(dateValue);
int d=DateTimeUtils.dayFromDateValue(dateValue);
if (y > 0 && y < 10000) {
StringUtils.appendZeroPadded(buff,4,y);
}
else {
buff.append(y);
... | Append a date to the string builder. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:54.006 -0400",hash_original_method="FFD73B06BFF281953B16F54803697DC3",hash_generated_method="9914BD0B75BD9C1F8FA2F0E0462B401B") protected FalseFileFilter(){
}
| Restrictive consructor. |
@Inline public static boolean fits(Word val,int bits){
Word o=val.rsha(bits - 1);
return (o.isZero() || o.isMax());
}
| Finds out whether a given signed value can be represented in a given number of bits. |
public static Map<String,Object> removeDuplicateScrumRevision(DispatchContext ctx,Map<String,? extends Object> context){
Delegator delegator=ctx.getDelegator();
LocalDispatcher dispatcher=ctx.getDispatcher();
String repositoryRoot=(String)context.get("repositoryRoot");
Map<String,Object> result=ServiceUtil.retu... | removeDuplicateScrumRevision <p> Use for remove duplicate scrum revision |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
private void checkCapture(GenericClassType genericClassType,ReferenceType paramType,ReferenceType actualArgType,List<TypedOperation> genericOperations){
InstantiatedType finalType=genericClassType.instantiate(actualArgType);
InstantiatedType instantiatedType=sourceType.instantiate(paramType);
Substitution<Referen... | Checks the capture conversion over a set of types with wildcard (given as the input types to operations). Checks that the conversion followed by the substitution for the capture variable result in the class type instantiated by the actual argument type. |
public static synchronized LogStream switchLog(final File newLog){
if (sLogStream != null) {
userLog("Switching logfile to:" + newLog.getAbsolutePath());
final File file=sLogStream.file();
if (newLog.equals(file)) {
return sLogStream;
}
sLogStream.removeLog();
}
if (!newLog.getParentFile... | Switch the log to a (usually) different output file. |
protected SimState(MersenneTwisterFast random,Schedule schedule){
this(0,random,schedule);
}
| Creates a SimState with the given random number generator and schedule, and sets the seed to a bogus value (0). This should only be used by SimState subclasses which need to use an existing random number generator and schedule. |
public void addEditor(){
removeEditor();
editor=comboBox.getEditor().getEditorComponent();
if (editor != null) {
configureEditor();
comboBox.add(editor);
if (comboBox.isFocusOwner()) {
editor.requestFocusInWindow();
}
}
}
| This public method is implementation specific and should be private. do not call or override. To implement a specific editor create a custom <code>ComboBoxEditor</code> |
public void init(int value){
if (value == -1) {
throw new IllegalArgumentException("IntConstant cannot be initialized with a value of -1");
}
synchronized (this) {
if (this.value != -1) {
throw new IllegalStateException("IntConstant already initialized!");
}
this.value=value;
}
}
| Initializes the constant. This method can only be called once. |
public StAndrewsSimulation(long seed){
super(seed);
}
| Create a new StAndrewsSimulation with the given randomization seed. |
public AuthenticationNotSupportedException(){
super();
}
| Constructs a new instance of AuthenticationNotSupportedException all name resolution fields and explanation initialized to null. |
public synchronized void addMemberAsync(Contact contact){
notifyMemberJoined(contact);
}
| Adds a member to this group. TODO: more docs on async callbacks. |
public Record(){
super();
setEntity(new Entity(TYPE_ID));
getEntity().initDefaultValues(getTypeFactory());
}
| Creates an empty asset |
@Override protected void makeCastlingMove(Move move){
FischerRandomUtils.makeCastlingMove(this,move,initialKingFile,initialShortRookFile,initialLongRookFile);
}
| Overridden to handle special FR castling rules. |
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:29:52.081 -0500",hash_original_method="0309B89A8A5C20FB439CB65AA9DE3FAA",hash_generated_method="0309B89A8A5C20FB439CB65AA9DE3FAA") void enforceSealed(){
if (!isSealed())... | Enforces that this instance is sealed. |
public void unload(){
GLES20.glDeleteShader(mVShaderHandle);
GLES20.glDeleteShader(mFShaderHandle);
GLES20.glDeleteProgram(mProgram);
}
| Unloads and deletes references to the shader program |
default <T>T newInstance(Class<T> concreteClass){
try {
return concreteClass.newInstance();
}
catch ( Exception ex) {
throw new UncheckedException(ex);
}
}
| Called to construct actor. |
@Override public boolean createFrom(final IScope scope,final List<Map<String,Object>> inits,final Integer max,final Object input,final Arguments init,final CreateStatement statement){
final GamaGridFile file=(GamaGridFile)input;
final int num=max == null ? file.length(scope) : CmnFastMath.min(file.length(scope),max... | Method createFrom() Method used to read initial values and attributes from a GRID file. |
protected void processFiles(String ext,boolean recursive,File outDir,serverObjects post,File[] inFiles,List<File> processedFiles,Map<String,Throwable> failures) throws IOException {
for ( File inFile : inFiles) {
if (inFile.isDirectory()) {
if (recursive) {
File subDir=new File(outDir,inFile.getNam... | Process inFiles and update processedFiles list and failures map. All parameters must not be null. |
private void languageComboChanged(){
String langName=(String)languageCombo.getSelectedItem();
Language language=Language.getLanguage(langName);
Language.setLoginLanguage(language);
Env.setContext(m_ctx,Env.LANGUAGE,language.getAD_Language());
Locale loc=language.getLocale();
Locale.setDefault(loc);
this.s... | Change Language |
@Override protected void prepare(){
AD_User_ID=Env.getAD_User_ID(getCtx());
p_Record_ID=getRecord_ID();
for ( ProcessInfoParameter para : getParameter()) {
String name=para.getParameterName();
if (para.getParameter() == null) ;
else if (name.equals("WM_Area_Type_ID")) {
p_WM_Area_Type_ID=p... | Get Parameters |
private void buildSpellTables(){
try {
final SpellGroupsXMLLoader loader=new SpellGroupsXMLLoader(new URI("/data/conf/spells.xml"));
List<DefaultSpell> loadedDefaultSpells=loader.load();
for ( DefaultSpell defaultSpell : loadedDefaultSpells) {
addSpell(defaultSpell);
}
}
catch ( Exception... | builds the spell tables |
public LogEventReplReader(LogRecord logRecord,Serializer serializer,boolean checkCRC) throws ReplicatorException {
this.logRecord=logRecord;
this.serializer=serializer;
this.checkCRC=checkCRC;
try {
load();
}
catch ( IOException e) {
throw new THLException("I/O error while loading log record header:... | Instantiate the reader and load header information. |
public static IndexKeyRange bounded(IndexRowType indexRowType,IndexBound lo,boolean loInclusive,IndexBound hi,boolean hiInclusive){
if (lo == null || hi == null) {
throw new IllegalArgumentException("IndexBound arguments must not be null");
}
return new IndexKeyRange(indexRowType,lo,loInclusive,hi,hiInclusive... | Describes a range of keys between lo and hi. The bounds are inclusive or not depending on loInclusive and hiInclusive. lo and hi must both be non-null. There are constraints on the bounds: - The ColumnSelectors for lo and hi must select for the same columns. - The selected columns must be leading columns of the index. |
@Override public void updateRef(int columnIndex,Ref x) throws SQLException {
throw unsupported("ref");
}
| [Not supported] |
public NavigationModel(String id){
super(id);
}
| Construct a new emtpy NavigationModel with the specified ID. |
@NotNull default B append(double d) throws BufferOverflowException {
BytesInternal.append((StreamingDataOutput)this,d);
return (B)this;
}
| Append a double in decimal notation |
@Entrypoint @UnpreemptibleNoWarn static void deliverHardwareException(int trapCode,Word trapInfo){
if (VM.verboseSignalHandling) VM.sysWriteln("delivering hardware exception");
RVMThread myThread=RVMThread.getCurrentThread();
if (VM.verboseSignalHandling) VM.sysWriteln("we have a thread = ",Magic.objectAsAddr... | Deliver a hardware exception to current java thread. <p> Does not return. (stack is unwound, starting at trap site, and execution resumes in a catch block somewhere up the stack) /or/ execution resumes at instruction following trap (for TRAP_STACK_OVERFLOW) <p> Note: Control reaches here by the actions of an exter... |
public static BigInteger[] transformRawSignature(byte[] raw) throws IOException {
BigInteger[] output=new BigInteger[2];
output[0]=new BigInteger(1,Arrays.copyOfRange(raw,0,32));
output[1]=new BigInteger(1,Arrays.copyOfRange(raw,32,64));
return output;
}
| From byte[] to Big Integers r,s UAF_ALG_SIGN_SECP256K1_ECDSA_SHA256_RAW 0x05 An ECDSA signature on the secp256k1 curve which must have raw R and S buffers, encoded in big-endian order. I.e.[R (32 bytes), S (32 bytes)] |
public static void println(Object self,Object value){
if (self instanceof Writer) {
final PrintWriter pw=new GroovyPrintWriter((Writer)self);
pw.println(value);
}
else {
System.out.println(InvokerHelper.toString(value));
}
}
| Print a value formatted Groovy style (followed by a newline) to self if it is a Writer, otherwise to the standard output stream. |
protected void checkProcessorVersion(Hashtable h){
if (null == h) h=new Hashtable();
try {
final String XALAN1_VERSION_CLASS="org.apache.xalan.xslt.XSLProcessorVersion";
Class clazz=ObjectFactory.findProviderClass(XALAN1_VERSION_CLASS,ObjectFactory.findClassLoader(),true);
StringBuffer buf=new StringB... | Report product version information from Xalan-J. Looks for version info in xalan.jar from Xalan-J products. |
public void deinstall(JEditorPane c){
c.removeCaretListener(inputAttributeUpdater);
c.removePropertyChangeListener(inputAttributeUpdater);
currentRun=null;
currentParagraph=null;
}
| Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached. |
public void dismissAndSwitch(){
final int numIcons=mIcons.length;
RecentTag tag=null;
for (int i=0; i < numIcons; i++) {
if (mIcons[i].getVisibility() != View.VISIBLE) {
break;
}
if (i == 0 || mIcons[i].hasFocus()) {
tag=(RecentTag)mIcons[i].getTag();
if (mIcons[i].hasFocus()) {
... | Dismiss the dialog and switch to the selected application. |
public byte toReal(){
return _real;
}
| Returns the real value. |
public void updateParameterInfo(@NotNull final PyArgumentList arglist,@NotNull final UpdateParameterInfoContext context){
if (context.getParameterOwner() != arglist) {
context.removeHint();
return;
}
List<PyExpression> flat_args=PyUtil.flattenedParensAndLists(arglist.getArguments());
int alleged_cursor_... | <b>Note: instead of parameter index, we directly store parameter's offset for later use.</b><br/> We cannot store an index since we cannot determine what is an argument until we actually map arguments to parameters. This is because a tuple in arguments may be a whole argument or map to a tuple parameter. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:13.915 -0500",hash_original_method="E54E1790034E06C2564EA8F8D322C604",hash_generated_method="4A4D6596F1AA464E59CD29757B0A54BF") @Deprecated public SslError(int error,SslCertificate certificate){
this(error,certificate,"");
}
| Creates a new SslError object using the supplied error and certificate. The URL will be set to the empty string. |
private static boolean hasXMPHeader(byte[] data){
if (data.length < XMP_HEADER_SIZE) {
return false;
}
try {
byte[] header=new byte[XMP_HEADER_SIZE];
System.arraycopy(data,0,header,0,XMP_HEADER_SIZE);
if (new String(header,"UTF-8").equals(XMP_HEADER)) {
return true;
}
}
catch ( Unsup... | Checks whether the byte array has XMP header. The XMP section contains a fixed length header XMP_HEADER. |
public ButtonFactory(ResourceBundle rb,ActionMap am){
super(rb);
actions=am;
}
| Creates a new button factory |
private void updateRangesFields(){
fRanges=(mask & ~(1 << 31));
fContextual=((mask & (1 << 31)) != 0);
if (fContextual) {
fRanges=(mask & ~(1 << 31));
fDefaultContextIndex=key;
}
else {
fRanges=mask;
fSingleRangeIndex=key;
}
}
| Updates all private serialized fields for object to be correctly serialized according to the serialized form of this class mentioned in the documentation. |
public void startCountdown(int sec){
mCountdownView.startCountDown(sec);
}
| Starts the countdown timer. |
public long readLongFromXML(Element node) throws Exception {
if (DEBUG) {
trace(new Throwable(),node.getAttribute(ATT_NAME));
}
m_CurrentNode=node;
return ((Long)getPrimitive(node)).longValue();
}
| builds the primitive from the given DOM node. |
public static ZeroConfService create(String type,String name,int port,int weight,int priority,HashMap<String,String> properties){
ZeroConfService s;
if (ZeroConfService.services().containsKey(ZeroConfService.key(type,name))) {
s=ZeroConfService.services().get(ZeroConfService.key(type,name));
log.debug("Usin... | Create a ZeroConfService. The property <i>version</i> is added or replaced with the current JMRI version as its value. The property <i>jmri</i> is added or replaced with the JMRI major.minor.test version string as its value. <p> If a service with the same key as the new service is already published, the original servic... |
public void cancelChallanReceiptOnCreation(final ReceiptHeader receiptHeader){
final ReceiptHeader receiptHeaderToBeCancelled=receiptHeaderService.findById(receiptHeader.getReceiptHeader().getId(),false);
receiptHeaderToBeCancelled.setStatus(collectionsUtil.getStatusForModuleAndCode(CollectionConstants.MODULE_NAME_... | This method cancels the receipt against a challan. The reason for cancellation is set and the staus is changed to CANCELLED. |
public static double nextDouble(double value,boolean increment){
return increment ? nextDouble(value) : previousDouble(value);
}
| Returns the double value which is closest to the specified double but either larger or smaller as specified. |
private void checkSourceVersionCompatibility(Source source,Log log){
SourceVersion procSourceVersion=processor.getSupportedSourceVersion();
if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0) {
log.warning("proc.processor.incompatible.source.version",procSourceVersion,Wrappers.unwrapProcessorCl... | Checks whether or not a processor's source version is compatible with the compilation source version. The processor's source version needs to be greater than or equal to the source version of the compile. |
void openPolicy(String filename) throws FileNotFoundException, PolicyParser.ParsingException, KeyStoreException, CertificateException, InstantiationException, MalformedURLException, IOException, NoSuchAlgorithmException, IllegalAccessException, NoSuchMethodException, UnrecoverableKeyException, NoSuchProviderException, ... | Open and read a policy file |
private T[] ensureCapacity(int minCapacity){
if (tmp.length < minCapacity) {
int newSize=minCapacity;
newSize|=newSize >> 1;
newSize|=newSize >> 2;
newSize|=newSize >> 4;
newSize|=newSize >> 8;
newSize|=newSize >> 16;
newSize++;
if (newSize < 0) newSize=minCapacity;
else newSi... | Ensures that the external array tmp has at least the specified number of elements, increasing its size if necessary. The size increases exponentially to ensure amortized linear time complexity. |
public static short[] toShortArray(int[] array){
short[] result=new short[array.length];
for (int i=0; i < array.length; i++) {
result[i]=(short)array[i];
}
return result;
}
| Coverts given ints array to array of shorts. |
public void deleteThreadVars() throws IOException {
print("deleteThreadVars",null);
}
| Description of the Method |
public static void main(String[] args){
try {
File testF=new File(new File(System.getProperty("user.dir")),"testOut.zip");
OutputZipper oz=new OutputZipper(testF);
oz.zipit("Here is some test text to be zipped","testzip");
oz.zipit("Here is a second entry to be zipped","testzip2");
oz.finished();
... | Main method for testing this class |
public void createOffspring(Turkanian parent){
if (parent.energy <= birthEnergy) {
return;
}
Turkanian offspring=new Turkanian(this,parent.x,parent.y);
parent.energy-=birthEnergy;
offspring.energy=0;
agents.add(offspring);
agentGrid.setObjectLocation(offspring,offspring.x,offspring.y);
schedule.sche... | Create offspring of the current agent and add them to the grid in the same cell. |
public static <T>Supplier<T> prevNoDupSupplier(final Cursor cursor,ByteArrayConverter<T> converter){
DatabaseEntry key=new DatabaseEntry();
DatabaseEntry data=new DatabaseEntry();
return null;
}
| Supplies previous key, ignore duplicates, produce the key value, NOT the associated data. |
private static void enableObjectAddressRemapper(){
Magic.setObjectAddressRemapper(BootImageObjectAddressRemapper.getInstance());
}
| Begin recording objects referenced by RVM classes during loading/resolution/instantiation. These references will be converted to bootimage addresses when those objects are copied into bootimage. |
public void transformNode(int node) throws TransformerException {
setExtensionsTable(getStylesheet());
synchronized (m_serializationHandler) {
m_hasBeenReset=false;
XPathContext xctxt=getXPathContext();
DTM dtm=xctxt.getDTM(node);
try {
pushGlobalVars(node);
StylesheetRoot stylesheet=this.... | Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature. %REVIEW% Do we need a Node version of this? |
@Override protected RdKNNEntry createRootEntry(){
return new RdKNNDirectoryEntry(0,null,Double.NaN);
}
| Creates an entry representing the root node. |
public static byte[] readBytes(Path self) throws IOException {
return Files.readAllBytes(self);
}
| Reads the content of the file into a byte array. |
public void showURLInBrowser(final URL url){
try {
if (Desktop.isDesktopSupported()) try {
Desktop.getDesktop().browse(url.toURI());
return;
}
catch ( final Exception e) {
}
String[] cmdArray=null;
if (LEnv.OS == OpSys.WINDOWS) {
cmdArray=new String[]{"rundll32","url.dll,... | Opens the web page specified by the URL in the system's default browser. |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public void addInputProducer(PValue expandedInput,TransformTreeNode producer){
checkState(!finishedSpecifying);
inputs.put(expandedInput,producer);
}
| Adds an input to the transform node. |
public Clustering<Model> run(Relation<Model> relation){
HashMap<Model,ModifiableDBIDs> modelMap=new HashMap<>();
for (DBIDIter iditer=relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
Model model=relation.get(iditer);
ModifiableDBIDs modelids=modelMap.get(model);
if (modelids == null) {
mo... | Run the actual clustering algorithm. |
String rrToString(){
StringBuffer sb=new StringBuffer();
sb.append(Type.string(covered));
sb.append(" ");
sb.append(alg);
sb.append(" ");
sb.append(labels);
sb.append(" ");
sb.append(origttl);
sb.append(" ");
if (Options.check("multiline")) sb.append("(\n\t");
sb.append(FormattedTime.format(expi... | Converts the RRSIG/SIG Record to a String |
private boolean isModel(JavaContext context,Node classDeclaration){
String classFilePackage=PackageManager.getPackage(context,classDeclaration);
return classFilePackage.contains(".models.");
}
| Check if a class is a Model (is inside a package called 'models'). |
public void addPlugin(final IPlugin<IPluginInterface> plugin){
Preconditions.checkNotNull(plugin,"Error: Plugin argument can not be null");
m_registry.addPlugin(plugin);
}
| Add a new plugin to the list of registered plugins. |
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject();
s.writeInt(table.length);
s.writeInt(count);
for (int index=table.length - 1; index >= 0; index--) {
Entry entry=table[index];
while (entry != null) {
s.writeObject(entry.key);
s.write... | Save the state of the <tt>IdentityHashMap</tt> instance to a stream (i.e., serialize it). |
@Override protected void mouseClicked(int par1,int par2,int par3) throws IOException {
super.mouseClicked(par1,par2,par3);
tokenBox.mouseClicked(par1,par2,par3);
if (tokenBox.isFocused()) {
errorText="";
helpText="";
}
}
| Called when the mouse is clicked. |
public Object call(Object object,String name,Object[] args) throws BSFException {
if (object == null) {
try {
object=interpreter.get("global");
}
catch ( EvalError e) {
throw new BSFException("bsh internal error: " + e.toString());
}
}
if (object instanceof bsh.This) {
try {
... | Invoke method name on the specified bsh scripted object. The object may be null to indicate the global namespace of the interpreter. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:30.536 -0500",hash_original_method="55F676D436FF1EC67ECC1C028E81ED27",hash_generated_method="AC9FD73229CF68305BF944740C6C29B7") private View moveSelection(int delta,int child... | Fills the grid based on positioning the new selection relative to the old selection. The new selection will be placed at, above, or below the location of the new selection depending on how the selection is moving. The selection will then be pinned to the visible part of the screen, excluding the edges that are faded. T... |
public synchronized void clear(){
super.clear();
mValue.clear();
initRange();
}
| Removes all the values from the series. |
public static void fill(int[][][] matrix,int value){
int rows=matrix.length;
for (int r=0; r < rows; r++) {
int cols=matrix[r].length;
for (int c=0; c < cols; c++) {
int height=matrix[r][c].length;
for (int h=0; h < height; h++) {
matrix[r][c][h]=value;
}
}
}
}
| Initialises all values in the matrix to the given value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.