code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public GenericFeed retrievePageOfMembers(Link next) throws AppsForYourDomainException, MalformedURLException, IOException, ServiceException {
return getNextPage(next);
}
| Retrieves next page of members of a group as a GenericFeed. |
public void deleteRow(int selectedRow){
int i=0;
for ( final TradelogDetail element : getData().getTradelogDetail()) {
if (i == selectedRow) {
getData().getTradelogDetail().remove(element);
final Vector<Object> currRow=rows.get(selectedRow);
rows.remove(currRow);
this.fireTableRowsDeleted(selectedRow,selectedRow);
break;
}
i++;
}
}
| deleteRow() - |
static String pathToCookiePath(String path){
if (path == null) {
return "/";
}
int lastSlash=path.lastIndexOf('/');
return path.substring(0,lastSlash + 1);
}
| Returns a cookie-safe path by truncating everything after the last "/". When request path like "/foo/bar.html" yields a cookie, that cookie's default path is "/foo/". |
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value="EI_EXPOSE_REP") public String[] validBaudRates(){
return validSpeeds;
}
| Get an array of valid baud rates. This is currently just a message saying its fixed |
@Override public Vertex parseEquationByteCode(Vertex equation,BinaryData data,Network network) throws IOException {
return new SelfDecompiler().parseEquationByteCode(equation,data,network);
}
| Parse the Self2 equation from bytecode. |
protected void finishFont() throws IOException {
out=writer.getOutStream();
int glyphCount=glyphByteArrays.size();
int offset=glyphCount * 2;
out.writeUI16(offset);
for (int i=0; i < glyphCount - 1; i++) {
offset+=((byte[])glyphByteArrays.get(i)).length;
out.writeUI16(offset);
}
for (int i=0; i < glyphCount; i++) {
out.write((byte[])glyphByteArrays.get(i));
}
}
| Description of the Method |
public SVG12URIResolver(SVGDocument doc,DocumentLoader dl){
super(doc,dl);
}
| Creates a new SVG12URIResolver object. |
public void localTransactionRolledback(ConnectionEvent event){
}
| Ignored event callback |
private List<Extension> matchExtensions(List<String> plugins,Extension[] extensions,String contentType){
List<Extension> extList=new ArrayList<Extension>();
if (plugins != null) {
for ( String parsePluginId : plugins) {
Extension ext=getExtension(extensions,parsePluginId,contentType);
if (ext == null) {
ext=getExtension(extensions,parsePluginId);
if (LOG.isWarnEnabled()) {
if (ext != null) {
LOG.warn("ParserFactory:Plugin: " + parsePluginId + " mapped to contentType "+ contentType+ " via parse-plugins.xml, but "+ "its plugin.xml "+ "file does not claim to support contentType: "+ contentType);
}
else {
LOG.warn("ParserFactory: Plugin: " + parsePluginId + " mapped to contentType "+ contentType+ " via parse-plugins.xml, but not enabled via "+ "plugin.includes in nutch-default.xml");
}
}
}
if (ext != null) {
extList.add(ext);
}
}
}
else {
for (int i=0; i < extensions.length; i++) {
if ("*".equals(extensions[i].getAttribute("contentType"))) {
extList.add(0,extensions[i]);
}
else if (extensions[i].getAttribute("contentType") != null && contentType.matches(escapeContentType(extensions[i].getAttribute("contentType")))) {
extList.add(extensions[i]);
}
}
if (extList.size() > 0) {
if (LOG.isInfoEnabled()) {
StringBuffer extensionsIDs=new StringBuffer("[");
boolean isFirst=true;
for ( Extension ext : extList) {
if (!isFirst) extensionsIDs.append(" - ");
else isFirst=false;
extensionsIDs.append(ext.getId());
}
extensionsIDs.append("]");
LOG.info("The parsing plugins: " + extensionsIDs.toString() + " are enabled via the plugin.includes system "+ "property, and all claim to support the content type "+ contentType+ ", but they are not mapped to it in the "+ "parse-plugins.xml file");
}
}
else if (LOG.isDebugEnabled()) {
LOG.debug("ParserFactory:No parse plugins mapped or enabled for " + "contentType " + contentType);
}
}
return (extList.size() > 0) ? extList : null;
}
| Tries to find a suitable parser for the given contentType. <ol> <li>It checks if a parser which accepts the contentType can be found in the <code>plugins</code> list;</li> <li>If this list is empty, it tries to find amongst the loaded extensions whether some of them might suit and warns the user.</li> </ol> |
public void offline(TungstenProperties params) throws Exception {
try {
doShutdown(params);
context.getEventDispatcher().put(new OfflineNotification());
}
catch ( ReplicatorException e) {
String pendingError="Replicator service shutdown failed";
if (logger.isDebugEnabled()) logger.debug(pendingError,e);
throw e;
}
catch ( Throwable e) {
String pendingError="Replicator service shutdown failed due to underlying error";
logger.error(pendingError,e);
throw new ReplicatorException(pendingError + e);
}
}
| Puts the replicator immediately into the offline state, which turns off replication. This operation is a hard shutdown that does no clean-up. If clean-up is required, call deferredShutdown() instead. |
public static String m2s(Map map){
if (isDebug) {
if (map == null) {
return "";
}
StringBuilder sb=new StringBuilder();
Set set=map.entrySet();
for ( Object aSet : set) {
Map.Entry entry=(Map.Entry)aSet;
sb.append(entry.getValue());
}
return sb.toString();
}
return "";
}
| map to str |
protected int convertText(String text,Locale locale){
return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text);
}
| Convert the specified text and locale into a value. |
public static <T>T waitForState(Supplier<T> supplier,Predicate<T> predicate,Runnable cleanup,String timeoutMessage) throws Throwable {
return waitForState(supplier,predicate,WAIT_ITERATION_SLEEP_MILLIS,WAIT_ITERATION_COUNT,cleanup,timeoutMessage);
}
| Generic wait function. |
@Override public void updateStatus(JobContext jobContext) throws Exception {
DbClient dbClient=jobContext.getDbClient();
try {
if (_status == JobStatus.IN_PROGRESS) {
return;
}
String opId=getTaskCompleter().getOpId();
_logger.info(String.format("Updating status of job %s to %s",opId,_status.name()));
URI snapId=getTaskCompleter().getId();
BlockSnapshot snapshotObj=dbClient.queryObject(BlockSnapshot.class,snapId);
if (_status == JobStatus.SUCCESS && snapshotObj != null) {
if (snapshotObj.getConsistencyGroup() != null) {
List<BlockSnapshot> snapshots=ControllerUtils.getSnapshotsPartOfReplicationGroup(snapshotObj,dbClient);
for ( BlockSnapshot snapshot : snapshots) {
processSnapshot(snapshot,dbClient);
}
}
else {
processSnapshot(snapshotObj,dbClient);
}
getTaskCompleter().ready(dbClient);
}
else if (_status == JobStatus.FAILED && snapshotObj != null) {
_logger.info(String.format("Task %s failed to delete volume snapshot: %s",opId,snapshotObj.getLabel()));
}
}
catch ( Exception e) {
_logger.error("Caught an exception while trying to updateStatus for VNXeBlockDeleteSnapshotJob",e);
setErrorStatus("Encountered an internal error during volume snapshot delete job status processing : " + e.getMessage());
}
finally {
super.updateStatus(jobContext);
}
}
| Called to update the job status when the snapshot delete job completes. |
private boolean compileSWsequenceZR(int baseRegister,int[] offsets,int[] registers){
for (int i=0; i < registers.length; i++) {
if (registers[i] != _zr) {
return false;
}
}
for (int i=1; i < offsets.length; i++) {
if (offsets[i] != offsets[i - 1] + 4) {
return false;
}
}
int offset=offsets[0];
int length=offsets.length;
do {
int copyLength=Math.min(length,FastMemory.zero.length);
mv.visitFieldInsn(Opcodes.GETSTATIC,Type.getInternalName(FastMemory.class),"zero","[I");
loadImm(0);
loadMemoryInt();
prepareMemIndex(baseRegister,offset,false,32);
loadImm(copyLength);
mv.visitMethodInsn(Opcodes.INVOKESTATIC,Type.getInternalName(System.class),"arraycopy",arraycopyDescriptor);
length-=copyLength;
offset+=copyLength;
}
while (length > 0);
return true;
}
| Compile a sequence sw $zr, n($reg) sw $zr, n+4($reg) sw $zr, n+8($reg) ... into System.arraycopy(FastMemory.zero, 0, memoryInt, (n + $reg) >> 2, length) |
public ST(String template){
this(STGroup.defaultGroup,template);
}
| Used to make templates inline in code for simple things like SQL or log records. No formal arguments are set and there is no enclosing instance. |
public Value convert(Value v){
try {
return v.convertTo(type);
}
catch ( DbException e) {
if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) {
String target=(table == null ? "" : table.getName() + ": ") + getCreateSQL();
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1,v.getSQL() + " (" + target+ ")");
}
throw e;
}
}
| Convert a value to this column's type. |
public void registerModelUpdatePeriodChangeListener(final PropertyChangeListener listener){
modelUpdatePeriodListeners.add(listener);
}
| Register a listener which is notified when the modelUpdate period value is changed. Registration is allowed only during |
public AccountHeaderBuilder withSelectionListEnabledForSingleProfile(boolean selectionListEnabledForSingleProfile){
this.mSelectionListEnabledForSingleProfile=selectionListEnabledForSingleProfile;
return this;
}
| enable or disable the selection list if there is only a single profile |
private OsmUser readUser(){
String rawUserId;
String rawUserName;
rawUserId=reader.getAttributeValue(null,ATTRIBUTE_NAME_USER_ID);
rawUserName=reader.getAttributeValue(null,ATTRIBUTE_NAME_USER);
if (rawUserId != null) {
int userId;
String userName;
userId=Integer.parseInt(rawUserId);
if (rawUserName == null) {
userName="";
}
else {
userName=rawUserName;
}
return new OsmUser(userId,userName);
}
else {
return OsmUser.NONE;
}
}
| Creates a user instance based on the current entity attributes. This includes identifying the case where no user is available. |
public static String[] values(){
return ALL_VALUES;
}
| Returns an array of all values defined in this class. |
protected boolean registerProperty(String namespaceURI,String propertyName,String type){
if (namespaceURI == null) {
throw new IllegalArgumentException("Argument namespaceURI can not be null");
}
if (propertyName == null) {
throw new IllegalArgumentException("Argument property name can not be null");
}
if (type == null) {
throw new IllegalArgumentException("Argument type can not be null");
}
if (!this.validator.isKnownType(type)) {
return false;
}
QName name=new QName(namespaceURI,propertyName);
if (this.properties.containsKey(name)) {
return false;
}
this.properties.put(name,type);
return true;
}
| Registers property with known value type |
private void mergeForceCollapse(){
while (stackSize > 1) {
int n=stackSize - 2;
if (n > 0 && runLen[n - 1] < runLen[n + 1]) n--;
mergeAt(n);
}
}
| Merges all runs on the stack until only one remains. This method is called once, to complete the sort. |
public Object deserializeObject(File file) throws FileNotFoundException, IOException, ClassNotFoundException {
logger.info("Loading cache from file: " + file.getAbsolutePath());
ObjectInputStream ois=new ObjectInputStream(new FileInputStream(file));
Object o=ois.readObject();
ois.close();
logger.info("Done.");
return o;
}
| Loads the cache from file |
public Hash(byte[] hash){
if (hash.length != 32) {
throw new IllegalArgumentException("Digest length must be 32 bytes for Hash");
}
this.bytes=new byte[32];
System.arraycopy(hash,0,this.bytes,0,32);
}
| create a Hash from a digest |
private String secondsToTime(int seconds){
String time="";
String minutesText=String.valueOf(seconds / 60);
if (minutesText.length() == 1) minutesText="0" + minutesText;
String secondsText=String.valueOf(seconds % 60);
if (secondsText.length() == 1) secondsText="0" + secondsText;
time=minutesText + ":" + secondsText;
return time;
}
| Convert seconds to time |
public void addChild(ZkDataNode child){
allChildren.add(child);
}
| Add a ZkData Node to the child. |
static char processCharLiteral(String entity) throws IOException, XMLParseException {
if (entity.charAt(2) == 'x') {
entity=entity.substring(3,entity.length() - 1);
return (char)Integer.parseInt(entity,16);
}
else {
entity=entity.substring(2,entity.length() - 1);
return (char)Integer.parseInt(entity,10);
}
}
| Processes a character literal. |
public final RegExp rev(Macros macros){
RegExp1 unary;
RegExp2 binary;
RegExp content;
switch (type) {
case sym.BAR:
binary=(RegExp2)this;
return new RegExp2(sym.BAR,binary.r1.rev(macros),binary.r2.rev(macros));
case sym.CONCAT:
binary=(RegExp2)this;
return new RegExp2(sym.CONCAT,binary.r2.rev(macros),binary.r1.rev(macros));
case sym.STAR:
unary=(RegExp1)this;
content=(RegExp)unary.content;
return new RegExp1(sym.STAR,content.rev(macros));
case sym.PLUS:
unary=(RegExp1)this;
content=(RegExp)unary.content;
return new RegExp1(sym.PLUS,content.rev(macros));
case sym.QUESTION:
unary=(RegExp1)this;
content=(RegExp)unary.content;
return new RegExp1(sym.QUESTION,content.rev(macros));
case sym.BANG:
unary=(RegExp1)this;
content=(RegExp)unary.content;
return new RegExp1(sym.BANG,content.rev(macros));
case sym.TILDE:
content=resolveTilde(macros);
return content.rev(macros);
case sym.STRING:
case sym.STRING_I:
unary=(RegExp1)this;
return new RegExp1(unary.type,revString((String)unary.content));
case sym.CHAR:
case sym.CHAR_I:
case sym.CCLASS:
case sym.CCLASSNOT:
unary=(RegExp1)this;
return new RegExp1(unary.type,unary.content);
case sym.MACROUSE:
unary=(RegExp1)this;
return macros.getDefinition((String)unary.content).rev(macros);
}
throw new Error("unknown regexp type " + type);
}
| Create a new regexp that matches the reverse text of this one. |
public final double SFMeanSchemeEntropy(){
return m_delegate.SFMeanSchemeEntropy();
}
| Returns the entropy per instance for the scheme. |
public static boolean containsOnlyAlphaDigitHyphen(final String... values){
if (values == null) {
return true;
}
return containsOnlyAlphaDigitHyphen(Arrays.asList(values));
}
| <p> This is useful since vCard 3.0 often requires the ("X-") properties and groups should contain only alphabets, digits, and hyphen. </p> <p> Note: It is already known some devices (wrongly) outputs properties with characters which should not be in the field. One example is "X-GOOGLE TALK". We accept such kind of input but must never output it unless the target is very specific to the device which is able to parse the malformed input. </p> |
public void appendBoolean(boolean val){
buf[pos++]=(byte)(val ? 1 : 0);
}
| Append a boolean value to the message. |
@SuppressWarnings({"rawtypes","unchecked"}) @Override public java_cup.runtime.Symbol do_action(int act_num,java_cup.runtime.lr_parser parser,java.util.Stack stack,int top) throws java.lang.Exception {
return action_obj.CUP$Parser$do_action(act_num,parser,stack,top);
}
| Invoke a user supplied parse action. |
public int hashCode(){
long bits=java.lang.Double.doubleToLongBits(getX());
bits+=java.lang.Double.doubleToLongBits(getY()) * 37;
bits+=java.lang.Double.doubleToLongBits(getWidth()) * 43;
bits+=java.lang.Double.doubleToLongBits(getHeight()) * 47;
return (((int)bits) ^ ((int)(bits >> 32)));
}
| Returns the hashcode for this <code>Ellipse2D</code>. |
public Epoch createEpoch(ServerViewController recManager){
epochsLock.lock();
Set<Integer> keys=epochs.keySet();
int max=-1;
for ( int k : keys) {
if (k > max) max=k;
}
max++;
Epoch epoch=new Epoch(recManager,this,max);
epochs.put(max,epoch);
epochsLock.unlock();
return epoch;
}
| Creates a epoch associated with this consensus, supposedly the next |
public void validateParseTree(DMLProgram dmlp) throws LanguageException, ParseException, IOException {
boolean fWriteRead=prepareReadAfterWrite(dmlp,new HashMap<String,DataIdentifier>());
for ( String namespaceKey : dmlp.getNamespaces().keySet()) {
for ( String fname : dmlp.getFunctionStatementBlocks(namespaceKey).keySet()) {
FunctionStatementBlock fblock=dmlp.getFunctionStatementBlock(namespaceKey,fname);
HashMap<String,ConstIdentifier> constVars=new HashMap<String,ConstIdentifier>();
VariableSet vs=new VariableSet();
FunctionStatement fstmt=(FunctionStatement)fblock.getStatement(0);
if (fblock.getNumStatements() > 1) {
LOG.error(fstmt.printErrorLocation() + "FunctionStatementBlock can only have 1 FunctionStatement");
throw new LanguageException(fstmt.printErrorLocation() + "FunctionStatementBlock can only have 1 FunctionStatement");
}
for ( DataIdentifier currVar : fstmt.getInputParams()) {
if (currVar.getDataType() == DataType.SCALAR) {
currVar.setDimensions(0,0);
}
vs.addVariable(currVar.getName(),currVar);
}
fblock.validate(dmlp,vs,constVars,false);
}
}
VariableSet vs=new VariableSet();
HashMap<String,ConstIdentifier> constVars=new HashMap<String,ConstIdentifier>();
for (int i=0; i < dmlp.getNumStatementBlocks(); i++) {
StatementBlock sb=dmlp.getStatementBlock(i);
vs=sb.validate(dmlp,vs,constVars,fWriteRead);
constVars=sb.getConstOut();
}
if (fWriteRead) {
prepareReadAfterWrite(dmlp,new HashMap<String,DataIdentifier>());
vs=new VariableSet();
constVars=new HashMap<String,ConstIdentifier>();
for (int i=0; i < dmlp.getNumStatementBlocks(); i++) {
StatementBlock sb=dmlp.getStatementBlock(i);
vs=sb.validate(dmlp,vs,constVars,fWriteRead);
constVars=sb.getConstOut();
}
}
return;
}
| Validate parse tree |
public ErrorResponse(final TimeInstant timeStamp,final Exception e,final HttpStatus status){
this(timeStamp,e.getMessage(),status.value());
}
| Creates a new error response. |
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:59:04.796 -0500",hash_original_method="152402B1F19F5AF3A149355992289F4E",hash_generated_method="5A7C233B5CE9F29C1DD832CCE8FC99D4") static Item retrieveItem(ComprehensionTlv ctlv) throws ResultException {
Item item=null;
byte[] rawValue=ctlv.getRawValue();
int valueIndex=ctlv.getValueIndex();
int length=ctlv.getLength();
if (length != 0) {
int textLen=length - 1;
try {
int id=rawValue[valueIndex] & 0xff;
String text=IccUtils.adnStringFieldToString(rawValue,valueIndex + 1,textLen);
item=new Item(id,text);
}
catch ( IndexOutOfBoundsException e) {
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
}
}
return item;
}
| Retrieves Item information from the COMPREHENSION-TLV object. |
public ECPair transform(ECPair cipherText){
if (key == null) {
throw new IllegalStateException("ECNewPublicKeyTransform not initialised");
}
ECDomainParameters ec=key.getParameters();
BigInteger n=ec.getN();
ECMultiplier basePointMultiplier=createBasePointMultiplier();
BigInteger k=ECUtil.generateK(n,random);
ECPoint[] gamma_phi=new ECPoint[]{basePointMultiplier.multiply(ec.getG(),k),key.getQ().multiply(k).add(cipherText.getY())};
ec.getCurve().normalizeAll(gamma_phi);
return new ECPair(gamma_phi[0],gamma_phi[1]);
}
| Transform an existing cipher text pair using the ElGamal algorithm. Note: the input cipherText will need to be preserved in order to complete the transformation to the new public key. |
@SuppressWarnings("UnusedReturnValue") public boolean signOut(Context ctx,String providerName){
Context appContext=ctx.getApplicationContext();
CookieManager cookieManager=CookieManager.getInstance();
cookieManager.removeAllCookie();
if (providerName != null) {
if (socialAuthManager.getConnectedProvidersIds().contains(providerName)) socialAuthManager.disconnectProvider(providerName);
Editor edit=PreferenceManager.getDefaultSharedPreferences(appContext).edit();
edit.remove(providerName + " key");
edit.apply();
Log.d("SocialAuthAdapter","Disconnecting Provider");
return true;
}
else {
Log.d("SocialAuthAdapter","The provider name should be same");
return false;
}
}
| Signs out the user out of current provider |
public static void debug(String trace){
log.debug(trace);
}
| Used to debug program action. Actually shorthand for <br> <code> Tracer.trace(trace, Tracer.DEBUG) </code> |
public static void startCalendarMetafeedSync(Account account){
Bundle extras=new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL,true);
extras.putBoolean("metafeedonly",true);
ContentResolver.requestSync(account,Calendars.CONTENT_URI.getAuthority(),extras);
}
| Checks the server for an updated list of Calendars (in the background). If a Calendar is added on the web (and it is selected and not hidden) then it will be added to the list of calendars on the phone (when this finishes). When a new calendar from the web is added to the phone, then the events for that calendar are also downloaded from the web. This sync is done automatically in the background when the SelectCalendars activity and fragment are started. |
public static byte[] toBytes(String value){
return doToBytes(value,"UTF-8");
}
| Encodes the given string as bytes in UTF-8 encoding. |
public Builder newBuilder(){
return new Builder(this);
}
| Creates a new Builder using the current values. |
public void addAll(Iterator<? extends Number> values){
while (values.hasNext()) {
add(values.next().doubleValue());
}
}
| Adds the given values to the dataset. |
public List<Integer> emit(Tuple anchor,List<Object> tuple){
return emit(Utils.DEFAULT_STREAM_ID,anchor,tuple);
}
| Emits a new tuple to the default stream anchored on a single tuple. The emitted values must be immutable. |
public static double squarePointsToMillis(double area){
return squareInchToMillis(squarePointsToInch(area));
}
| Converts an area measure in points to square millimeters. |
public FilledList(final Collection<? extends T> collection){
super(collection);
for ( final T t : collection) {
Preconditions.checkNotNull(t,"Error: Can not add null-elements to filled lists");
}
}
| Creates a filled list from a collection. |
public MLetObjectInputStream(InputStream in,MLet loader) throws IOException, StreamCorruptedException {
super(in);
if (loader == null) {
throw new IllegalArgumentException("Illegal null argument to MLetObjectInputStream");
}
this.loader=loader;
}
| Loader must be non-null; |
public boolean isShowingPopup(){
return getListPopupWindow().isShowing();
}
| Gets whether the popup window with activities is shown. |
public WebPermission(String name,String... roles){
this(name,null,roles);
}
| New instance requiring an authenticated user with specific roles. |
public void clear(){
messages=Collections.emptyList();
isMessagesListMutable=false;
if (builders != null) {
for ( SingleFieldBuilder<MType,BType,IType> entry : builders) {
if (entry != null) {
entry.dispose();
}
}
builders=null;
}
onChanged();
incrementModCounts();
}
| Removes all of the elements from this list. The list will be empty after this call returns. |
private byte deltaMarkState(boolean increment){
byte mask=(byte)(((1 << Options.markSweepMarkBits.getValue()) - 1) << COUNT_BASE);
byte rtn=(byte)(increment ? markState + MARK_COUNT_INCREMENT : markState - MARK_COUNT_INCREMENT);
rtn&=mask;
if (VM.VERIFY_ASSERTIONS) VM.assertions._assert((markState & ~MARK_COUNT_MASK) == 0);
return rtn;
}
| Return the mark state incremented or decremented by one. |
@Override public void eUnset(int featureID){
switch (featureID) {
case SexecPackage.TIME_EVENT__PERIODIC:
setPeriodic(PERIODIC_EDEFAULT);
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static void saveClassBackup(String className,ClassLoader loader,byte[] classBytes) throws IOException {
long t0=System.nanoTime();
try {
File bkpFile=getClassFile(className,loader);
if (bkpFile.exists()) {
throw new Profiler4JError("Backup file already exists: " + bkpFile);
}
Log.print(2,"saving backup " + bkpFile);
FileOutputStream fos=new FileOutputStream(bkpFile);
BufferedOutputStream bos=new BufferedOutputStream(fos);
bos.write(classBytes);
bos.close();
}
finally {
long dt=System.nanoTime() - t0;
totalWriteTime.addAndGet(dt);
}
}
| Saves the bytes of a given class in the backup directory. |
public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity,GT_Recipe aRecipe,boolean aNotUnificated,long aVoltage,FluidStack[] aFluids,ItemStack aSpecialSlot,ItemStack... aInputs){
if (mRecipeList.isEmpty()) return null;
if (GregTech_API.sPostloadFinished) {
if (mMinimalInputFluids > 0) {
if (aFluids == null) return null;
int tAmount=0;
for ( FluidStack aFluid : aFluids) if (aFluid != null) tAmount++;
if (tAmount < mMinimalInputFluids) return null;
}
if (mMinimalInputItems > 0) {
if (aInputs == null) return null;
int tAmount=0;
for ( ItemStack aInput : aInputs) if (aInput != null) tAmount++;
if (tAmount < mMinimalInputItems) return null;
}
}
if (aNotUnificated) aInputs=GT_OreDictUnificator.getStackArray(true,(Object[])aInputs);
if (aRecipe != null) if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false,true,aFluids,aInputs)) return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null;
if (mUsualInputCount > 0 && aInputs != null) for ( ItemStack tStack : aInputs) if (tStack != null) {
Collection<GT_Recipe> tRecipes=mRecipeItemMap.get(new GT_ItemStack(tStack));
if (tRecipes != null) for ( GT_Recipe tRecipe : tRecipes) if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false,true,aFluids,aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null;
tRecipes=mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W,tStack)));
if (tRecipes != null) for ( GT_Recipe tRecipe : tRecipes) if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false,true,aFluids,aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null;
}
if (mMinimalInputItems == 0 && aFluids != null) for ( FluidStack aFluid : aFluids) if (aFluid != null) {
Collection<GT_Recipe> tRecipes=mRecipeFluidMap.get(aFluid.getFluid());
if (tRecipes != null) for ( GT_Recipe tRecipe : tRecipes) if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false,true,aFluids,aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null;
}
return null;
}
| finds a Recipe matching the aFluid and ItemStack Inputs. |
public CUDA_TEXTURE_DESC(){
}
| Creates a new, uninitialized CUDA_TEXTURE_DESC |
final public int hashCode(){
final char[] a=pattern;
final int l=a.length;
int h;
for (int i=h=0; i < l; i++) h=31 * h + a[i];
return h;
}
| Returns a hash code for this text pattern. <P>The hash code of a text pattern is the same as that of a <code>String</code> with the same content (suitably lower cased, if the pattern is case insensitive). |
public static JNIWriter instance(Context context){
JNIWriter instance=context.get(jniWriterKey);
if (instance == null) instance=new JNIWriter(context);
return instance;
}
| Get the ClassWriter instance for this context. |
public BusinessObjectFormatCreateRequest createBusinessObjectFormatCreateRequest(String namespaceCode,String businessObjectDefinitionName,String businessObjectFormatUsage,String businessObjectFormatFileType,String partitionKey,String description,List<Attribute> attributes,List<AttributeDefinition> attributeDefinitions,Schema schema){
BusinessObjectFormatCreateRequest businessObjectFormatCreateRequest=new BusinessObjectFormatCreateRequest();
businessObjectFormatCreateRequest.setNamespace(namespaceCode);
businessObjectFormatCreateRequest.setBusinessObjectDefinitionName(businessObjectDefinitionName);
businessObjectFormatCreateRequest.setBusinessObjectFormatUsage(businessObjectFormatUsage);
businessObjectFormatCreateRequest.setBusinessObjectFormatFileType(businessObjectFormatFileType);
businessObjectFormatCreateRequest.setPartitionKey(partitionKey);
businessObjectFormatCreateRequest.setDescription(description);
businessObjectFormatCreateRequest.setAttributes(attributes);
businessObjectFormatCreateRequest.setAttributeDefinitions(attributeDefinitions);
businessObjectFormatCreateRequest.setSchema(schema);
return businessObjectFormatCreateRequest;
}
| Creates a business object format create request. |
public void clear(){
oredCriteria.clear();
orderByClause=null;
distinct=false;
}
| This method was generated by MyBatis Generator. This method corresponds to the database table comment |
public static void addQueryOrTemplateCalls(Resource cls,Property predicate,List<QueryOrTemplateCall> results){
List<Statement> ss=JenaUtil.listAllProperties(cls,predicate).toList();
if (ss.isEmpty() && cls != null && cls.isURIResource()) {
Template template=SPINModuleRegistry.get().getTemplate(cls.getURI(),null);
if (template != null) {
ss=JenaUtil.listAllProperties(template,predicate).toList();
}
}
for ( Statement s : ss) {
if (s.getObject().isResource()) {
TemplateCall templateCall=SPINFactory.asTemplateCall(s.getResource());
if (templateCall != null) {
results.add(new QueryOrTemplateCall(cls,templateCall));
}
else {
Query query=SPINFactory.asQuery(s.getResource());
if (query != null) {
results.add(new QueryOrTemplateCall(cls,query));
}
}
}
}
}
| Collects all queries or template calls at a given class. |
public static void main(String[] args){
int n=StdIn.readInt();
int source=2 * n;
int sink=2 * n + 1;
EdgeWeightedDigraph G=new EdgeWeightedDigraph(2 * n + 2);
for (int i=0; i < n; i++) {
double duration=StdIn.readDouble();
G.addEdge(new DirectedEdge(source,i,0.0));
G.addEdge(new DirectedEdge(i + n,sink,0.0));
G.addEdge(new DirectedEdge(i,i + n,duration));
int m=StdIn.readInt();
for (int j=0; j < m; j++) {
int precedent=StdIn.readInt();
G.addEdge(new DirectedEdge(n + i,precedent,0.0));
}
}
AcyclicLP lp=new AcyclicLP(G,source);
StdOut.println(" job start finish");
StdOut.println("--------------------");
for (int i=0; i < n; i++) {
StdOut.printf("%4d %7.1f %7.1f\n",i,lp.distTo(i),lp.distTo(i + n));
}
StdOut.printf("Finish time: %7.1f\n",lp.distTo(sink));
}
| Reads the precedence constraints from standard input and prints a feasible schedule to standard output. |
private void initResponseSource() throws IOException {
responseSource=ResponseSource.NETWORK;
if (!policy.getUseCaches()) return;
OkResponseCache responseCache=client.getOkResponseCache();
if (responseCache == null) return;
CacheResponse candidate=responseCache.get(uri,method,requestHeaders.getHeaders().toMultimap(false));
if (candidate == null) return;
Map<String,List<String>> responseHeadersMap=candidate.getHeaders();
cachedResponseBody=candidate.getBody();
if (!acceptCacheResponseType(candidate) || responseHeadersMap == null || cachedResponseBody == null) {
Util.closeQuietly(cachedResponseBody);
return;
}
RawHeaders rawResponseHeaders=RawHeaders.fromMultimap(responseHeadersMap,true);
cachedResponseHeaders=new ResponseHeaders(uri,rawResponseHeaders);
long now=System.currentTimeMillis();
this.responseSource=cachedResponseHeaders.chooseResponseSource(now,requestHeaders);
if (responseSource == ResponseSource.CACHE) {
this.cacheResponse=candidate;
setResponse(cachedResponseHeaders,cachedResponseBody);
}
else if (responseSource == ResponseSource.CONDITIONAL_CACHE) {
this.cacheResponse=candidate;
}
else if (responseSource == ResponseSource.NETWORK) {
Util.closeQuietly(cachedResponseBody);
}
else {
throw new AssertionError();
}
}
| Initialize the source for this response. It may be corrected later if the request headers forbids network use. |
public boolean startDrag(int position,int deltaX,int deltaY){
int dragFlags=0;
if (mSortEnabled && !mIsRemoving) {
dragFlags|=DragSortListView.DRAG_POS_Y | DragSortListView.DRAG_NEG_Y;
}
if (mRemoveEnabled && mIsRemoving) {
dragFlags|=DragSortListView.DRAG_POS_X;
dragFlags|=DragSortListView.DRAG_NEG_X;
}
mDragging=mDslv.startDrag(position - mDslv.getHeaderViewsCount(),dragFlags,deltaX,deltaY);
return mDragging;
}
| Sets flags to restrict certain motions of the floating View based on DragSortController settings (such as remove mode). Starts the drag on the DragSortListView. |
public void put(String key,String value){
editor.putString(key,value);
editor.commit();
}
| Stores the given key-value pair in the Murmur generic store. |
public void updateSizes(int size){
if (size == LARGE) {
setSizeParameters(CIRCLE_DIAMETER_LARGE,CIRCLE_DIAMETER_LARGE,CENTER_RADIUS_LARGE,STROKE_WIDTH_LARGE,ARROW_WIDTH_LARGE,ARROW_HEIGHT_LARGE);
}
else {
setSizeParameters(CIRCLE_DIAMETER,CIRCLE_DIAMETER,CENTER_RADIUS,STROKE_WIDTH,ARROW_WIDTH,ARROW_HEIGHT);
}
}
| Set the overall size for the progress spinner. This updates the radius and stroke width of the ring. |
public static long rotateLeft(long l,int shift){
return (l << shift) | l >>> (64 - shift);
}
| Rotate long left by shift bits. bits rotated off to the left are put back on the right |
boolean satisfies(SSAOptions d){
if (!scalarValid) {
return false;
}
if (d.getScalarsOnly()) {
return true;
}
if (!heapValid) {
return false;
}
if (backwards != d.getBackwards()) {
return false;
}
if (insertUsePhis != d.getInsertUsePhis()) {
return false;
}
if (insertPEIDeps != d.getInsertPEIDeps()) {
return false;
}
if (excludeGuards != d.getExcludeGuards()) {
return false;
}
if (heapTypes != d.getHeapTypes()) {
return false;
}
return true;
}
| Given a desired set of SSA Options, does this set of SSA Options describe enough information to satisfy the desire? |
public boolean isAbstract_1(){
return abstract_1;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public synchronized Object put(Object key,Object value){
if (key == null) return null;
if (value == null) return remove(key);
String stringKey=key.toString();
String stringValue=value.toString();
int index=m_keys.indexOf(key);
if (index != -1) return m_values.set(index,stringValue);
m_values.add(stringKey);
m_values.add(stringValue);
return null;
}
| Put key/value |
public static int size(){
return _size;
}
| Number of columns (non terminals) in every row. |
protected boolean isSoLingerChanged(){
return true;
}
| Returns <tt>true</tt> if and only if the <tt>soLinger</tt> property has been changed by its setter method. The system call related with the property is made only when this method returns <tt>true</tt>. By default, this method always returns <tt>true</tt> to simplify implementation of subclasses, but overriding the default behavior is always encouraged. |
@Override public void agentActed(Agent agent,Action command,Environment source){
String msg="";
if (env.getAgents().size() > 1) msg="A" + env.getAgents().indexOf(agent) + ": ";
notify(msg + command.toString());
if (command instanceof MoveToAction) {
updateTrack(agent,getMapEnv().getAgentLocation(agent));
}
}
| Reacts on environment changes and updates the tracks. |
final public boolean isPrimaryIndex(){
return this == SPO || this == SPOC;
}
| Return <code>true</code> if this is the primary index for the relation. |
public HtmlRegularNode addSimpleNode(String tag,String text){
HtmlRegularNode t=simpleNode(tag,text);
addBodyNode(t);
return t;
}
| Add a node of any type that contains a string |
@Override public String toString(){
String val=new String();
val="Report(messageId=";
val+=messageId;
val+=")";
return val;
}
| Useful for debugging purposes. |
private void noSuccessor(){
if (compute == FRAMES) {
Label l=new Label();
l.frame=new Frame();
l.frame.owner=l;
l.resolve(this,code.length,code.data);
previousBlock.successor=l;
previousBlock=l;
}
else {
currentBlock.outputStackMax=maxStackSize;
}
currentBlock=null;
}
| Ends the current basic block. This method must be used in the case where the current basic block does not have any successor. |
public void windowClosing(java.awt.event.WindowEvent e){
doneButtonActionPerformed();
}
| Do the done action if the window is closed early. |
public void backfill() throws InterruptedException, GondolaException {
MessagePool pool=gondola.getMessagePool();
Rid rid=new Rid();
Rid savedRid=new Rid();
while (true) {
channel.awaitOperational();
int startIndex=-1;
cmember.saveQueue.getLatestWait(savedRid);
lock.lock();
try {
if (backfilling && backfillAhead < backfillAheadLimit) {
if (nextIndex > savedRid.index) {
logger.info("[{}-{}] Backfilling {} at index {} paused to allow storage (index={}) to catch up",gondola.getHostId(),cmember.memberId,peerId,nextIndex,savedRid.index);
backfillAhead=backfillAheadLimit;
}
else {
startIndex=nextIndex;
}
}
}
finally {
lock.unlock();
}
int count=0;
Message message=null;
if (startIndex > 0) {
LogEntry le=getLogEntry(startIndex - 1);
if (le == null) {
throw new IllegalStateException(String.format("[%s-%d] Could not retrieve index=%d to backfill %d. savedIndex=%d",gondola.getHostId(),cmember.memberId,startIndex - 1,peerId,savedRid.index));
}
rid.set(le.term,le.index);
le.release();
le=getLogEntry(startIndex);
if (le == null) {
throw new IllegalStateException(String.format("[%s-%d] Could not retrieve index=%d to backfill %d. savedIndex=%d",gondola.getHostId(),cmember.memberId,startIndex,peerId,savedRid.index));
}
message=pool.checkout();
try {
message.appendEntryRequest(cmember.memberId,cmember.currentTerm,rid,cmember.commitIndex,le.term,le.buffer,0,le.size);
le.release();
count++;
while (fullSpeed && startIndex + count < backfillToIndex) {
le=getLogEntry(startIndex + count);
if (le == null) {
break;
}
else if (le.term != rid.term || !message.canBatch(le.size)) {
le.release();
break;
}
message.appendEntryBatch(le.buffer,0,le.size);
le.release();
count++;
}
}
catch ( Exception e) {
message.release();
throw e;
}
}
else if (clock.now() >= lastSentTs + heartbeatPeriod) {
message=pool.checkout();
message.heartbeat(cmember.memberId,cmember.currentTerm,savedRid,cmember.commitIndex);
lastSentTs=clock.now();
}
lock.lock();
try {
if (message != null) {
if (backfilling) {
addOutQueue(message);
}
message.release();
if (startIndex == nextIndex) {
nextIndex=startIndex + count;
if (nextIndex == backfillToIndex) {
backfilling=false;
logger.info("[{}-{}] Backfilling {} to {} is done",gondola.getHostId(),cmember.memberId,peerId,backfillToIndex - 1);
}
}
backfillAhead++;
}
if (!backfilling || backfillAhead >= backfillAheadLimit) {
backfillCond.await(heartbeatPeriod,TimeUnit.MILLISECONDS);
}
}
finally {
lock.unlock();
}
}
}
| There are three stages in this method: 1. Determine where to start backfilling for this peer. 2. Construct a single message filled with batched commands. 3. Send the message and update state. |
public Element store(Object o){
MergSD2SignalHead p=(MergSD2SignalHead)o;
Element element=new Element("signalhead");
element.setAttribute("class",this.getClass().getName());
element.setAttribute("systemName",p.getSystemName());
element.addContent(new Element("systemName").addContent(p.getSystemName()));
element.setAttribute("aspects",p.getAspects() + "");
if (p.getFeather()) {
element.setAttribute("feather","yes");
}
storeCommon(p,element);
int aspects=p.getAspects();
switch (aspects) {
case 2:
element.addContent(addTurnoutElement(p.getInput1(),"input1"));
if (!p.getHome()) {
element.setAttribute("home","no");
}
break;
case 3:
element.addContent(addTurnoutElement(p.getInput1(),"input1"));
element.addContent(addTurnoutElement(p.getInput2(),"input2"));
break;
case 4:
element.addContent(addTurnoutElement(p.getInput1(),"input1"));
element.addContent(addTurnoutElement(p.getInput2(),"input2"));
element.addContent(addTurnoutElement(p.getInput3(),"input3"));
break;
default :
log.error("incorrect number of aspects " + aspects + " for Signal "+ p.getDisplayName());
}
return element;
}
| Default implementation for storing the contents of a MergSD2SignalHead |
static String parseRoleIdentifier(final String trackingId){
if (StringUtil.isNullOrWhiteSpace(trackingId) || !trackingId.contains(TRACKING_ID_TOKEN_SEPARATOR)) {
return null;
}
return trackingId.substring(trackingId.indexOf(TRACKING_ID_TOKEN_SEPARATOR));
}
| parses ServiceBus role identifiers from trackingId |
public final void connectTarget(boolean secure){
if (this.connected) {
throw new IllegalStateException("Already connected.");
}
this.connected=true;
this.secure=secure;
}
| Tracks connecting to the target. |
public static String computeCodebase(String name,String jarFile,int port,String srcRoot,String mdAlgorithm) throws IOException {
if (name == null) throw new NullPointerException("name cannot be null");
if (jarFile == null) throw new NullPointerException("jarFile cannot be null");
if (port < 0) throw new IllegalArgumentException("port cannot be negative");
boolean doHttpmd=true;
if ((mdAlgorithm == null) || (("").equals(mdAlgorithm)) || (("off").equals(mdAlgorithm))|| (("none").equals(mdAlgorithm))) {
doHttpmd=false;
}
if (doHttpmd && (srcRoot == null)) {
throw new NullPointerException("srcRoot cannot be null when constructing " + "an HTTPMD codebase");
}
String codebase=null;
String ipAddr=name;
try {
ipAddr=NicUtil.getIpAddress(name);
}
catch ( Exception e) {
logger.log(Level.TRACE,name + " - not a valid " + "network interface, assuming host name");
}
if (doHttpmd) {
String httpmdUrl="httpmd://" + ipAddr + ":"+ port+ "/"+ jarFile+ ";"+ mdAlgorithm+ "=0";
codebase=HttpmdUtil.computeDigestCodebase(srcRoot,httpmdUrl);
;
}
else {
codebase="http://" + ipAddr + ":"+ port+ "/"+ jarFile;
}
logger.log(Level.TRACE,"codebase = " + codebase);
return codebase;
}
| Using the given parameters in the appropriate manner, this method constructs and returns a <code>String</code> whose value is a valid Java RMI <i>codebase</i> specification. This method returns a codebase supporting one of two possible protocols: the standard <i>http</i> protocol, or the Jini <i>httpmd</i> protocol; which was created to support codebase integrity when running a remote service configured for secure code downloading. <p> The <code>mdAlgorithm</code> parameter is used to indicate to this method which type of codebase should be constructed and returned. If <code>null</code> is input to <code>mdAlgorithm</code>, or if it has one of the values "none", "off", or "" (the empty <code>String</code>), then this method will construct and returned a standard HTTP-based codebase; otherwise, an HTTPMD-based codebase will constructed and returned. <p> Note that the <code>name</code> parameter is handled specially by this method. The value input to that <code>String</code> parameter is interpretted in one of two ways by this method: <p><ul> <li> The name of the local <i>network interface</i> over which the class server will communicate with clients requesting the associated service's downloadable classes through the codebase returned by this method. <li> The local <i>or remote</i> IP address or name of the <i>host</i> on which the class server is running and serving the associated service's classes. </ul></p> This method first treats the value of the <code>name</code> parameter as a network interface, attempting to determine that interface's corresponding IP address. Should that attempt fail, then this method then assumes that the caller intended this parameter to be interpretted as an IP address or host name; in which case, this method uses the value of the parameter as the <i>address/host</i> component of codebase being constructed. <p> This method is intended to provide a convenient mechanism for constructing a service's codebase from within a Jini configuration file. To support both development and deployment scenarios, it is important to be able to flexibly construct such codebases from either a local network interface specification or from a specification that represents the name of a remote host running a shared codebase class server on the appropriate network. |
public static ComponentUI createUI(JComponent c){
return xWindowsButtonUI;
}
| Creates the ui. |
public int size(){
return size;
}
| Returns buffer size. |
public Restricted(int i){
cusip=1000000000 - i;
String[] arr1={"moving","binding","non binding","not to exceed","storage","auto transport","mortgage"};
quoteType=arr1[i % 7];
uniqueQuoteType="quoteType" + Integer.toString(i);
price=(i / 10) * 8;
minQty=i + 100;
maxQty=i + 1000;
if ((i % 12) == 0) {
incQty=maxQty - minQty;
}
else {
incQty=((maxQty - minQty) / 12) * (i % 12);
}
}
| Creates a new instance of Restricted |
public boolean canExtractItem(int slot,ItemStack stack,int side){
return slot > 2;
}
| Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side |
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 ApexClassCodeCoverageBean[] calculateAggregatedCodeCoverageUsingToolingAPI(){
PartnerConnection connection=ConnectionHandler.getConnectionHandlerInstance().getConnection();
ApexClassCodeCoverageBean[] apexClassCodeCoverageBeans=null;
String[] classesAsArray=null;
if (CommandLineArguments.getClassManifestFiles() != null) {
LOG.debug(" Fetching apex classes from location : " + CommandLineArguments.getClassManifestFiles());
classesAsArray=ApexClassFetcherUtils.fetchApexClassesFromManifestFiles(CommandLineArguments.getClassManifestFiles(),true);
}
if (CommandLineArguments.getSourceRegex() != null) {
LOG.debug(" Fetching apex classes with regex : " + CommandLineArguments.getSourceRegex());
classesAsArray=ApexClassFetcherUtils.fetchApexClassesBasedOnMultipleRegexes(connection,classesAsArray,CommandLineArguments.getSourceRegex(),true);
}
if (classesAsArray != null && classesAsArray.length > 0) {
String classArrayAsStringForQuery=processClassArrayForQuery(classesAsArray);
String relativeServiceURL="/services/data/v" + SUPPORTED_VERSION + "/tooling";
String soqlcc=QueryConstructor.getAggregatedCodeCoverage(classArrayAsStringForQuery);
JSONObject responseJsonObject=null;
responseJsonObject=WebServiceInvoker.doGet(relativeServiceURL,soqlcc,OAuthTokenGenerator.getOrgToken());
LOG.debug("responseJsonObject says " + responseJsonObject + "\n relativeServiceURL is "+ relativeServiceURL+ "\n soqlcc is "+ soqlcc);
if (responseJsonObject != null) {
apexClassCodeCoverageBeans=processJSONResponseAndConstructCodeCoverageBeans(connection,responseJsonObject);
}
if (apexClassCodeCoverageBeans == null) {
ApexUnitUtils.shutDownWithErrMsg("Code coverage metrics not computed. Null object returned while processing the JSON response from the Tooling API");
}
}
else {
ApexUnitUtils.shutDownWithErrMsg("No/Invalid Apex source classes mentioned in manifest file and/or " + "regex pattern for ApexSourceClassPrefix didn't return any Apex source class names from the org");
}
return apexClassCodeCoverageBeans;
}
| Calculate Aggregated code coverage results for the Apex classes using Tooling API's |
public boolean[] readBoolArray(final int items) throws IOException {
int pos=0;
byte[] buffer;
if (items < 0) {
buffer=new byte[INITIAL_ARRAY_BUFFER_SIZE];
while (true) {
final int read=this.read(buffer,pos,buffer.length - pos);
if (read < 0) {
break;
}
pos+=read;
if (buffer.length == pos) {
final byte[] newbuffer=new byte[buffer.length << 1];
System.arraycopy(buffer,0,newbuffer,0,buffer.length);
buffer=newbuffer;
}
}
}
else {
buffer=new byte[items];
int len=items;
while (len > 0) {
final int read=this.read(buffer,pos,len);
if (read < 0) {
throw new EOFException("Have read only " + pos + " bit portions instead of "+ items);
}
pos+=read;
len-=read;
}
}
final boolean[] result=new boolean[pos];
for (int i=0; i < pos; i++) {
result[i]=buffer[i] != 0;
}
return result;
}
| Read array of boolean values. |
@Deprecated public int deleteNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
SharedNotebook sharedNotebook=getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());
Long[] ids={sharedNotebook.getId()};
getAsyncClient().getClient().expungeSharedNotebooks(getAuthenticationToken(),Arrays.asList(ids));
return getAsyncPersonalClient().getClient().expungeLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(),linkedNotebook.getGuid());
}
| Providing a LinkedNotebook referencing a linked account, perform a delete. Synchronous call |
private void mergeCollapse(){
while (stackSize > 1) {
int n=stackSize - 2;
if (n > 0 && runLen[n - 1] <= runLen[n] + runLen[n + 1]) {
if (runLen[n - 1] < runLen[n + 1]) n--;
mergeAt(n);
}
else if (runLen[n] <= runLen[n + 1]) {
mergeAt(n);
}
else {
break;
}
}
}
| Examines the stack of runs waiting to be merged and merges adjacent runs until the stack invariants are reestablished: 1. runLen[i - 3] > runLen[i - 2] + runLen[i - 1] 2. runLen[i - 2] > runLen[i - 1] This method is called each time a new run is pushed onto the stack, so the invariants are guaranteed to hold for i < stackSize upon entry to the method. |
public IterativeTrainingPanel(final NetworkPanel networkPanel,final IterableTrainer trainer){
iterativeControls=new IterativeControlsPanel(networkPanel,trainer);
if (trainer != null) {
trainingSetPanel=new TrainingSetPanel(trainer.getTrainableNetwork(),3);
}
else {
trainingSetPanel=new TrainingSetPanel();
}
setLayout(new GridBagLayout());
GridBagConstraints wholePanelConstraints=new GridBagConstraints();
wholePanelConstraints.anchor=GridBagConstraints.FIRST_LINE_START;
wholePanelConstraints.fill=GridBagConstraints.HORIZONTAL;
wholePanelConstraints.insets=new Insets(10,10,10,10);
wholePanelConstraints.weightx=0;
wholePanelConstraints.weighty=0.5;
wholePanelConstraints.gridx=0;
wholePanelConstraints.gridy=0;
add(iterativeControls,wholePanelConstraints);
wholePanelConstraints.anchor=GridBagConstraints.PAGE_START;
wholePanelConstraints.fill=GridBagConstraints.BOTH;
wholePanelConstraints.insets=new Insets(10,10,10,10);
wholePanelConstraints.weightx=1;
wholePanelConstraints.weighty=0.5;
wholePanelConstraints.gridx=1;
wholePanelConstraints.gridy=0;
add(trainingSetPanel,wholePanelConstraints);
}
| Construct a rule chooser panel. |
@Override public void report(){
Instrumentation.disableInstrumentation();
VM.sysWrite("Printing " + dataName + ":\n");
VM.sysWrite("--------------------------------------------------\n");
double total=0;
double methodEntryTotal=0;
double backedgeTotal=0;
for ( String stringName : stringToCounterMap.keySet()) {
Integer counterNum=stringToCounterMap.get(stringName);
double count=getCounter(counterNum);
VM.sysWrite(count + " " + stringName+ "\n");
total+=count;
if (stringName.indexOf("METHOD ENTRY") != -1) {
methodEntryTotal+=count;
}
if (stringName.indexOf("BACKEDGE") != -1) {
backedgeTotal+=count;
}
}
VM.sysWrite("Total backedges: " + backedgeTotal + "\n");
VM.sysWrite("Method Entry Total: " + methodEntryTotal + "\n");
VM.sysWrite("Total Yieldpoints: " + total + "\n");
}
| Called at end when data should dump its contents. |
public String numClustersTipText(){
return "set number of clusters. -1 to select number of clusters " + "automatically by cross validation.";
}
| Returns the tip text for this property |
@Override public synchronized boolean isClosed(){
return mBitmaps == null;
}
| Returns whether this instance is closed. |
public void drawTitle(Canvas canvas,int x,int y,int width,Paint paint){
if (mRenderer.isShowLabels()) {
paint.setColor(mRenderer.getLabelsColor());
paint.setTextAlign(Align.CENTER);
paint.setTextSize(mRenderer.getChartTitleTextSize());
drawString(canvas,mRenderer.getChartTitle(),x + width / 2,y + mRenderer.getChartTitleTextSize(),paint);
}
}
| The graphical representation of the round chart title. |
public RpcClient peerWith(String host,int port,Bootstrap bootstrap,Map<String,Object> attributes) throws IOException {
InetSocketAddress remoteAddress=new InetSocketAddress(host,port);
return peerWith(remoteAddress,bootstrap,attributes);
}
| Create a new client with the given attributes to the remoteAddress. |
protected void afterInit(SiteRun run) throws Exception {
}
| Invoked after site init is called. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.