code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public void estopAll(){
slots.stream().filter(null).forEach(null);
}
| Send emergency stop to all slots |
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
ArrayList<String> matches=data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches.size() > 0) {
if (editText.getText().toString().length() == 0) {
editText.setText(matches.get(0));
editText.setSelection(editText.getText().toString().length());
}
else {
Spanned spanText=(SpannedString)TextUtils.concat(editText.getText()," " + matches.get(0));
editText.setText(spanText);
editText.setSelection(editText.getText().toString().length());
}
}
}
super.onActivityResult(requestCode,resultCode,data);
}
| Handle the results from the voice recognition |
public static boolean hasExplicitExtendsBound(final AnnotatedTypeMirror wildcard){
final Type.WildcardType wildcardType=(Type.WildcardType)wildcard.getUnderlyingType();
return wildcardType.isExtendsBound() && !((WildcardType)wildcard.getUnderlyingType()).isUnbound();
}
| This method identifies wildcard types that have an explicit extends bound. NOTE: Type.WildcardType.isExtendsBound will return true for BOTH unbound and extends bound wildcards which necessitates this method |
@Override public int hashCode(){
return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
}
| Compute a hash code using the hash codes of the underlying objects |
public NotificationChain basicSetAction(Expression newAction,NotificationChain msgs){
Expression oldAction=action;
action=newAction;
if (eNotificationRequired()) {
ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,GamlPackage.FUNCTION__ACTION,oldAction,newAction);
if (msgs == null) msgs=notification;
else msgs.add(notification);
}
return msgs;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Override protected EClass eStaticClass(){
return MappingPackage.Literals.FUNCTION_BLOCK_ATTRIBUTE_SOURCE;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public Presentation(Context outerContext,Display display){
this(outerContext,display,0);
}
| Creates a new presentation that is attached to the specified display using the default theme. |
private void emitSet(String opcode,boolean[][] testsPerformed,int level){
if (emitters.isEmpty()) {
}
else if (isSingleton()) emitSingleton(opcode,testsPerformed,level);
else {
SplitRecord rec=split();
if (DEBUG) {
for (int i=0; i < level; i++) System.err.print(" ");
System.err.println("split of " + opcode + "["+ rec.argument+ "] for "+ rec.test);
}
if (testsPerformed[rec.argument][rec.test.ordinal()]) {
throw new Error("repeated split of " + opcode + "["+ rec.argument+ "] for "+ rec.test+ "\n"+ this);
}
testsPerformed[rec.argument][rec.test.ordinal()]=true;
EmitterSet[] splits=makeSplit(rec);
emitTab(level);
emit("if (");
emitTest(rec.argument,rec.test);
emit(") {\n");
splits[0].emitSet(opcode,testsPerformed,level + 1);
emit("\n");
emitTab(level);
emit("} else {\n");
splits[1].emitSet(opcode,testsPerformed,level + 1);
emitTab(level);
emit("}\n");
testsPerformed[rec.argument][rec.test.ordinal()]=false;
}
}
| Emit Java code for deciding which emit method in the given set applies to an Instruction, and then calling the apprpriate method. The method essentially works by recursively parititioning the given set into two smaller pieces until it finds a set with only one element. On each partition, this method generates code for the appropriate operand type or size query, and then calls itself recursively on the two sets resulting from the partition. This method uses split to determine what test to apply, and emitSingleton when it encounteres a singleton set. Note that the testsPerformed parameter is not needed to do the recursive splitting; this is passed to emitSingleton to help it generate appropriate error checking for operands. |
private void verifySampleHost() throws Throwable {
this.host.waitForServiceAvailable(RootNamespaceService.SELF_LINK);
URI rootUri=UriUtils.buildUri(this.sampleHost,RootNamespaceService.class);
this.host.testStart(1);
Operation get=Operation.createGet(rootUri).setCompletion(null);
this.host.send(get);
this.host.testWait();
}
| Query the root URI (/) and validate the response. We're making sure that the Root Namespace Service is running and that it returns at least one selfLink. |
BCRSAPrivateCrtKey(PrivateKeyInfo info) throws IOException {
this(RSAPrivateKey.getInstance(info.parsePrivateKey()));
}
| construct an RSA key from a private key info object. |
public StextSwitch(){
if (modelPackage == null) {
modelPackage=StextPackage.eINSTANCE;
}
}
| Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc --> |
public Sax2XMLReaderCreator(){
this.className=null;
}
| Constructs a <code>Sax2XMLReaderCreator</code> that uses system defaults to construct <code>XMLReader</code>s. |
private void expandTo(int wordIndex){
int wordsRequired=wordIndex + 1;
if (wordsInUse < wordsRequired) {
ensureCapacity(wordsRequired);
wordsInUse=wordsRequired;
}
}
| Ensures that the BitSet can accommodate a given wordIndex, temporarily violating the invariants. The caller must restore the invariants before returning to the user, possibly using recalculateWordsInUse(). |
public void removeCapabilitiesListener(CapabilitiesListener listener) throws RcsServiceNotAvailableException, RcsGenericException {
if (mApi == null) {
throw new RcsServiceNotAvailableException();
}
try {
WeakReference<ICapabilitiesListener> weakRef=mCapabilitiesListeners.remove(listener);
if (weakRef == null) {
return;
}
ICapabilitiesListener rcsListener=weakRef.get();
if (rcsListener != null) {
mApi.removeCapabilitiesListener(rcsListener);
}
}
catch ( Exception e) {
RcsIllegalArgumentException.assertException(e);
throw new RcsGenericException(e);
}
}
| Unregisters a capabilities listener |
public String expandTemplate(String template,GeneralizedSemPm semPm,Node node) throws ParseException {
ExpressionParser parser=new ExpressionParser();
List<String> usedNames;
if (semPm == null && template.contains("$")) {
throw new IllegalArgumentException("If semPm is null, the template may not contain any parameters or " + "$ expressions.");
}
if (semPm == null && node != null) {
throw new IllegalArgumentException("If semPm is not specified, then node may not be specified either. The" + " node must be for a specific generalized SEM PM.");
}
parser.parseExpression(template);
usedNames=parser.getParameters();
template=replaceTemplateSums(semPm,template,node);
template=replaceTemplateProducts(semPm,template,node);
template=replaceNewParameters(semPm,template,usedNames);
template=replaceError(semPm,template,node);
Node error=null;
if (node != null) {
error=semPm.getErrorNode(node);
}
template=template.trim();
if (template.equals("")) {
template="";
}
if (!"".equals(template)) {
try {
parser.parseExpression(template);
}
catch ( ParseException e) {
template="";
}
if (node == null && !parser.getParameters().isEmpty()) {
throw new IllegalArgumentException("If node is null, the template may not contain any $ expressions.");
}
}
if (node != null && node != error && !template.contains(error.getName())) {
if (template.trim().equals("")) {
template=error.getName();
}
else {
template+=" + " + error.getName();
}
}
if (template.contains("$")) {
throw new ParseException("Template contains a $ not inside TSUM or TPROD.",template.indexOf("$"));
}
return template;
}
| Returns the expanded template, which needs to be checked to make sure it can be used. Try setting it as the expression for the node or freeParameters you wish to use it for. |
public void callStringAsync(String key,Callback<String> callback){
callAsync(key,callback);
}
| Calls a method on the underlying Javascript object that returns a String. Call is asynchronous. Return value or error is passed to the provided callback. |
public DefaultRequest txId(String value){
setString(TRANSACTION_ID,value);
return this;
}
| <div class="ind"> <p> <strong>Required for transaction hit type.</strong> <br> <strong>Required for item hit type.</strong> </p> <p>A unique identifier for the transaction. This value should be the same for both the Transaction hit and Items hits associated to the particular transaction.</p> <table border="1"> <tbody> <tr> <th>Parameter</th> <th>Value Type</th> <th>Default Value</th> <th>Max Length</th> <th>Supported Hit Types</th> </tr> <tr> <td><code>ti</code></td> <td>text</td> <td><span class="none">None</span> </td> <td>500 Bytes </td> <td>transaction, item</td> </tr> </tbody> </table> <div> Example value: <code>OD564</code><br> Example usage: <code>ti=OD564</code> </div> </div> |
public boolean isDeprecated(){
return deprecated;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void addAfter(MemoryChunk memoryChunk,MemoryChunk reference){
memoryChunk.previous=reference;
memoryChunk.next=reference.next;
reference.next=memoryChunk;
if (memoryChunk.next != null) {
memoryChunk.next.previous=memoryChunk;
}
if (high == reference) {
high=memoryChunk;
}
}
| Add a new MemoryChunk after another one. This method does not check if the addresses are kept ordered. |
public FieldMappingMetaData fieldMappings(String index,String type,String field){
ImmutableMap<String,ImmutableMap<String,FieldMappingMetaData>> indexMapping=mappings.get(index);
if (indexMapping == null) {
return null;
}
ImmutableMap<String,FieldMappingMetaData> typeMapping=indexMapping.get(type);
if (typeMapping == null) {
return null;
}
return typeMapping.get(field);
}
| Returns the mappings of a specific field. |
public boolean isSpritePause(){
return mSpriteSheet.isSpritePause();
}
| Getter SpriteAnimation pause state |
@Override public ImmutableSortedMap<K,V> build(){
switch (size) {
case 0:
return emptyMap(comparator);
case 1:
return of(comparator,entries[0].getKey(),entries[0].getValue());
default :
return fromEntries(comparator,false,entries,size);
}
}
| Returns a newly-created immutable sorted map. |
public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException {
gtx=tm.getGlobalTransaction();
if (gtx == null) {
String exception=LocalizedStrings.TransactionImpl_TRANSACTIONIMPL_ENLISTRESOURCE_NO_GLOBAL_TRANSACTION_EXISTS.toLocalizedString();
LogWriterI18n writer=TransactionUtils.getLogWriterI18n();
if (writer.fineEnabled()) writer.fine(exception);
throw new SystemException(exception);
}
return gtx.enlistResource(xaRes);
}
| Enlist the XAResource specified to the Global Transaction associated with this transaction. |
public TypeDeclaration declarationOf(MemberTypeBinding memberTypeBinding){
if (memberTypeBinding != null && this.memberTypes != null) {
for (int i=0, max=this.memberTypes.length; i < max; i++) {
TypeDeclaration memberTypeDecl;
if ((memberTypeDecl=this.memberTypes[i]).binding == memberTypeBinding) return memberTypeDecl;
}
}
return null;
}
| Find the matching parse node, answers null if nothing found |
public HtmlReportHelper(File outputDir,String reportName){
mOutputDir=outputDir;
mReportFile=new File(outputDir,reportName + ".html");
mResourcesDir=new File(outputDir,reportName + REPORT_DIR_SUFFIX);
}
| Construct an <code>HtmlReportHelper</code> |
public boolean hasLoaded(){
return mHasLoaded;
}
| has the shader-string been loaded? |
public RemoveSkuFromWishListEventCommandImpl(final ShoppingCartCommandRegistry registry,final PriceService priceService,final PricingPolicyProvider pricingPolicyProvider,final ProductService productService,final ShopService shopService,final CustomerWishListService customerWishListService){
super(registry,priceService,pricingPolicyProvider,productService,shopService);
this.customerWishListService=customerWishListService;
}
| Construct sku command. |
void b2a2__b2a2b2(){
mv.visitInsn(DUP2_X2);
mv.visitInsn(POP2);
mv.visitInsn(DUP2_X2);
}
| ..., b2, a2 ==> ..., b2, a2, b2 |
protected boolean shouldDeleteAndRollback(){
Validate.notNull(lockService,"if we don't have a valid lock server we can't roll back transactions");
return true;
}
| This is protected to allow for different post filter behavior. |
public void testEqualsOnNew(){
MockModel model1=new MockModel();
MockModel model2=new MockModel();
assertFalse(model1.equals(model2));
assertFalse(model2.equals(model1));
assertTrue(model1.equals(model1));
}
| A new object does not have PK assigned yet, therefore by default it is equal only to itself. |
public TurnListenerDecorator(TurnListener turnListener){
this.turnListener=turnListener;
}
| creates a new TurnListenerDecorator |
@FlashException(referrer={"snapshot"}) public static void removeSnapShotAcl(String aclUrl,@As(",") String[] ids){
ShareACLs aclsToDelete=new ShareACLs();
List<ShareACL> shareAcls=new ArrayList<ShareACL>();
String snapshotId=null;
String shareName=null;
if (ids != null && ids.length > 0) {
for ( String id : ids) {
String type=SnapshotShareACLForm.extractTypeFromId(id);
String name=SnapshotShareACLForm.extractNameFromId(id);
String domain=SnapshotShareACLForm.extractDomainFromId(id);
snapshotId=SnapshotShareACLForm.extractSnapshotFromId(id);
shareName=SnapshotShareACLForm.extractShareNameFromId(id);
ShareACL ace=new ShareACL();
if (SnapshotShareACLForm.GROUP.equalsIgnoreCase(type)) {
ace.setGroup(name);
}
else {
ace.setUser(name);
}
if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
ace.setDomain(domain);
}
shareAcls.add(ace);
}
aclsToDelete.setShareACLs(shareAcls);
SnapshotCifsShareACLUpdateParams input=new SnapshotCifsShareACLUpdateParams();
input.setAclsToDelete(aclsToDelete);
ViPRCoreClient client=BourneUtil.getViprClient();
client.fileSnapshots().updateShareACL(uri(snapshotId),shareName,input);
}
flash.success(MessagesUtils.get("resources.filesystem.share.acl.deleted"));
listSnapshotAcl(snapshotId,shareName);
}
| This method called When user selects ACLs and hit delete button. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:59:01.547 -0500",hash_original_method="C10911F486938B4F93DC849B5E1085A3",hash_generated_method="58FEB9B5BD3D673382BBA8109B73E7D7") @Override public boolean needsOtaServiceProvisioning(){
return mSST.getOtasp() != ServiceStateTracker.OTASP_NOT_NEEDED;
}
| Returns true if OTA Service Provisioning needs to be performed. |
public float convertV(float voltage){
return (float)(-1 * voltage - resting_v);
}
| Converts a voltage from the modern convention to the convention used by the program. |
protected void prepare(){
ProcessInfoParameter[] para=getParameter();
for (int i=0; i < para.length; i++) {
String name=para[i].getParameterName();
if (para[i].getParameter() == null) ;
else if (name.equals("PA_ReportColumnSet_ID")) m_PA_ReportColumnSet_ID=((BigDecimal)para[i].getParameter()).intValue();
else log.log(Level.SEVERE,"prepare - Unknown Parameter: " + name);
}
}
| Prepare - e.g., get Parameters. |
public static String readUrl(String urlString) throws IOException {
StringBuffer result=new StringBuffer();
BufferedReader br=null;
InputStream inputStream=null;
try {
URL url=new URL(urlString);
URLConnection urlConnection=url.openConnection();
inputStream=urlConnection.getInputStream();
br=new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line=br.readLine()) != null) {
result.append(line);
}
}
finally {
closeQuitely(inputStream);
closeQuitely(br);
}
return result.toString();
}
| reads content from URL by making |
@Override public void onTokenRefresh(){
Intent intent=new Intent(this,RegistrationIntentService.class);
startService(intent);
}
| Called if InstanceID token is updated. This may occur if the security of the previous token had been compromised. This call is initiated by the InstanceID provider. |
private <T extends Annotation>T find(Class<T> label){
Class<?> type=root;
while (type != null) {
T value=type.getAnnotation(label);
if (value != null) {
return value;
}
type=type.getSuperclass();
}
return null;
}
| This method will scan a class for the specified annotation. If the annotation is found on the class, or on one of the super types then it is returned. All scans will be cached to ensure scanning is only performed once. |
public void refreshTransitRoute(TransitRoute transitRoute){
Router router=routers.get(transitRoute.getTransportMode());
List<TransitRouteStop> routeStops=transitRoute.getStops();
List<Id<Link>> linkSequence=new ArrayList<>();
linkSequence.add(routeStops.get(0).getStopFacility().getLinkId());
for (int i=0; i < routeStops.size() - 1; i++) {
if (routeStops.get(i).getStopFacility().getLinkId() == null) {
throw new IllegalArgumentException("stop facility " + routeStops.get(i).getStopFacility().getName() + " ("+ routeStops.get(i).getStopFacility().getId()+ " not referenced!");
}
if (routeStops.get(i + 1).getStopFacility().getLinkId() == null) {
throw new IllegalArgumentException("stop facility " + routeStops.get(i - 1).getStopFacility().getName() + " ("+ routeStops.get(i + 1).getStopFacility().getId()+ " not referenced!");
}
Id<Link> currentLinkId=Id.createLinkId(routeStops.get(i).getStopFacility().getLinkId().toString());
Link currentLink=network.getLinks().get(currentLinkId);
Link nextLink=network.getLinks().get(routeStops.get(i + 1).getStopFacility().getLinkId());
List<Id<Link>> path=PTMapperUtils.getLinkIdsFromPath(router.calcLeastCostPath(currentLink.getToNode(),nextLink.getFromNode()));
if (path != null) linkSequence.addAll(path);
linkSequence.add(nextLink.getId());
}
transitRoute.setRoute(RouteUtils.createNetworkRoute(linkSequence,network));
}
| "Refreshes" the transit route by routing between all referenced links of the stop facilities. |
public MutableLocation toMutableLocation(World w){
return new MutableLocation(x,y,z,w);
}
| Creates a new MutableLocation with the coordinates of this vector. |
public static String toJSONString(List list){
if (list == null) return "null";
boolean first=true;
StringBuffer sb=new StringBuffer();
Iterator iter=list.iterator();
sb.append('[');
while (iter.hasNext()) {
if (first) first=false;
else sb.append(',');
Object value=iter.next();
if (value == null) {
sb.append("null");
continue;
}
sb.append(JSONValue.toJSONString(value));
}
sb.append(']');
return sb.toString();
}
| Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviours will be omitted at this top level. |
public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav){
if (alav.getNamespaceURI() == null) {
String ln=alav.getLocalName();
if (ln.equals(SVG_CX_ATTRIBUTE) || ln.equals(SVG_CY_ATTRIBUTE) || ln.equals(SVG_R_ATTRIBUTE)) {
buildShape(ctx,e,(ShapeNode)node);
handleGeometryChanged();
return;
}
}
super.handleAnimatedAttributeChanged(alav);
}
| Invoked when the animated value of an animatable attribute has changed. |
public void clear(){
map.clear();
}
| Removes all of the mappings from this map. The map will be empty after this call returns. <p/> <p>This method is not atomic: the map may not be empty after returning if there were concurrent writes. |
public String stemString(String str){
StringBuffer result=new StringBuffer();
int start=-1;
for (int j=0; j < str.length(); j++) {
char c=str.charAt(j);
if (Character.isLetterOrDigit(c)) {
if (start == -1) {
start=j;
}
}
else if (c == '\'') {
if (start == -1) {
result.append(c);
}
}
else {
if (start != -1) {
result.append(stem(str.substring(start,j)));
start=-1;
}
result.append(c);
}
}
if (start != -1) {
result.append(stem(str.substring(start,str.length())));
}
return result.toString();
}
| Stems everything in the given string. String is converted to lower case before stemming. |
protected void drawGeometry(DrawContext dc,int mode,int count,int type,Buffer elementBuffer,ShapeData shapeData,int face){
if (elementBuffer == null) {
String message="nullValue.ElementBufferIsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
Geometry mesh=shapeData.getMesh(face);
if (mesh.getBuffer(Geometry.VERTEX) == null) {
String message="nullValue.VertexBufferIsNull";
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
GL2 gl=dc.getGL().getGL2();
int size, glType, stride;
Buffer vertexBuffer, normalBuffer;
size=mesh.getSize(Geometry.VERTEX);
glType=mesh.getGLType(Geometry.VERTEX);
stride=mesh.getStride(Geometry.VERTEX);
vertexBuffer=mesh.getBuffer(Geometry.VERTEX);
normalBuffer=null;
if (!dc.isPickingMode()) {
if (mustApplyLighting(dc,null)) {
normalBuffer=mesh.getBuffer(Geometry.NORMAL);
if (normalBuffer == null) {
gl.glDisableClientState(GL2.GL_NORMAL_ARRAY);
}
else {
glType=mesh.getGLType(Geometry.NORMAL);
stride=mesh.getStride(Geometry.NORMAL);
gl.glNormalPointer(glType,stride,normalBuffer);
}
}
}
if (this.shouldUseVBOs(dc) && (this.getVboIds(getSubdivisions(),dc)) != null) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,getVboIds(getSubdivisions(),dc)[2 * face]);
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER,this.getVboIds(getSubdivisions(),dc)[2 * face + 1]);
gl.glVertexPointer(size,glType,stride,0);
gl.glDrawElements(mode,count,type,0);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER,0);
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER,0);
}
else {
gl.glVertexPointer(size,glType,stride,vertexBuffer.rewind());
gl.glDrawElements(mode,count,type,elementBuffer);
}
gl.glDisable(GL2.GL_RESCALE_NORMAL);
if (!dc.isPickingMode()) {
if (mustApplyLighting(dc,null)) {
if (normalBuffer == null) gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
}
}
}
| Renders the Pyramid, using data from the provided buffer and the given parameters |
public CSVFormat withEscape(final char escape){
return withEscape(Character.valueOf(escape));
}
| Sets the escape character of the format to the specified character. |
public static int length(String str){
return str == null ? 0 : str.length();
}
| Gets a String's length or <code>0</code> if the String is <code>null</code>. |
public boolean dispatchKeyEvent(KeyEvent event){
if (event.getID() == KeyEvent.KEY_PRESSED) {
m_lastWhen=event.getWhen();
}
if (m_timer == null) super.dispatchKeyEvent(event);
else m_fifo.add(event);
return true;
}
| Dispatch Key Event - queue |
public static SignInDialogFragment newInstance(PLYAndroid.Query queryOnSuccess,PLYCompletion queryOnSuccessCompletion,PLYAndroid.QueryError queryError){
SignInDialogFragment signInExistingUserDialogFragment=new SignInDialogFragment();
signInExistingUserDialogFragment.queryOnSuccess=queryOnSuccess;
signInExistingUserDialogFragment.queryOnSuccessCompletion=queryOnSuccessCompletion;
signInExistingUserDialogFragment.queryError=queryError;
return signInExistingUserDialogFragment;
}
| Constructs a new instance with the specified parameters. The parameters passed this way survive recreation of the fragment due to orientation changes etc. |
public TestCase(String description,Geometry a,Geometry b,File aWktFile,File bWktFile,TestRun testRun,int caseIndex,int lineNumber){
this.description=description;
this.a=a;
this.b=b;
this.aWktFile=aWktFile;
this.bWktFile=bWktFile;
this.testRun=testRun;
this.caseIndex=caseIndex;
this.lineNumber=lineNumber;
}
| Creates a TestCase with the given description. The tests will be applied to a and b. |
public int longestConsecutive(int[] num){
if (num == null || num.length == 0) return 0;
Map<Integer,Integer> map=new HashMap<Integer,Integer>();
int maxLen=0;
for (int i=0; i < num.length; i++) {
if (map.containsKey(num[i])) continue;
int low=num[i];
int upp=num[i];
if (map.containsKey(num[i] - 1)) low=map.get(num[i] - 1);
if (map.containsKey(num[i] + 1)) upp=map.get(num[i] + 1);
maxLen=Math.max(maxLen,upp - low + 1);
map.put(num[i],num[i]);
map.put(low,upp);
map.put(upp,low);
}
return maxLen;
}
| Use a map to store ranges Get lower bound with smaller value Get upper bound with larger value Update max length with new bound Put all possible ranges into map including num[i] ~ num[i], low ~ upp, upp ~ low |
public static String formatUTC(final long millis,final String pattern){
return format(new Date(millis),pattern,UTC_TIME_ZONE,null);
}
| <p>Formats a date/time into a specific pattern using the UTC time zone.</p> |
public TriggerList(final List<String> strings){
for ( final String item : strings) {
add(ConversationParser.createTriggerExpression(item));
}
}
| Create a list of normalized trigger Words from a String list. |
public Daylight(boolean daylight,UtcOffset offset,ICalDate start,ICalDate end,String standardName,String daylightName){
this.daylight=daylight;
this.offset=offset;
this.start=start;
this.end=end;
this.standardName=standardName;
this.daylightName=daylightName;
}
| Creates a daylight savings property. |
private ScanMetadata _constructScanMetadata(MetricSchemaRecordQuery query){
ScanMetadata metadata=new ScanMetadata();
char[] scopeTableRowKey=_constructRowKey(query.getNamespace(),query.getScope(),query.getMetric(),query.getTagKey(),query.getTagValue(),TableType.SCOPE).toCharArray();
char[] metricTableRowKey=_constructRowKey(query.getNamespace(),query.getScope(),query.getMetric(),query.getTagKey(),query.getTagValue(),TableType.METRIC).toCharArray();
int i=0, j=0;
for (; (i < scopeTableRowKey.length && j < metricTableRowKey.length); i++, j++) {
if (_isWildcardCharacter(scopeTableRowKey[i]) || _isWildcardCharacter(metricTableRowKey[j])) {
break;
}
}
while (i < scopeTableRowKey.length && !_isWildcardCharacter(scopeTableRowKey[i])) {
i++;
}
while (j < metricTableRowKey.length && !_isWildcardCharacter(metricTableRowKey[j])) {
j++;
}
if (i < scopeTableRowKey.length && scopeTableRowKey[i] == '|') {
while (i >= 0 && scopeTableRowKey[i] != ROWKEY_SEPARATOR) {
i--;
}
i++;
}
if (j < metricTableRowKey.length && metricTableRowKey[j] == '|') {
while (j >= 0 && metricTableRowKey[j] != ROWKEY_SEPARATOR) {
j--;
}
j++;
}
int indexOfWildcard;
String rowKey;
if (i < j) {
metadata.type=TableType.METRIC;
indexOfWildcard=j;
rowKey=new String(metricTableRowKey);
}
else {
metadata.type=TableType.SCOPE;
indexOfWildcard=i;
rowKey=new String(scopeTableRowKey);
}
String start=rowKey.substring(0,indexOfWildcard);
metadata.startRow=start.getBytes(Charset.forName("UTF-8"));
String end="";
if (indexOfWildcard > 0) {
char prev=rowKey.charAt(indexOfWildcard - 1);
char prevPlusOne=(char)(prev + 1);
end=rowKey.substring(0,indexOfWildcard - 1) + prevPlusOne;
}
metadata.stopRow=end.getBytes(Charset.forName("UTF-8"));
return metadata;
}
| Construct scan metadata depending on the query. This includes determining the table to query and the start and stop rows for the scan. <p>For e.g., if scope == "system.chi*" and metric = "app_runtime" then the 2 row keys will be,</p> <p>scopeRowKey = system.chi*:app_runtime:tagk:tagv:namespace metricRowKey = app_runtime:system.chi*:tagk:tagv:namespace</p> <p>Based on these 2 rowkeys we will select, tableType = METRIC startRow = "app_runtime:system.chi" and stopRow = "app_runtime:system.chj"</p> |
protected boolean isMissingData(double value){
return value == this.missingDataFlag || value < this.minElevation || value > this.maxElevation || value == -32767;
}
| Determines whether a value signifies missing data -- voids. This method not only tests the value againsy the tile's missing data flag, it also tests for its being within range of the tile's minimum and maximum values. The values also tested for the magic value -32767, which for some reason is commonly used but not always identified in GeoTiff files. |
protected LangSys(RandomAccessFile raf) throws IOException {
lookupOrder=raf.readUnsignedShort();
reqFeatureIndex=raf.readUnsignedShort();
featureCount=raf.readUnsignedShort();
featureIndex=new int[featureCount];
for (int i=0; i < featureCount; i++) {
featureIndex[i]=raf.readUnsignedShort();
}
}
| Creates new LangSys |
@Uninterruptible private void publishResolved(TIB allocatedTib,short[] superclassIds,int[] doesImplement){
Statics.setSlotContents(getTibOffset(),allocatedTib);
allocatedTib.setType(this);
allocatedTib.setSuperclassIds(superclassIds);
allocatedTib.setDoesImplement(doesImplement);
if (!(elementType.isPrimitiveType() || elementType.isUnboxedType())) {
allocatedTib.setArrayElementTib(elementType.getTypeInformationBlock());
}
typeInformationBlock=allocatedTib;
state=CLASS_RESOLVED;
}
| Atomically initialize the important parts of the TIB and let the world know this type is resolved. |
protected void prepare(){
ProcessInfoParameter[] para=getParameter();
for (int i=0; i < para.length; i++) {
String name=para[i].getParameterName();
if (para[i].getParameter() == null) ;
else if (name.equals("MustBeStocked")) mustBeStocked=((String)para[i].getParameter()).equals("Y");
else log.log(Level.SEVERE,"Unknown Parameter: " + name);
}
p_Record_ID=getRecord_ID();
}
| Prepare - e.g., get Parameters. |
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
String csName=(String)s.readObject();
byte[] data=(byte[])s.readObject();
int cspace=0;
boolean isKnownPredefinedCS=false;
if (csName != null) {
isKnownPredefinedCS=true;
if (csName.equals("CS_sRGB")) {
cspace=ColorSpace.CS_sRGB;
}
else if (csName.equals("CS_CIEXYZ")) {
cspace=ColorSpace.CS_CIEXYZ;
}
else if (csName.equals("CS_PYCC")) {
cspace=ColorSpace.CS_PYCC;
}
else if (csName.equals("CS_GRAY")) {
cspace=ColorSpace.CS_GRAY;
}
else if (csName.equals("CS_LINEAR_RGB")) {
cspace=ColorSpace.CS_LINEAR_RGB;
}
else {
isKnownPredefinedCS=false;
}
}
if (isKnownPredefinedCS) {
resolvedDeserializedProfile=getInstance(cspace);
}
else {
resolvedDeserializedProfile=getInstance(data);
}
}
| Reads default serializable fields from the stream. Reads from the stream a string and an array of bytes as additional data. |
public static void postAlarm(Context c,Ticket t) throws ParseException {
AlarmManager am=(AlarmManager)c.getSystemService(Context.ALARM_SERVICE);
if (am == null) {
DebugLog.e("Cannot obtain alarm service");
return;
}
long alarmTime=t.getValidTo().toMillis(true) - Constants.EXPIRING_MINUTES * 60 * 1000;
if (alarmTime > System.currentTimeMillis() && Preferences.getBoolean(c,Preferences.NOTIFY_BEFORE_EXPIRATION,true)) {
final Intent i=new Intent(c,TicketAlarmReceiver.class);
i.setAction(TicketAlarmReceiver.INTENT_TICKET_ALARM_EXPIRING);
i.setData(Uri.withAppendedPath(TicketProvider.Tickets.CONTENT_URI,"" + t.getId()));
i.putExtra(TicketAlarmReceiver.EXTRA_TICKET,t);
final PendingIntent contentIntent=PendingIntent.getBroadcast(c,t.getNotificationId(),i,PendingIntent.FLAG_UPDATE_CURRENT);
am.set(AlarmManager.RTC_WAKEUP,alarmTime,contentIntent);
DebugLog.i("Ticket alarm expiring set to " + new Date(alarmTime));
}
alarmTime=t.getValidTo().toMillis(true);
if (alarmTime > System.currentTimeMillis()) {
final Intent i=new Intent(c,TicketAlarmReceiver.class);
i.setAction(TicketAlarmReceiver.INTENT_TICKET_ALARM_EXPIRED);
i.setData(Uri.withAppendedPath(TicketProvider.Tickets.CONTENT_URI,"" + t.getId()));
i.putExtra(TicketAlarmReceiver.EXTRA_TICKET,t);
final PendingIntent contentIntent=PendingIntent.getBroadcast(c,t.getNotificationId(),i,PendingIntent.FLAG_UPDATE_CURRENT);
am.set(AlarmManager.RTC_WAKEUP,alarmTime,contentIntent);
DebugLog.i("Ticket alarm expired set to " + new Date(alarmTime));
}
}
| Sets alarm to notifyTicket <code>eu.inmite.apps.smsjizdenka.TICKET_ALARM</code> intent few minutes before ticket expires. |
public void addSegment(Segment segment){
getSegments().add(segment);
}
| Adds a new segment. |
private void addOracleDescriptor() throws IOException, JDOMException {
InputStream in=null;
try {
in=getResource("META-INF/orion-ejb-jar.xml");
if (in != null) {
OrionEjbJarXml descr=OrionEjbJarXmlIo.parseOracleEjbJarXml(in);
if (descr != null) {
this.ejbJarXml.addVendorDescriptor(descr);
}
}
}
finally {
if (in != null) {
in.close();
}
}
}
| Associates the ejb-jar.xml with orion-ejb-jar.xml if one is present in the war. |
public void accept(MemberValueVisitor visitor){
visitor.visitBooleanMemberValue(this);
}
| Accepts a visitor. |
private static boolean valueEquals(Object obj1,Object obj2){
if (obj1 == obj2) {
return true;
}
if (obj1 == null) {
return false;
}
if (obj1.getClass().isArray() && obj2.getClass().isArray()) {
return arrayEquals(obj1,obj2);
}
return (obj1.equals(obj2));
}
| Determines whether two attribute values are equal. Use arrayEquals for arrays and <tt>Object.equals()</tt> otherwise. |
public static void validateEnvironment(Context ctxt){
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
throw new IllegalStateException("App is running on device older than API Level 14");
}
PackageManager pm=ctxt.getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY) && !pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
throw new IllegalStateException("App is running on device that lacks a camera");
}
if (ctxt instanceof CameraActivity) {
try {
ActivityInfo info=pm.getActivityInfo(((CameraActivity)ctxt).getComponentName(),0);
if (info.exported) {
throw new IllegalStateException("A CameraActivity cannot be exported!");
}
}
catch ( PackageManager.NameNotFoundException e) {
throw new IllegalStateException("Cannot find this activity!",e);
}
}
}
| Tests the app and the device to confirm that the code in this library should work. This is called automatically by other classes (e.g., CameraActivity), and so you probably do not need to call it yourself. But, hey, it's a public method, so call it if you feel like it. The method will throw an IllegalStateException if the environment is unsatisfactory, where the exception message will tell you what is wrong. |
public void decreaseKey(Node x,double k){
if (k > x.key) {
throw new IllegalArgumentException("decreaseKey() got larger key value");
}
x.key=k;
Node y=x.parent;
if ((y != null) && (x.key < y.key)) {
cut(x,y);
cascadingCut(y);
}
if (min == null || x.key < min.key) {
min=x;
}
}
| Decreases the key value for a heap node, given the new value to take on. The structure of the heap may be changed and will not be consolidated. <p> Running time: O(1) amortized </p> |
@Override protected EClass eStaticClass(){
return MappingPackage.Literals.ENUM_SOURCE;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
protected static ColorModel fixColorModel(CachableRed src){
ColorModel cm=src.getColorModel();
if (cm != null) {
if (cm.hasAlpha()) return GraphicsUtil.Linear_sRGB_Unpre;
return GraphicsUtil.Linear_sRGB;
}
else {
SampleModel sm=src.getSampleModel();
switch (sm.getNumBands()) {
case 1:
return GraphicsUtil.Linear_sRGB;
case 2:
return GraphicsUtil.Linear_sRGB_Unpre;
case 3:
return GraphicsUtil.Linear_sRGB;
}
return GraphicsUtil.Linear_sRGB_Unpre;
}
}
| This function 'fixes' the source's color model. Right now it just selects if it should have one or two bands based on if the source had an alpha channel. |
public static boolean parseNetstedInterpolatedString(PsiBuilder b,int l,IElementType quoteTokenType){
assert b instanceof PerlBuilder;
IElementType tokenType=b.getTokenType();
if (((PerlBuilder)b).getExtraStopQuote() != quoteTokenType && tokenType == quoteTokenType) {
PsiBuilder.Marker m=b.mark();
b.advanceLexer();
if (quoteTokenType == QUOTE_DOUBLE) {
m.collapse(QUOTE_DOUBLE_OPEN);
}
else if (quoteTokenType == QUOTE_TICK) {
m.collapse(QUOTE_TICK_OPEN);
}
else {
throw new RuntimeException("Unknown open quote for token " + quoteTokenType);
}
IElementType currentStopQuote=((PerlBuilder)b).setExtraStopQuote(quoteTokenType);
parseInterpolatedStringContent(b,l);
((PerlBuilder)b).setExtraStopQuote(currentStopQuote);
if ((b.getTokenType()) == quoteTokenType) {
m=b.mark();
b.advanceLexer();
if (quoteTokenType == QUOTE_DOUBLE) {
m.collapse(QUOTE_DOUBLE_CLOSE);
}
else if (quoteTokenType == QUOTE_TICK) {
m.collapse(QUOTE_TICK_CLOSE);
}
else {
throw new RuntimeException("Unknown open quote for token " + quoteTokenType);
}
return true;
}
return false;
}
return false;
}
| Magic for nested string opener |
public int eval(INode state){
EightPuzzleNode node=(EightPuzzleNode)state;
int Pn=0;
for (int r=0; r <= EightPuzzleNode.MaxR; r++) {
for (int c=0; c <= EightPuzzleNode.MaxC; c++) {
if (node.isEmpty(r,c)) {
continue;
}
int digit=node.cell(r,c);
Pn+=Math.abs(diffs[digit][0] - r);
Pn+=Math.abs(diffs[digit][1] - c);
}
}
int gn=0;
DepthTransition t=(DepthTransition)state.storedData();
if (t != null) {
gn=t.depth;
}
return gn + Pn;
}
| h(n) = P(n), where P(n) is the sum of the distances (via Manhattan metric) that each tile is from "home". <p> Compute f(n) = g(n) + h(n) where g(n) is the length of the path from the start node n to the state. |
@SuppressWarnings("unchecked") @Bean public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder(){
return new Jackson2ObjectMapperBuilder().modulesToInstall(AfterburnerModule.class);
}
| add module Java 8 Time and AfterBurner in class path |
public boolean has(Class<? extends StoredObject> objectClass){
return storedObjects.containsKey(objectClass);
}
| Check if the storage has an object |
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){
switch (featureID) {
case TypesPackage.VIRTUAL_BASE_TYPE__DECLARED_OWNED_MEMBERS:
return ((InternalEList<?>)getDeclaredOwnedMembers()).basicRemove(otherEnd,msgs);
}
return super.eInverseRemove(otherEnd,featureID,msgs);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@SuppressWarnings("unchecked") public static <K extends Comparable<? super K>,V>ImmutableSortedMap<K,V> of(K k1,V v1,K k2,V v2,K k3,V v3,K k4,V v4){
return ofEntries(entryOf(k1,v1),entryOf(k2,v2),entryOf(k3,v3),entryOf(k4,v4));
}
| Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys. |
protected boolean useNullValue(){
return true;
}
| Override if your map does not allow <code>null</code> values. The default implementation returns <code>true</code>. |
public MediaWikiParser createParser(){
logger.debug("Selected Parser: " + parserClass);
if (parserClass == ModularParser.class) {
ModularParser mwgp=new ModularParser("\n",languageIdentifers,categoryIdentifers,imageIdentifers,showImageText,deleteTags,showMathTagContent,calculateSrcSpans,null);
StringBuilder sb=new StringBuilder();
sb.append(lineSeparator + "languageIdentifers: ");
for ( String s : languageIdentifers) {
sb.append(s + " ");
}
sb.append(lineSeparator + "categoryIdentifers: ");
for ( String s : categoryIdentifers) {
sb.append(s + " ");
}
sb.append(lineSeparator + "imageIdentifers: ");
for ( String s : imageIdentifers) {
sb.append(s + " ");
}
logger.debug(sb.toString());
MediaWikiTemplateParser mwtp;
logger.debug("Selected TemplateParser: " + templateParserClass);
if (templateParserClass == GermanTemplateParser.class) {
for ( String s : deleteTemplates) {
logger.debug("DeleteTemplate: '" + s + "'");
}
for ( String s : parseTemplates) {
logger.debug("ParseTemplate: '" + s + "'");
}
mwtp=new GermanTemplateParser(mwgp,deleteTemplates,parseTemplates);
}
else if (templateParserClass == FlushTemplates.class) {
mwtp=new FlushTemplates();
}
else if (templateParserClass == ShowTemplateNamesAndParameters.class) {
mwtp=new ShowTemplateNamesAndParameters();
}
else {
logger.error("TemplateParser Class Not Found!");
return null;
}
mwgp.setTemplateParser(mwtp);
return mwgp;
}
else {
logger.error("Parser Class Not Found!");
return null;
}
}
| Creates a MediaWikiParser with the configurations which has been set. |
public void window(double[] x,int index,double[] y){
if (y.length != w.length) throw new IllegalArgumentException("Destination array length does not match window length");
for (int i=0; i < w.length; i++) {
int j=index + i;
if (j >= 0 && j < x.length) y[i]=w[i] * x[j];
else y[i]=0.0f;
}
}
| Windows a sequence and places the result in a specified array. |
public boolean isIn(Rectangle region){
return region.max.x > this.min.x && region.min.x < this.max.x ? (region.max.y > this.min.y && region.min.y < this.max.y ? true : false) : false;
}
| Returns whether the given region intersects with this one. |
public ComponentColorModel(ColorSpace colorSpace,boolean hasAlpha,boolean isAlphaPremultiplied,int transparency,int transferType){
this(colorSpace,null,hasAlpha,isAlphaPremultiplied,transparency,transferType);
}
| Constructs a <CODE>ComponentColorModel</CODE> from the specified parameters. Color components will be in the specified <CODE>ColorSpace</CODE>. The supported transfer types are <CODE>DataBuffer.TYPE_BYTE</CODE>, <CODE>DataBuffer.TYPE_USHORT</CODE>, <CODE>DataBuffer.TYPE_INT</CODE>, <CODE>DataBuffer.TYPE_SHORT</CODE>, <CODE>DataBuffer.TYPE_FLOAT</CODE>, and <CODE>DataBuffer.TYPE_DOUBLE</CODE>. The number of significant bits per color and alpha component will be 8, 16, 32, 16, 32, or 64, respectively. The number of color components will be the number of components in the <CODE>ColorSpace</CODE>. There will be an alpha component if <CODE>hasAlpha</CODE> is <CODE>true</CODE>. If <CODE>hasAlpha</CODE> is true, then the boolean <CODE>isAlphaPremultiplied</CODE> specifies how to interpret color and alpha samples in pixel values. If the boolean is true, color samples are assumed to have been multiplied by the alpha sample. The <CODE>transparency</CODE> specifies what alpha values can be represented by this color model. The acceptable <code>transparency</code> values are <CODE>OPAQUE</CODE>, <CODE>BITMASK</CODE> or <CODE>TRANSLUCENT</CODE>. The <CODE>transferType</CODE> is the type of primitive array used to represent pixel values. |
public static Method cancel(){
return create(CANCEL);
}
| Constructs a METHOD property whose value is "CANCEL". |
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. |
private void initialize(){
this.setSize(414,290);
this.setResizable(false);
this.setTitle(Messages.getString("AboutDialog.About_JPlag"));
this.setContentPane(getJContentPane());
}
| This method initializes this |
public Exception(){
}
| Constructs an Exception with no specified detail message. |
void run() throws Exception {
log("starting test");
setup();
createStarImportScope();
test();
}
| Run the test. |
static Map<String,String> readPayload(byte[] rawData) throws UnsupportedEncodingException {
int totalSize=rawData.length;
int payloadSize=totalSize - HEADER_SIZE;
byte[] rawPayload=Arrays.copyOfRange(rawData,HEADER_SIZE,HEADER_SIZE + payloadSize);
Map<String,String> payload=readRawPayload(rawPayload,payloadSize);
return payload;
}
| Builds a Map with the payload, from the raw data. |
public Builder canSelectBothPhotoVideo(){
canSelectPhoto=true;
canSelectVideo=true;
return this;
}
| Can choose photo or video. Default only choose photo. |
@Override public boolean test(T value){
long now=System.currentTimeMillis();
if (now < nextTrueTimeMillis) return false;
else synchronized (this) {
lastTrueTimeMillis=now;
nextTrueTimeMillis=now + deadtimePeriodMillis;
return true;
}
}
| Test the deadtime predicate. |
public PriorityQueue(PriorityQueue<? extends E> c){
getFromPriorityQueue(c);
}
| Constructs a priority queue that contains the elements of another priority queue. The constructed priority queue has the initial capacity of 110% of the specified one. Both priority queues have the same comparator. |
private void updateSLOPolicies(Set<String> poolSupportedSLONames,Map<String,StringSet> unManagedVolumeInformation,Map<String,String> unManagedVolumeCharacteristics,String sgSLOName){
if (null != poolSupportedSLONames && !poolSupportedSLONames.isEmpty()) {
StringSet sloNamesSet=new StringSet();
for ( String poolSLOName : poolSupportedSLONames) {
if (null != sgSLOName && poolSLOName.contains(sgSLOName)) {
if (!sgSLOName.contains(Constants.WORKLOAD) && poolSLOName.contains(Constants.WORKLOAD)) {
continue;
}
sloNamesSet.add(poolSLOName);
_logger.info("found a matching slo: {}",poolSLOName);
break;
}
}
if (!sloNamesSet.isEmpty()) {
unManagedVolumeInformation.put(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString(),sloNamesSet);
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(),Boolean.TRUE.toString());
}
else {
_logger.warn("StorageGroup SLOName is not found in Pool settings.");
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(),Boolean.FALSE.toString());
}
}
}
| Update the SLO policy Name for VMAX3 volumes. |
@Override public boolean canLoad(Entity unit,boolean checkFalse){
if (!unit.isEnemyOf(this) && unit.isFighter() && (fighters.size() < getMaxSize())) {
return true;
}
if ((unit instanceof FighterSquadron) && !unit.isEnemyOf(this) && (getId() != unit.getId())&& (((FighterSquadron)unit).fighters.size() > 0)&& ((fighters.size() + ((FighterSquadron)unit).fighters.size()) <= getMaxSize())) {
return true;
}
return false;
}
| Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit. |
public static synchronized CoderResult unmappableForLength(int length) throws IllegalArgumentException {
if (length > 0) {
Integer key=Integer.valueOf(length);
synchronized (_unmappableErrors) {
CoderResult r=_unmappableErrors.get(key);
if (r == null) {
r=new CoderResult(TYPE_UNMAPPABLE_CHAR,length);
_unmappableErrors.put(key,r);
}
return r;
}
}
throw new IllegalArgumentException("length <= 0: " + length);
}
| Gets a <code>CoderResult</code> object indicating an unmappable character error. |
public synchronized long size(){
return size;
}
| Returns the number of bytes currently being used to store the values in this cache. This may be greater than the max size if a background deletion is pending. |
protected void addNamePropertyDescriptor(Object object){
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),getResourceLocator(),getString("_UI_Route_name_feature"),getString("_UI_PropertyDescriptor_description","_UI_Route_name_feature","_UI_Route_type"),EipPackage.Literals.ROUTE__NAME,true,false,false,ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,null,null));
}
| This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- end-user-doc --> |
public static void addSnowballAttributesData(SampledVertex v,List<Tuple<String,String>> attributes){
if (v.isDetected()) attributes.add(new Tuple<String,String>(DETECTED_ATTR,String.valueOf(v.getIterationDetected())));
if (v.isSampled()) attributes.add(new Tuple<String,String>(SAMPLED_ATTR,String.valueOf(v.getIterationSampled())));
}
| Encodes the detected and sampled state of a vertex into attributes data. |
public JSONException(String message){
super(message);
}
| Constructs a JSONException with an explanatory message. |
private void updateNamespacePermissions(UserNamespaceAuthorizationEntity userNamespaceAuthorizationEntity,List<NamespacePermissionEnum> namespacePermissions){
userNamespaceAuthorizationEntity.setReadPermission(namespacePermissions.contains(NamespacePermissionEnum.READ));
userNamespaceAuthorizationEntity.setWritePermission(namespacePermissions.contains(NamespacePermissionEnum.WRITE));
userNamespaceAuthorizationEntity.setExecutePermission(namespacePermissions.contains(NamespacePermissionEnum.EXECUTE));
userNamespaceAuthorizationEntity.setGrantPermission(namespacePermissions.contains(NamespacePermissionEnum.GRANT));
}
| Sets relative flags on the user namespace authorization entity as per specified list of namespace permissions. |
private void failTask(Throwable e){
ServiceUtils.logSevere(this,e);
this.sendStageProgressPatch(buildPatch(TaskState.TaskStage.FAILED,e));
}
| Moves the service into the FAILED state. |
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 double defaultNoisePercent(){
return 10;
}
| returns the default noise percentage |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.