code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public ArrowBuf retain(BufferAllocator target){
if (isEmpty) {
return this;
}
if (BaseAllocator.DEBUG) {
historicalLog.recordEvent("retain(%s)",target.getName());
}
final BufferLedger otherLedger=this.ledger.getLedgerForAllocator(target);
return otherLedger.newArrowBuf(offset,length,null);
}
| Create a new ArrowBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting. This has no impact on the reference counting for the current ArrowBuf except in the situation where the passed in Allocator is the same as the current buffer. This operation has no impact on the reference count of this ArrowBuf. The newly created ArrowBuf with either have a reference count of 1 (in the case that this is the first time this memory is being associated with the new allocator) or the current value of the reference count + 1 for the other AllocationManager/BufferLedger combination in the case that the provided allocator already had an association to this underlying memory. |
public static String toJson(Object o) throws Exception {
return objectMapper.writeValueAsString(o);
}
| Convert an object to JSON using Jackson's ObjectMapper |
public static MosaicDefinition createMosaicDefinition(final NamespaceId namespaceId,final int id,final MosaicProperties properties){
return createMosaicDefinition(generateRandomAccount(),createMosaicId(namespaceId,id),properties);
}
| Creates a mosaic definition that conforms to a certain pattern. |
protected static void succeed(){
System.exit(0);
}
| Exit with a process success code. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:12.079 -0500",hash_original_method="0C0B9FED7DBC124A25298101B6DEE56A",hash_generated_method="C1C8DA392CEC67EC532791FA766D3B44") public BrowserFrame(Context context,WebViewCore w,CallbackProxy proxy,WebSettings settings,Map<String,Object> javascriptInterfaces){
Context appContext=context.getApplicationContext();
if (sJavaBridge == null) {
sJavaBridge=new JWebCoreJavaBridge();
ActivityManager am=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
if (am.getMemoryClass() > 16) {
sJavaBridge.setCacheSize(8 * 1024 * 1024);
}
else {
sJavaBridge.setCacheSize(4 * 1024 * 1024);
}
CacheManager.init(appContext);
CookieSyncManager.createInstance(appContext);
PluginManager.getInstance(appContext);
}
if (sConfigCallback == null) {
sConfigCallback=new ConfigCallback((WindowManager)appContext.getSystemService(Context.WINDOW_SERVICE));
ViewRootImpl.addConfigCallback(sConfigCallback);
}
sConfigCallback.addHandler(this);
mJavaScriptObjects=javascriptInterfaces;
if (mJavaScriptObjects == null) {
mJavaScriptObjects=new HashMap<String,Object>();
}
mRemovedJavaScriptObjects=new HashSet<Object>();
mSettings=settings;
mContext=context;
mCallbackProxy=proxy;
mDatabase=WebViewDatabase.getInstance(appContext);
mWebViewCore=w;
mSearchBox=new SearchBoxImpl(mWebViewCore,mCallbackProxy);
mJavaScriptObjects.put(SearchBoxImpl.JS_INTERFACE_NAME,mSearchBox);
AssetManager am=context.getAssets();
nativeCreateFrame(w,am,proxy.getBackForwardList());
if (DebugFlags.BROWSER_FRAME) {
Log.v(LOGTAG,"BrowserFrame constructor: this=" + this);
}
}
| Create a new BrowserFrame to be used in an application. |
private static boolean isBetterLocation(Location location,Location currentBestLocation){
if (currentBestLocation == null) {
return true;
}
long timeDelta=location.getTime() - currentBestLocation.getTime();
boolean isSignificantlyNewer=timeDelta > TWO_MINUTES;
boolean isSignificantlyOlder=timeDelta < -TWO_MINUTES;
if (isSignificantlyOlder) {
return false;
}
int accuracyDelta=(int)(location.getAccuracy() - currentBestLocation.getAccuracy());
boolean isMoreAccurate=accuracyDelta < 0;
boolean isSameAccuracy=accuracyDelta == 0;
boolean isSame=accuracyDelta == 0 && location.getAltitude() == currentBestLocation.getAltitude() && location.getLongitude() == currentBestLocation.getLongitude();
if (isMoreAccurate) {
return true;
}
else if ((isSignificantlyNewer || isSameAccuracy) && !isSame) {
return true;
}
return false;
}
| From the SDK documentation. Determines whether one Location reading is better than the current Location fix |
@SuppressWarnings("fallthrough") public static int murmurhash3_x86_32(byte[] data,int offset,int len,int seed){
final int c1=0xcc9e2d51;
final int c2=0x1b873593;
int h1=seed;
int roundedEnd=offset + (len & 0xfffffffc);
for (int i=offset; i < roundedEnd; i+=4) {
int k1=(data[i] & 0xff) | ((data[i + 1] & 0xff) << 8) | ((data[i + 2] & 0xff) << 16)| (data[i + 3] << 24);
k1*=c1;
k1=Integer.rotateLeft(k1,15);
k1*=c2;
h1^=k1;
h1=Integer.rotateLeft(h1,13);
h1=h1 * 5 + 0xe6546b64;
}
int k1=0;
switch (len & 0x03) {
case 3:
k1=(data[roundedEnd + 2] & 0xff) << 16;
case 2:
k1|=(data[roundedEnd + 1] & 0xff) << 8;
case 1:
k1|=(data[roundedEnd] & 0xff);
k1*=c1;
k1=Integer.rotateLeft(k1,15);
k1*=c2;
h1^=k1;
}
h1^=len;
h1^=h1 >>> 16;
h1*=0x85ebca6b;
h1^=h1 >>> 13;
h1*=0xc2b2ae35;
h1^=h1 >>> 16;
return h1;
}
| Returns the MurmurHash3_x86_32 hash. Original source/tests at https://github.com/yonik/java_util/ |
private static void saveKey(final BigInteger mod,final BigInteger exp,final Path path) throws Exception {
try (final DataOutputStream out=new DataOutputStream(Files.newOutputStream(path))){
out.writeInt(RsaConsts.KEY_SIZE_BITS);
byte[] buff=mod.toByteArray();
out.writeInt(buff.length);
out.write(buff);
buff=exp.toByteArray();
out.writeInt(buff.length);
out.write(buff);
}
}
| Saves a key to the specified file. |
@AfterMethod public void cleanUp() throws IOException {
root.setApplicationId(-1);
root.setBusinessTransactionId(-1);
}
| Clean test folder after each test. |
public boolean isLoadMembers(){
return loadMembers;
}
| Checks if is load members. |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
@Suspendable public static <T>Handler<T> fiberHandler(Handler<T> handler){
FiberScheduler scheduler=getContextScheduler();
return null;
}
| Convert a standard handler to a handler which runs on a fiber. This is necessary if you want to do fiber blocking synchronous operations in your handler. |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public static String stripExtension(String filename){
int idx=filename.indexOf('.');
if (idx != -1) {
filename=filename.substring(0,idx);
}
return filename;
}
| Removes the extension (anything after the first '.'), otherwise returns the original filename. |
public DtoAttributeGroupServiceImpl(final AttributeGroupService attributeGroupService,final DtoFactory dtoFactory,final AdaptersRepository adaptersRepository){
super(dtoFactory,attributeGroupService,adaptersRepository);
}
| Construct service |
protected POInfo initPO(Properties ctx){
return null;
}
| Init Persistent Object. You would NOT create this method as it is created by the persistency class generated by GenerateModel.java |
public boolean addGpsTags(double latitude,double longitude){
ExifTag latTag=buildTag(TAG_GPS_LATITUDE,toExifLatLong(latitude));
ExifTag longTag=buildTag(TAG_GPS_LONGITUDE,toExifLatLong(longitude));
ExifTag latRefTag=buildTag(TAG_GPS_LATITUDE_REF,latitude >= 0 ? ExifInterface.GpsLatitudeRef.NORTH : ExifInterface.GpsLatitudeRef.SOUTH);
ExifTag longRefTag=buildTag(TAG_GPS_LONGITUDE_REF,longitude >= 0 ? ExifInterface.GpsLongitudeRef.EAST : ExifInterface.GpsLongitudeRef.WEST);
if (latTag == null || longTag == null || latRefTag == null || longRefTag == null) {
return false;
}
setTag(latTag);
setTag(longTag);
setTag(latRefTag);
setTag(longRefTag);
return true;
}
| Creates and sets all to the GPS tags for a give latitude and longitude. |
public void push(final V value) throws IndexOutOfBoundsException {
if (top + locals >= values.length) {
throw new IndexOutOfBoundsException("Insufficient maximum stack size.");
}
values[top++ + locals]=value;
}
| Pushes a value into the operand stack of this frame. |
public GVector(double vector[],int length){
this.length=length;
values=new double[length];
for (int i=0; i < length; i++) {
values[i]=vector[i];
}
}
| Constructs a new GVector of the specified length and initializes it by copying the specified number of elements from the specified array. The array must contain at least <code>length</code> elements (i.e., <code>vector.length</code> >= <code>length</code>. The length of this new GVector is set to the specified length. |
public static BinaryExpression newAssignmentExpression(Variable variable,Expression rhs){
VariableExpression lhs=new VariableExpression(variable);
Token operator=Token.newPlaceholder(Types.ASSIGN);
return new BinaryExpression(lhs,operator,rhs);
}
| Creates an assignment expression in which the specified expression is written into the specified variable name. |
public option addElement(String element){
addElementToRegistry(element);
return (this);
}
| Adds an Element to the element. |
@SuppressWarnings("unchecked") public boolean equals(final Object o){
if (this == o) return true;
if (!(o instanceof Bundle)) return false;
final Bundle<F> t=(Bundle<F>)o;
if (keyOrder == t.keyOrder) return false;
if (compareTo(t) != 0) return false;
if (!bindingSet.equals(t.bindingSet)) return false;
if (!asBound.equals(t.asBound)) return false;
return true;
}
| Implemented to shut up findbugs, but not used. |
public static String format(int[] a,String sep){
return (a == null) ? "null" : (a.length == 0) ? "" : formatTo(new StringBuilder(),a,sep).toString();
}
| Formats the int array a for printing purposes. |
protected void addResult(final NamedAttachable obj,final int quantity){
if (!(obj instanceof UnitType) && !(obj instanceof Resource)) {
throw new IllegalArgumentException("results must be units or resources, not:" + obj.getClass().getName());
}
m_results.put(obj,quantity);
}
| Benefits must be a resource or a unit. |
@Override public ConfigurationNode createEmptyNode(ConfigurationOptions options){
return SimpleConfigurationNode.root(options);
}
| Return an empty node of the most appropriate type for this loader |
public LibraryException(final Throwable cause){
super(cause);
QL.error(this);
}
| Constructs a new runtime exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). |
public AccessStructure(String user,jplagWebService.server.Option usr_option) throws JPlagException {
dec=new StatusDecorator(new Status());
submissionID=JPlagCentral.getNextSubmissionID();
commandLineInString=generateCMD(usr_option);
username=user;
title=usr_option.getTitle();
date=System.currentTimeMillis();
generateStructure(usr_option,commandLineInString);
}
| Constructs a new AccessStructure object for an Option |
public final boolean contentEquals(java.lang.CharSequence csq){
if (csq.length() != _length) return false;
for (int i=0; i < _length; ) {
char c=i < C1 ? _low[i] : _high[i >> B1][i & M1];
if (csq.charAt(i++) != c) return false;
}
return true;
}
| Indicates if this text builder has the same character content as the specified character sequence. |
private int compareLiterals(final Literal leftLit,final Literal rightLit){
if (!QueryEvaluationUtil.isStringLiteral(leftLit) || !QueryEvaluationUtil.isStringLiteral(rightLit)) {
try {
boolean isSmaller=QueryEvaluationUtil.compareLiterals(leftLit,rightLit,CompareOp.LT);
if (isSmaller) {
return -1;
}
else {
return 1;
}
}
catch ( ValueExprEvaluationException e) {
}
}
int result=0;
URI leftDatatype=leftLit.getDatatype();
URI rightDatatype=rightLit.getDatatype();
if (leftDatatype != null) {
if (rightDatatype != null) {
result=compareDatatypes(leftDatatype,rightDatatype);
}
else {
result=1;
}
}
else if (rightDatatype != null) {
result=-1;
}
if (result == 0) {
String leftLanguage=leftLit.getLanguage();
String rightLanguage=rightLit.getLanguage();
if (leftLanguage != null) {
if (rightLanguage != null) {
result=leftLanguage.compareTo(rightLanguage);
}
else {
result=1;
}
}
else if (rightLanguage != null) {
result=-1;
}
}
if (result == 0) {
result=leftLit.getLabel().compareTo(rightLit.getLabel());
}
return result;
}
| Taken directly from Sesame's ValueComparator, no modification. Handles inlines nicely since they now implement the Literal interface. |
private void jbInit() throws Exception {
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
fResource.addActionListener(this);
delete.addActionListener(this);
confirmPanel.addButton(delete);
confirmPanel.addActionListener(this);
mainPanel.setLayout(mainLayout);
mainPanel.add(lResource,new GridBagConstraints(0,0,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(8,8,4,4),0,0));
mainPanel.add(fResource,new GridBagConstraints(1,0,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(8,0,4,4),0,0));
mainPanel.add(lDate,new GridBagConstraints(0,1,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(2,8,4,4),0,0));
mainPanel.add(fDateFrom,new GridBagConstraints(1,1,2,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(2,0,4,8),100,0));
mainPanel.add(lQty,new GridBagConstraints(0,2,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(2,8,4,4),0,0));
mainPanel.add(fQty,new GridBagConstraints(1,2,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(2,0,4,4),0,0));
mainPanel.add(lUOM,new GridBagConstraints(2,2,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(2,4,4,8),0,0));
mainPanel.add(lName,new GridBagConstraints(0,3,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(2,8,4,4),0,0));
mainPanel.add(lDescription,new GridBagConstraints(0,4,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(2,8,8,4),0,0));
mainPanel.add(fName,new GridBagConstraints(1,3,2,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(2,0,4,8),0,0));
mainPanel.add(fDescription,new GridBagConstraints(1,4,2,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(2,0,8,8),0,0));
this.getContentPane().add(mainPanel,BorderLayout.CENTER);
this.getContentPane().add(confirmPanel,BorderLayout.SOUTH);
}
| Static Init |
public Boolean isEnableAPDTimeoutForHosts(){
return enableAPDTimeoutForHosts;
}
| Gets the value of the enableAPDTimeoutForHosts property. |
@Deprecated @Override public final String readLine() throws IOException {
return dis.readLine();
}
| Read a line. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public void disconnect() throws SQLException, NoConnectionException {
if (connection != null) connection.close();
throw new NoConnectionException();
}
| Disconnects the administrator from the database |
public boolean cancelAlarm(Intent scheduledIntent){
PendingIntent pendingIntent=PendingIntent.getService(mContext,0,scheduledIntent,PendingIntent.FLAG_NO_CREATE);
if (pendingIntent != null) {
AlarmManager am=(AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
am.cancel(pendingIntent);
pendingIntent.cancel();
return true;
}
else {
return false;
}
}
| Attempts to cancel any alarms set using the given Intent. |
public void testUnconcernedParentIsNotError() throws Exception {
assertEquals(NO_WARNINGS,lintClassFile("bin/classes/ExampleApi.class"));
}
| Test that a java file where a subscription is made in a class that is not a leak concern. |
public void run(){
try {
while (events < expectedEvents) {
ReplDBMSEvent rde=queue.get();
long seqno=rde.getSeqno();
if (seqno > maxSeqno) maxSeqno=seqno;
events++;
if ((events % 10000) == 0) {
logger.info("Consuming events: events=" + events + " maxSeqno="+ maxSeqno);
}
}
logger.info("Finished reading events from queue: events=" + events + " maxSeqno="+ maxSeqno);
}
catch ( InterruptedException e) {
logger.info("Event consumer task loop interrupted");
}
catch ( Exception e) {
logger.error("Consumer loop failed!",e);
exception=e;
}
catch ( Throwable t) {
logger.error("Consumer loop failed!",t);
}
finally {
done=true;
}
}
| Run until there are no more events. |
public V remove(Object key){
if (key == null) {
return null;
}
purgeBeforeWrite();
return super.remove(key);
}
| Removes the specified mapping from this map. |
public boolean isEnum(){
return false;
}
| Determines whether this object represents an enum. It returns <code>true</code> if this object represents an enum. |
protected void openActivePart(@NotNull PartStackType partStackType){
PartStack partStack=partStacks.get(partStackType);
partStack.openPreviousActivePart();
}
| Opens previous active tab on current perspective. |
public ImageRequest(String url,Response.Listener<Bitmap> listener,int maxWidth,int maxHeight,Config decodeConfig,Response.ErrorListener errorListener){
super(Method.GET,url,errorListener);
setRetryPolicy(new DefaultRetryPolicy(IMAGE_TIMEOUT_MS,IMAGE_MAX_RETRIES,IMAGE_BACKOFF_MULT));
mListener=listener;
mDecodeConfig=decodeConfig;
mMaxWidth=maxWidth;
mMaxHeight=maxHeight;
}
| Creates a new image request, decoding to a maximum specified width and height. If both width and height are zero, the image will be decoded to its natural size. If one of the two is nonzero, that dimension will be clamped and the other one will be set to preserve the image's aspect ratio. If both width and height are nonzero, the image will be decoded to be fit in the rectangle of dimensions width x height while keeping its aspect ratio. |
public ItemGuardCreature(final Creature copy,final String itemType){
this(copy,itemType,null,null,0);
}
| Creates an ItemGuardCreature. |
public Builder degreeDistribution(final Distribution degree){
this.edgeDegree=degree;
return this;
}
| Sets the distribution to be used to generate the out-degrees of vertices. |
public void addListener(DiscoveryManagerListener listener){
for ( ConnectableDevice device : compatibleDevices.values()) {
listener.onDeviceAdded(this,device);
}
discoveryListeners.add(listener);
}
| Listener which should receive discovery updates. It is not necessary to set this listener property unless you are implementing your own device picker. Connect SDK provides a default DevicePicker which acts as a DiscoveryManagerListener, and should work for most cases. If you have provided a capabilityFilters array, the listener will only receive update messages for ConnectableDevices which satisfy at least one of the CapabilityFilters. If no capabilityFilters array is provided, the listener will receive update messages for all ConnectableDevice objects that are discovered. |
protected Class<?> determineDatabaseDialectClass(Database database){
switch (database) {
case ORACLE:
return org.babyfish.hibernate.dialect.Oracle10gDialect.class;
case DB2:
return DB2Dialect.class;
case DERBY:
return DerbyDialect.class;
case H2:
return H2Dialect.class;
case HSQL:
return HSQLDialect.class;
case INFORMIX:
return InformixDialect.class;
case MYSQL:
return MySQLDialect.class;
case POSTGRESQL:
return PostgreSQLDialect.class;
case SQL_SERVER:
return SQLServerDialect.class;
case SYBASE:
return SybaseDialect.class;
default :
return null;
}
}
| Determine the Hibernate database dialect class for the given target database. |
public void checkLastSticky(final int position){
bounceRecyclerView.clearSticky();
for (int i=0; i <= position; i++) {
WXComponent component=getChild(i);
if (component.isSticky() && component instanceof WXCell) {
if (component.getHostView() == null) {
return;
}
bounceRecyclerView.notifyStickyShow((WXCell)component);
}
}
}
| Check last Sticky after scrollTo |
@NotNull public static <T>Class<T> wrap(@NotNull Class<T> type){
Class<?> result=(type == boolean.class) ? Boolean.class : (type == byte.class) ? Byte.class : (type == char.class) ? Character.class : (type == short.class) ? Short.class : (type == int.class) ? Integer.class : (type == long.class) ? Long.class : (type == float.class) ? Float.class : (type == double.class) ? Double.class : type;
@SuppressWarnings("unchecked") Class<T> casted=(Class<T>)result;
return casted;
}
| Returns the corresponding wrapper type for a primitive type, or the type itself if it is not a primitive type. |
public void writeByte(byte b) throws TException {
writeByteDirect(b);
}
| Write a byte. Nothing to see here! |
@Override public Token nextToken(){
Token t=super.nextToken();
while (t.getType() == STLexer.NEWLINE || t.getType() == STLexer.INDENT) {
t=super.nextToken();
}
return t;
}
| Throw out \n and indentation tokens inside BIGSTRING_NO_NL |
public void waitForResponse(int timeoutSec) throws Exception {
if (futureResponse == null) {
throw new CodedException(X_INTERNAL_ERROR,"Request uninitialized");
}
LOG.trace("waitForResponse()");
try {
HttpResponse response=futureResponse.get(timeoutSec,TimeUnit.SECONDS);
handleResponse(response);
}
catch ( TimeoutException e) {
cancelRequest();
throw new CodedException(X_NETWORK_ERROR,"Connection timed out");
}
catch ( Exception e) {
handleFailure(e);
}
finally {
futureResponse=null;
PerformanceLogger.log(LOG,"waitForResponse() done");
}
}
| Will block until response becomes available in the future. |
static void clearImage(BufferedImage img){
Graphics2D g2=img.createGraphics();
g2.setComposite(AlphaComposite.Clear);
g2.fillRect(0,0,img.getWidth(),img.getHeight());
g2.dispose();
}
| Clear a transparent image to 100% transparent |
public AttributeSet(int initialCapacity){
regularAttributes=new ArrayList<Attribute>(initialCapacity);
}
| Creates an empty attribute set. |
private void removeCommittedOrCanceledMigrations(String migrationPaths) throws VPlexApiException {
URI requestURI=_vplexApiClient.getBaseURI().resolve(VPlexApiConstants.URI_REMOVE_MIGRATIONS);
s_logger.info("Remove migrations URI is {}",requestURI.toString());
ClientResponse response=null;
try {
s_logger.info("Removing migrations");
Map<String,String> argsMap=new HashMap<String,String>();
argsMap.put(VPlexApiConstants.ARG_DASH_M,migrationPaths);
JSONObject postDataObject=VPlexApiUtils.createPostData(argsMap,true);
s_logger.info("Remove migrations POST data is {}",postDataObject.toString());
response=_vplexApiClient.post(requestURI,postDataObject.toString());
String responseStr=response.getEntity(String.class);
s_logger.info("Remove migrations response is {}",responseStr);
if (response.getStatus() != VPlexApiConstants.SUCCESS_STATUS) {
if (response.getStatus() == VPlexApiConstants.ASYNC_STATUS) {
s_logger.info("Remove migrations is completing asynchronously");
_vplexApiClient.waitForCompletion(response);
}
else {
String cause=VPlexApiUtils.getCauseOfFailureFromResponse(responseStr);
throw VPlexApiException.exceptions.removeMigrationsFailureStatus(migrationPaths,String.valueOf(response.getStatus()),cause);
}
}
s_logger.info("Successfully removed migrations {}",migrationPaths);
}
catch ( VPlexApiException vae) {
throw vae;
}
catch ( Exception e) {
throw VPlexApiException.exceptions.failedRemoveMigrations(migrationPaths,e);
}
finally {
if (response != null) {
response.close();
}
}
}
| Removes the records for the canceled and/or committed migrations identified by the passed concatenated string of migration context paths |
private boolean isSpecial(String subreddit){
for ( String specialSubreddit : UserSubscriptions.specialSubreddits) {
if (subreddit.equalsIgnoreCase(specialSubreddit)) return true;
}
return false;
}
| Subreddits with important behaviour - frontpage, all, random, etc. |
public DailyTimeIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes){
withInterval(intervalInMinutes,IntervalUnit.MINUTE);
return this;
}
| Specify an interval in the IntervalUnit.MINUTE that the produced Trigger will repeat at. |
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. |
protected static String prettyPrintObject(LzPersistentBaseImpl<? extends GenericPK> object,PrettyPrintOptions options){
if (object == null) return "{undefined metric}";
if (options == null || options.getStyle() == ReferenceStyle.LEGACY) {
return "[" + AnalysisScope.MEASURE.getToken() + ":'"+ object.getName()+ "']";
}
else if (options != null && options.getStyle() == ReferenceStyle.NAME) {
return PrettyPrintConstant.OPEN_IDENT + object.getName() + PrettyPrintConstant.CLOSE_IDENT;
}
else {
return PrettyPrintConstant.IDENTIFIER_TAG + PrettyPrintConstant.OPEN_IDENT + object.getOid()+ PrettyPrintConstant.CLOSE_IDENT;
}
}
| utility method to pretty-print a object id |
public static OneCameraManager provideOneCameraManager() throws OneCameraException {
Optional<Camera2OneCameraManagerImpl> camera2HwManager=Camera2OneCameraManagerImpl.create();
if (camera2HwManager.isPresent()) {
return camera2HwManager.get();
}
Optional<LegacyOneCameraManagerImpl> legacyHwManager=LegacyOneCameraManagerImpl.instance();
if (legacyHwManager.isPresent()) {
return legacyHwManager.get();
}
throw new OneCameraException("No hardware manager is available.");
}
| Creates a new hardware manager that is based on Camera2 API, if available. |
public void centerViewTo(int xIndex,float yValue,AxisDependency axis){
float valsInView=getDeltaY(axis) / mViewPortHandler.getScaleY();
float xsInView=getXAxis().getValues().size() / mViewPortHandler.getScaleX();
Runnable job=new MoveViewJob(mViewPortHandler,xIndex - xsInView / 2f,yValue + valsInView / 2f,getTransformer(axis),this);
if (mViewPortHandler.hasChartDimens()) {
post(job);
}
else {
mJobs.add(job);
}
}
| This will move the center of the current viewport to the specified x-index and y-value. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
int extraFilterArgs=curNumberOfParameters - 3;
final java.util.ArrayList extraArgs=new java.util.ArrayList();
while (extraFilterArgs-- > 0) extraArgs.add(stack.pop());
boolean invertRes=false;
invertRes=!evalBool(stack.pop());
String filterMethName=getString(stack);
Object dataObj=stack.pop();
if (dataObj == null) return null;
java.util.ArrayList filtMeths=new java.util.ArrayList();
java.util.StringTokenizer toker=new java.util.StringTokenizer(filterMethName," |");
while (toker.hasMoreTokens()) {
filtMeths.add(Catbert.getAPI().get(toker.nextToken()));
}
if (dataObj instanceof java.util.Collection || dataObj instanceof java.util.Map) {
java.util.Collection currData;
if (dataObj instanceof java.util.Collection) currData=(java.util.Collection)dataObj;
else currData=((java.util.Map)dataObj).keySet();
java.util.Iterator walker=currData.iterator();
if ("HasMediaMask".equals(filterMethName) && extraArgs.size() == 1) {
int mediaMask=DBObject.getMediaMaskFromString(extraArgs.get(0).toString());
while (walker.hasNext()) {
if (invertRes == filterTestHasMediaMask(walker.next(),mediaMask)) walker.remove();
}
}
else if ("IsCompleteRecording|IsManualRecord".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestCompleteOrMR(walker.next())) walker.remove();
}
}
else if ("IsChannelViewable".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestChannelViewable(walker.next())) walker.remove();
}
}
else if ("IsMovie".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestIsMovie(walker.next())) walker.remove();
}
}
else if ("HasSeriesImage".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestHasSeriesImage(walker.next())) walker.remove();
}
}
else if ("IsFavorite".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestIsFavorite(walker.next())) walker.remove();
}
}
else if ("IsMediaFileObject".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestIsMediaFileObject(walker.next())) walker.remove();
}
}
else if ("IsWatched".equals(filterMethName)) {
while (walker.hasNext()) {
if (invertRes == filterTestIsWatched(walker.next())) walker.remove();
}
}
else {
while (walker.hasNext()) {
Object currObj=walker.next();
boolean testResult=false;
for (int j=0; j < filtMeths.size(); j++) {
sage.jep.function.PostfixMathCommandI filtMeth=(sage.jep.function.PostfixMathCommandI)filtMeths.get(j);
stack.push(currObj);
for (int i=extraArgs.size() - 1; i >= 0; i--) stack.push(extraArgs.get(i));
filtMeth.setCurNumberOfParameters(1 + extraArgs.size());
filtMeth.run(stack);
if (((Boolean)stack.pop()).booleanValue()) {
testResult=true;
break;
}
}
if (invertRes == testResult) walker.remove();
}
}
return dataObj;
}
else {
Object[] currData=(Object[])dataObj;
Class filterClass=currData.getClass().getComponentType();
java.util.ArrayList passedData=new java.util.ArrayList();
if ("HasMediaMask".equals(filterMethName) && extraArgs.size() == 1) {
int mediaMask=DBObject.getMediaMaskFromString(extraArgs.get(0).toString());
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestHasMediaMask(currData[j],mediaMask)) passedData.add(currData[j]);
}
}
else if ("AreAiringsSameShow".equals(filterMethName) && extraArgs.size() == 1) {
Airing match=getAirObj(extraArgs.get(0));
for (int j=0; j < currData.length; j++) {
if (invertRes != BigBrother.areSameShow(getAirObj(currData[j]),match,false)) passedData.add(currData[j]);
}
}
else if ("IsCompleteRecording|IsManualRecord".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestCompleteOrMR(currData[j])) passedData.add(currData[j]);
}
}
else if ("IsChannelViewable".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestChannelViewable(currData[j])) passedData.add(currData[j]);
}
}
else if ("IsMovie".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestIsMovie(currData[j])) passedData.add(currData[j]);
}
}
else if ("HasSeriesImage".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestHasSeriesImage(currData[j])) passedData.add(currData[j]);
}
}
else if ("IsFavorite".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestIsFavorite(currData[j])) passedData.add(currData[j]);
}
}
else if ("IsMediaFileObject".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestIsMediaFileObject(currData[j])) passedData.add(currData[j]);
}
}
else if ("IsWatched".equals(filterMethName)) {
for (int j=0; j < currData.length; j++) {
if (invertRes != filterTestIsWatched(currData[j])) passedData.add(currData[j]);
}
}
else {
for (int i=0; i < currData.length; i++) {
boolean testResult=false;
for (int j=0; j < filtMeths.size(); j++) {
sage.jep.function.PostfixMathCommandI filtMeth=(sage.jep.function.PostfixMathCommandI)filtMeths.get(j);
stack.push(currData[i]);
for (int k=extraArgs.size() - 1; k >= 0; k--) stack.push(extraArgs.get(k));
filtMeth.setCurNumberOfParameters(1 + extraArgs.size());
filtMeth.run(stack);
if (((Boolean)stack.pop()).booleanValue()) {
testResult=true;
break;
}
}
if (invertRes != testResult) passedData.add(currData[i]);
}
}
return passedData.toArray((Object[])java.lang.reflect.Array.newInstance(filterClass,passedData.size()));
}
}
| Filters data by a boolean method. Each element in the 'Data' has the 'Method' executed on it. If the result is the same as the 'MatchValue' parameter then that element will be in the returned data. For Maps & Collections this is done in place. For Arrays a new Array is created. NOTE: If you pass more than 3 arguments to this function then the extra arguments will be passed along to the Method that should be executed. |
@Deprecated public static String encode(final String s,final String encoding,BitSet safeOctets,boolean plusForSpace) throws UnsupportedEncodingException {
StringBuilder out=new StringBuilder(s.length() * 2);
boolean needsEncoding;
try {
needsEncoding=encode(s,encoding,safeOctets,plusForSpace,out);
}
catch ( UnsupportedEncodingException e) {
throw e;
}
catch ( IOException e) {
throw new AssertionError(e);
}
if (needsEncoding) {
return out.toString();
}
else {
return s;
}
}
| URL-escapes s by encoding it with the specified character encoding, and then escaping all octets not included in safeOctets. |
@POST @Path("/{machineId}/context/events") public Response submitEvent(@PathParam("machineId") String machineId,@QueryParam("searchField") String searchField,EventData eventData) throws Exception {
logger.info("Received event: {} for state machine: {}",eventData.getName(),machineId);
if (searchField != null) {
if (!searchField.equals(CORRELATION_ID)) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
workFlowExecutionController.postEvent(eventData,null,machineId);
}
else {
workFlowExecutionController.postEvent(eventData,Long.valueOf(machineId),null);
}
return Response.status(Response.Status.ACCEPTED.getStatusCode()).build();
}
| Used to post Data corresponding to an event. This data may be a result of a task getting completed or independently posted (manually, for example) |
public void removeSessionParticipantByUrl(String sessionParticipantUrl){
Validate.notNull(sessionParticipantUrl);
if (participantsByUrl.containsKey(sessionParticipantUrl)) {
String participant=this.participantsByUrl.get(sessionParticipantUrl).getSessionId();
this.participants.remove(participant);
this.participantsByUrl.remove(sessionParticipantUrl);
}
}
| Remove session participant by its URL |
public static void copyDirectory(Object requestor,@NotNull VirtualFile fromDir,@NotNull VirtualFile toDir,@Nullable VirtualFileFilter filter) throws IOException {
@SuppressWarnings("UnsafeVfsRecursion") VirtualFile[] children=fromDir.getChildren();
for ( VirtualFile child : children) {
if (!child.is(VFileProperty.SYMLINK) && !child.is(VFileProperty.SPECIAL) && (filter == null || filter.accept(child))) {
if (!child.isDirectory()) {
copyFile(requestor,child,toDir);
}
else {
VirtualFile newChild=toDir.findChild(child.getName());
if (newChild == null) {
newChild=toDir.createChildDirectory(requestor,child.getName());
}
copyDirectory(requestor,child,newChild,filter);
}
}
}
}
| Copies all files matching the <code>filter</code> from <code>fromDir</code> to <code>toDir</code>. Symlinks end special files are ignored. |
public static int findTag(byte tag,byte[] value){
int length=0;
if (value == null) {
return -1;
}
int index=0;
while ((index < value.length) && (value[index] != tag)) {
length=value[index + 1] & 0xFF;
index+=length + 2;
}
if (index >= value.length) {
return -1;
}
return index;
}
| Finds the index that starts the tag value pair in the byte array provide. |
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. |
private void removeAllBodiesAction(){
int choice=JOptionPane.showConfirmDialog(ControlUtilities.getParentWindow(this),Messages.getString("menu.context.bodyFolder.removeAll.warning"),Messages.getString("menu.context.bodyFolder.removeAll.warning.title"),JOptionPane.YES_NO_CANCEL_OPTION);
if (choice == JOptionPane.YES_OPTION) {
synchronized (Simulation.LOCK) {
this.simulation.getWorld().removeAllBodies();
this.simulation.getContactCounter().clear();
}
this.bodyFolder.removeAllChildren();
this.jointFolder.removeAllChildren();
this.model.reload(this.bodyFolder);
this.model.reload(this.jointFolder);
this.notifyActionListeners("clear-all");
}
}
| Shows a confirmation message to make sure the user wants to proceed. <p> If the user accepts, all bodies are removed. |
public void testXmlGeneration() throws Exception {
XmlGenerator.generate("org.apache.ignite.schema.test.model",pojos,true,true,new File(OUT_DIR_PATH,TEST_XML_FILE_NAME),YES_TO_ALL);
assertTrue("Generated XML file content is differ from expected one",compareFilesInt(getClass().getResourceAsStream("/org/apache/ignite/schema/test/model/" + TEST_XML_FILE_NAME),new File(OUT_DIR_PATH,TEST_XML_FILE_NAME),"XML generated by Apache Ignite Schema Import utility"));
}
| Test that XML generated correctly. |
public void addComparator(Comparator<T> comparator,boolean ascending){
this.comparators.add(new InvertibleComparator<T>(comparator,ascending));
}
| Add a Comparator to the end of the chain using the provided sort order. |
public static final LabelSet[] convert(LabelSet[] sparseY,HashMap<LabelSet,Integer> map){
return null;
}
| Given N labelsets 'sparseY', use a count 'map' to |
@Override public boolean equals(final Object obj){
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CacheControl other=(CacheControl)obj;
if (this.privateFlag != other.privateFlag) {
return false;
}
if (this.privateFields != other.privateFields && (this.privateFields == null || !this.privateFields.equals(other.privateFields))) {
return false;
}
if (this.noCache != other.noCache) {
return false;
}
if (this.noCacheFields != other.noCacheFields && (this.noCacheFields == null || !this.noCacheFields.equals(other.noCacheFields))) {
return false;
}
if (this.noStore != other.noStore) {
return false;
}
if (this.noTransform != other.noTransform) {
return false;
}
if (this.mustRevalidate != other.mustRevalidate) {
return false;
}
if (this.proxyRevalidate != other.proxyRevalidate) {
return false;
}
if (this.maxAge != other.maxAge) {
return false;
}
if (this.sMaxAge != other.sMaxAge) {
return false;
}
if (this.cacheExtension != other.cacheExtension && (this.cacheExtension == null || !this.cacheExtension.equals(other.cacheExtension))) {
return false;
}
if (this.publicFlag != other.publicFlag) {
return false;
}
return true;
}
| Compares object argument to this cache control to see if they are the same considering all property values. |
@Override public void visit(NodeVisitor v){
if (v.visit(this)) {
expression.visit(v);
}
}
| Visits this node, then the thrown expression. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
java.util.Vector rv=new java.util.Vector(java.util.Arrays.asList((SageConstants.LITE && false) ? UserEvent.LITE_PRETTY_UENAMES : UserEvent.PRETTY_UENAMES));
rv.remove(0);
rv.remove(0);
rv.remove(rv.size() - 1);
return rv;
}
| Gets the names of all of the SageTV commands that are available in the system |
private void startTask(){
synchronized (lock) {
if (shutdown) {
throw new RejectedExecutionException("Executor already shutdown");
}
runningTasks++;
}
}
| Checks if the executor has been shut down and increments the running task count. |
@ObjectiveCName("onPhoneBookChanged") public void onPhoneBookChanged(){
if (modules.getContactsModule() != null) {
modules.getContactsModule().onPhoneBookChanged();
}
}
| MUST be called when phone book change detected |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case UmplePackage.CONSTANT_DECLARATION___ANONYMOUS_CONSTANT_DECLARATION_11:
return getAnonymous_constantDeclaration_1_1();
case UmplePackage.CONSTANT_DECLARATION___ANONYMOUS_CONSTANT_DECLARATION_21:
return getAnonymous_constantDeclaration_2_1();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void recordProcessingTime(EppMetric metric){
String eppStatusCode=metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : "";
processingTime.record(metric.getEndTimestamp().getMillis() - metric.getStartTimestamp().getMillis(),metric.getCommandName().or(""),metric.getClientId().or(""),eppStatusCode);
}
| Record the server-side processing time for an EPP request. |
public boolean isAttributesEmpty(){
return attributes.isEmpty();
}
| It checks if the attribute list is empty. |
private void declareExtensions(){
new AclFeed().declareExtensions(extProfile);
new SiteFeed().declareExtensions(extProfile);
extProfile.setAutoExtending(true);
new ActivityFeed().declareExtensions(extProfile);
new AnnouncementEntry().declareExtensions(extProfile);
new AnnouncementsPageEntry().declareExtensions(extProfile);
new AttachmentEntry().declareExtensions(extProfile);
new CommentEntry().declareExtensions(extProfile);
new ContentFeed().declareExtensions(extProfile);
new CreationActivityEntry().declareExtensions(extProfile);
new DeletionActivityEntry().declareExtensions(extProfile);
new EditActivityEntry().declareExtensions(extProfile);
new FileCabinetPageEntry().declareExtensions(extProfile);
new ListItemEntry().declareExtensions(extProfile);
new ListPageEntry().declareExtensions(extProfile);
new MoveActivityEntry().declareExtensions(extProfile);
new RecoveryActivityEntry().declareExtensions(extProfile);
new RevisionFeed().declareExtensions(extProfile);
new WebAttachmentEntry().declareExtensions(extProfile);
new WebPageEntry().declareExtensions(extProfile);
BatchUtils.declareExtensions(extProfile);
}
| Declare the extensions of the feeds for the Google Sites Data API. |
private void notifyMoney(final UserActionAttachment uaa){
sendNotification("You don't have enough money, you need " + uaa.getCostPU() + " PU's to perform this action");
}
| Let the player know he is being charged for money or that he hasn't got enough money |
private Object addOrUpdateCollectionEntry(AtlasVertex instanceVertex,AttributeInfo attributeInfo,IDataType elementType,Object newAttributeValue,Object currentValue,String propertyName,Operation operation) throws AtlasException {
switch (elementType.getTypeCategory()) {
case PRIMITIVE:
case ENUM:
return newAttributeValue != null ? newAttributeValue : null;
case ARRAY:
case MAP:
case TRAIT:
return null;
case STRUCT:
case CLASS:
final String edgeLabel=GraphHelper.EDGE_LABEL_PREFIX + propertyName;
return addOrUpdateReference(instanceVertex,attributeInfo,elementType,newAttributeValue,(AtlasEdge)currentValue,edgeLabel,operation);
default :
throw new IllegalArgumentException("Unknown type category: " + elementType.getTypeCategory());
}
}
| ARRAY & MAP |
protected void initOtherResourceBundle(UIDefaults table){
table.addResourceBundle("org.jb2011.lnf.beautyeye.resources.beautyeye");
}
| Initialize the defaults table with the name of the other ResourceBundle used for getting localized defaults. |
public XML addAnnotatedClass(Class<?> aClass){
checksClassAbsence(aClass);
addClass(aClass);
return this;
}
| This method adds to the xml configuration file, the class given in input. |
public SelectLatentsAction(GraphWorkbench workbench){
super("Highlight Latent Nodes");
if (workbench == null) {
throw new NullPointerException("Desktop must not be null.");
}
this.workbench=workbench;
}
| Creates a new copy subsession action for the given desktop and clipboard. |
public void paintScrollBarBackground(SynthContext context,Graphics g,int x,int y,int w,int h,int orientation){
paintBackground(context,g,x,y,w,h,orientation);
}
| Paints the background of a scrollbar. This implementation invokes the method of the same name without the orientation. |
public void replaceSteppables(Steppable[] steppables){
toReplace=(Steppable[])(steppables.clone());
}
| Requests that the provided Steppables replace the existing Steppables in the internal array prior to the next step() call. |
public static String encodeObject(java.io.Serializable serializableObject) throws java.io.IOException {
return encodeObject(serializableObject,NO_OPTIONS);
}
| Serializes an object and returns the Base64-encoded version of that serialized object. <p> As of v 2.3, if the object cannot be serialized or there is another error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it. </p> The object is not GZip-compressed before being encoded. |
private static String replaceComplex(String init){
StringBuilder builder=new StringBuilder(init);
Matcher m=altRegex.matcher(builder.toString());
while (m.find()) {
if (m.group().endsWith("?") && StringUtils.checkForm(m.group())) {
String core=m.group().substring(2,m.group().length() - 4);
if (m.end() < builder.length() && builder.charAt(m.end()) == ' ') {
String replace="(?:" + core.replaceAll("\\|"," \\|") + " )?";
builder=builder.replace(m.start(),m.end() + 1,replace);
}
else if (m.end() >= builder.length() && m.start() > 0 && builder.charAt(m.start() - 1) == ' ') {
String replace="(?: " + core.replaceAll("\\|","\\| ") + ")?";
builder=builder.replace(m.start() - 1,m.end(),replace);
}
else {
builder=builder.replace(m.start(),m.end(),"(?:" + core + ")?");
}
m=altRegex.matcher(builder.toString());
}
else if (StringUtils.checkForm(m.group())) {
String core=m.group().substring(2,m.group(0).length() - 2);
builder=builder.replace(m.start(),m.end(),"(?:" + core + ")");
m=altRegex.matcher(builder.toString());
}
}
return builder.toString();
}
| Replace the alternative or optional elements by a proper regular expression |
public AttCertIssuer(GeneralNames names){
obj=names;
choiceObj=obj.toASN1Primitive();
}
| Don't use this one if you are trying to be RFC 3281 compliant. Use it for v1 attribute certificates only. |
@Override public Object createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo,AbstractSession session){
return keyInfo;
}
| INTERNAL: Create an instance of the Key object from the key information extracted from the map. This key object may be a shallow stub of the actual object if the key is an Entity type. |
private void redrawTable(final Table table,final boolean isSelected){
clean(table);
fillData(table,isSelected ? selection : items);
}
| Redraw a given table |
@Override public void write(int oneByte) throws IOException {
byte[] buf=new byte[1];
buf[0]=(byte)oneByte;
this.write(buf);
}
| Write one byte to the underlying stream. The underlying stream MUST be valid |
public void deleteAllDistributionPreferences(org.hibernate.Session hibSession){
deleteAllDistributionPreferences(hibSession,true);
}
| Deletes all distribution prefs and updates the class_ objects |
public static boolean shuffle(Object[] objArray){
if (objArray == null) {
return false;
}
return shuffle(objArray,getRandom(objArray.length));
}
| Shuffling algorithm, Randomly permutes the specified array using a default source of randomness |
public IssuedIdentityToken clone(){
IssuedIdentityToken result=new IssuedIdentityToken();
result.PolicyId=PolicyId;
result.TokenData=TokenData;
result.EncryptionAlgorithm=EncryptionAlgorithm;
return result;
}
| Deep clone |
private void addEntryToInfoList(Entry entry,List<EntryInfo> entryInfoList){
if (entryInfoList != null) {
String typeToAdd=entry.getType();
if (typeToAdd.equals(DbLogic.Constants.quotation)) {
typeToAdd=DbLogic.Constants.note;
}
entryInfoList.add(new EntryInfo(entry.getId(),entry.getNoteOrTitle(""),entry.getQuotation(""),entry.getIsPublic(),entry.hasFirstChildId(),entry.hasParentId(),typeToAdd));
}
}
| Adds the entry to the entry list. |
public boolean addRecipe(Recipe recipe){
if (recipe instanceof ShapedRecipe) {
shapedRecipes.add((ShapedRecipe)recipe);
return true;
}
else if (recipe instanceof ShapelessRecipe) {
shapelessRecipes.add((ShapelessRecipe)recipe);
return true;
}
else if (recipe instanceof DynamicRecipe) {
dynamicRecipes.add((DynamicRecipe)recipe);
return true;
}
else if (recipe instanceof FurnaceRecipe) {
furnaceRecipes.add((FurnaceRecipe)recipe);
return true;
}
else {
return false;
}
}
| Adds a recipe to the crafting manager. |
@Override public void notifyServerConflict(){
notifyConflict();
}
| Notifies the user that he/she is trying to connect to a server that is not the currently-connected (default) server. |
public Index findIndex(Session session,String name){
Index index=indexes.get(name);
if (index == null) {
index=session.findLocalTempTableIndex(name);
}
return index;
}
| Try to find an index with this name. This method returns null if no object with this name exists. |
public static int aspectRatioNumerator(Size size){
Size aspectRatio=reduce(size);
return aspectRatio.width();
}
| Given a size return the numerator of its aspect ratio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.