code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public boolean isDistinct(){
return distinct;
}
| This method was generated by MyBatis Generator. This method corresponds to the database table role |
public boolean isSetName(){
return this.name != null;
}
| Returns true if field name is set (has been assigned a value) and false otherwise |
void cacheImage(Dimension size,Image i){
Object w=Display.getInstance().createSoftWeakRef(i);
getScaleCache().put(size,w);
}
| Returns a cached scaled image |
private void nextImage(){
n=n < Integer.parseInt(tfNumberOfImages.getText()) ? n+=1 : 1;
getImage();
}
| Load next image |
@Override public SlotWindow inspectMe(IEntity entity,RPSlot content,SlotWindow container,int width,int height){
if ((container != null) && container.isVisible()) {
return container;
}
else {
SlotWindow window=new SlotWindow(entity.getName(),width,height);
window.setSlot(entity,content.getName());
window.setAcceptedTypes(EntityMap.getClass("item",null,null));
window.setVisible(true);
addRepaintable(window);
return window;
}
}
| Inspect an entity slot. Show the result within the ContainerPanel. |
@SafeVarargs public static <Type>DisjunctiveValidator<Type> create(@NonNull final Context context,@StringRes final int resourceId,@NonNull final Validator<Type>... validators){
return new DisjunctiveValidator<>(context,resourceId,validators);
}
| Creates and returns a validator, which allows to combine multiple validators in a disjunctive manner. |
private void configureAuth(ClientBuilder clientBuilder){
if (conf.client.authType == AuthenticationType.OAUTH) {
authToken=JerseyClientUtil.configureOAuth1(conf.client.oauth,clientBuilder);
}
else if (conf.client.authType != AuthenticationType.NONE) {
JerseyClientUtil.configurePasswordAuth(conf.client.authType,conf.client.basicAuth,clientBuilder);
}
}
| Helper to apply authentication properties to Jersey client. |
public static Test suite(){
return (new TestSuite(SelectComponentValueITCase.class));
}
| Return the tests included in this test suite. |
public void testWithoutAlt() throws Exception {
expectThrows(Exception.class,null);
}
| Benchmark should fail loading the algorithm when alt is not specified |
public static ComponentUI createUI(JComponent ta){
return new SynthTextAreaUI();
}
| Creates a UI object for a JTextArea. |
public int size(){
return listeners.length;
}
| Returns the number of registered listeners. |
public double canUse(GadgetType gadget){
Object count=gadgetCooldowns.get(gadget);
if (count == null || System.currentTimeMillis() > (long)count) {
return -1;
}
double valueMillis=(long)count - System.currentTimeMillis();
return valueMillis / 1000d;
}
| Checks if a player can use a given gadget type. |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:36.465 -0500",hash_original_method="C2DD503B984E96C46288CB6F7C364E09",hash_generated_method="4AC8318C015B20964426413A31217551") public void putInt(String key,int value){
unparcel();
mMap.put(key,value);
}
| Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key. |
private List<String> breakupString(final String str,final int maxLength){
final List<String> result=new ArrayList<String>();
int startIdx=-1;
int lastIdx;
int idx;
if (str == null) {
return result;
}
do {
idx=startIdx;
do {
lastIdx=idx;
idx=str.indexOf(' ',lastIdx + 1);
LOG.fine("startIdx=" + startIdx + " lastIdx="+ lastIdx+ " idx="+ idx);
if (idx < 0) {
result.add(str.substring(startIdx + 1));
return result;
}
}
while ((idx - startIdx) <= maxLength);
result.add(str.substring(startIdx + 1,lastIdx));
startIdx=lastIdx;
}
while (true);
}
| Breaks up a string into sub-strings, each with a length equal to or less than the max length specified. |
public AgentAppEnvironmentView createEnvironmentView(){
return new ExtendedMapAgentView();
}
| Creates a <code>MapAgentView</code>. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public int compareDirection(EdgeEnd e){
if (dx == e.dx && dy == e.dy) return 0;
if (quadrant > e.quadrant) return 1;
if (quadrant < e.quadrant) return -1;
return CGAlgorithms.computeOrientation(e.p0,e.p1,p1);
}
| Implements the total order relation: <p> a has a greater angle with the positive x-axis than b <p> Using the obvious algorithm of simply computing the angle is not robust, since the angle calculation is obviously susceptible to roundoff. A robust algorithm is: - first compare the quadrant. If the quadrants are different, it it trivial to determine which vector is "greater". - if the vectors lie in the same quadrant, the computeOrientation function can be used to decide the relative orientation of the vectors. |
private void removeParserNotices(ParseResult res){
if (noticesToHighlights != null) {
RSyntaxTextAreaHighlighter h=(RSyntaxTextAreaHighlighter)textArea.getHighlighter();
for (Iterator i=noticesToHighlights.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry=(Map.Entry)i.next();
ParserNotice notice=(ParserNotice)entry.getKey();
if (shouldRemoveNotice(notice,res)) {
if (entry.getValue() != null) {
h.removeParserHighlight(entry.getValue());
}
i.remove();
if (DEBUG_PARSING) {
System.out.println("[DEBUG]: ... notice removed: " + notice);
}
}
else {
if (DEBUG_PARSING) {
System.out.println("[DEBUG]: ... notice not removed: " + notice);
}
}
}
}
}
| Removes any currently stored notices (and the corresponding highlights from the editor) from the same Parser, and in the given line range, as in the results. |
protected String createLoginPayload(String login,char[] pwd){
StringBuilder sb=new StringBuilder("{\"login\":\"");
return sb.append(login).append("\", \"password\":\"").append(pwd).append("\"}").toString();
}
| Create a JSON String that represent login payload.</p> Payload will look like: <code> { 'login': 'userLogin', 'password': 'userpassword' } </code> |
public boolean isImmediateDominatorOf(DominatorNode idom,DominatorNode node){
return (node.getParent() == idom);
}
| Returns true if idom immediately dominates node. |
synchronized final boolean cancel(final int id,final boolean mayInterrupt){
return cancel(id,mayInterrupt,true);
}
| Cancels running operation. |
public AnnotationVisitor visitTypeAnnotation(int typeRef,TypePath typePath,String desc,boolean visible){
if (api < Opcodes.ASM5) {
throw new RuntimeException();
}
if (cv != null) {
return cv.visitTypeAnnotation(typeRef,typePath,desc,visible);
}
return null;
}
| Visits an annotation on a type in the class signature. |
public TransactionOptimisticException(String msg,Throwable cause){
super(msg,cause);
}
| Creates new optimistic exception with given error message and optional nested exception. |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
public boolean canContain(ElementType other){
return (theModel & other.theMemberOf) != 0;
}
| Returns true if this element type can contain another element type. That is, if any of the models in this element's model vector match any of the models in the other element type's member-of vector. |
public Builder addMenuItem(@NonNull String label,@NonNull PendingIntent pendingIntent){
if (mMenuItems == null) mMenuItems=new ArrayList<>();
Bundle bundle=new Bundle();
bundle.putString(KEY_MENU_ITEM_TITLE,label);
bundle.putParcelable(KEY_PENDING_INTENT,pendingIntent);
mMenuItems.add(bundle);
return this;
}
| Adds a menu item. |
public ZoomControl(int mouseButton){
button=mouseButton;
}
| Create a new zoom control. |
public synchronized boolean isNew(Response response){
if (!response.getOptions().hasObserve()) {
return true;
}
long T1=getTimestamp();
long T2=System.currentTimeMillis();
int V1=getCurrent();
int V2=response.getOptions().getObserve();
if (V1 < V2 && V2 - V1 < 1 << 23 || V1 > V2 && V1 - V2 > 1 << 23 || T2 > T1 + 128000) {
setTimestamp(T2);
number.set(V2);
return true;
}
else {
return false;
}
}
| Returns true if the specified notification is newer than the current one. |
private void moveCursor(CursorSprite cursor,Coords newPos){
final Rectangle oldBounds=new Rectangle(cursor.getBounds());
if (newPos != null) {
cursor.setHexLocation(newPos);
}
else {
cursor.setOffScreen();
}
repaint(oldBounds);
repaint(cursor.getBounds());
}
| Moves the cursor to the new position, or hides it, if newPos is null |
public Boolean isUserCreated(){
return userCreated;
}
| Gets the value of the userCreated property. |
@Autowired public AccountsController(AccountRepository accountRepository){
this.accountRepository=accountRepository;
logger.info("AccountRepository says system has " + accountRepository.countAccounts() + " accounts");
}
| Create an instance plugging in the respository of Accounts. |
public static String format(float[] d,String sep,NumberFormat nf){
return (d == null) ? "null" : (d.length == 0) ? "" : formatTo(new StringBuilder(),d,sep,nf).toString();
}
| Formats the float array d with the specified number format. |
public AccessibilityManagerService(Context context){
mContext=context;
mPackageManager=mContext.getPackageManager();
mWindowManagerService=(IWindowManager)ServiceManager.getService(Context.WINDOW_SERVICE);
mSecurityPolicy=new SecurityPolicy();
mMainHandler=new MainHandler(mContext.getMainLooper());
DisplayManager displayManager=(DisplayManager)mContext.getSystemService(Context.DISPLAY_SERVICE);
mDefaultDisplay=displayManager.getDisplay(Display.DEFAULT_DISPLAY);
registerBroadcastReceivers();
new AccessibilityContentObserver(mMainHandler).register(context.getContentResolver());
}
| Creates a new instance. |
public static ODataRequestContext createODataRequestContext(ODataRequest.Method method,EntityDataModel entityDataModel) throws UnsupportedEncodingException {
return new ODataRequestContext(createODataRequest(method),createODataUri(),entityDataModel);
}
| Create an OData Request Context with the given HTTP method. |
private static String capitalize(String s){
if (s == null || s.length() == 0) {
return "";
}
char first=s.charAt(0);
if (Character.isUpperCase(first)) {
return s;
}
else {
return Character.toUpperCase(first) + s.substring(1);
}
}
| INTERNAL method that capitalizes the first character of a string |
public LocalActivityManager(Activity parent,boolean singleMode){
mActivityThread=ActivityThread.currentActivityThread();
mParent=parent;
mSingleMode=singleMode;
}
| Create a new LocalActivityManager for holding activities running within the given <var>parent</var>. |
static public void assertSameIteratorAnyOrder(final String msg,final byte[][] expected,final Iterator<byte[]> actual){
final List<byte[]> range=new LinkedList<byte[]>();
for ( byte[] b : expected) range.add(b);
for (int j=0; j < expected.length; j++) {
if (!actual.hasNext()) {
fail(msg + ": Index exhausted while expecting more object(s)" + ": index="+ j);
}
final byte[] actualValue=actual.next();
boolean found=false;
final Iterator<byte[]> titr=range.iterator();
while (titr.hasNext()) {
final byte[] b=titr.next();
if (BytesUtil.bytesEqual(b,actualValue)) {
found=true;
titr.remove();
break;
}
}
if (!found) {
fail("Value not expected" + ": index=" + j + ", object="+ actualValue);
}
}
if (actual.hasNext()) {
final byte[] actualValue=actual.next();
fail("Iterator will deliver too many objects object=" + actualValue);
}
}
| Verifies that the iterator visits the specified objects in some arbitrary ordering and that the iterator is exhausted once all expected objects have been visited. The implementation uses a selection without replacement "pattern". |
@Override public void preProcess() throws Exception {
if (m_SplitEvaluator == null) {
throw new Exception("No SplitEvalutor set");
}
if (m_ResultListener == null) {
throw new Exception("No ResultListener set");
}
m_ResultListener.preProcess(this);
}
| Prepare to generate results. |
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. |
static Interface of(String name){
return new InterfaceImpl(name);
}
| Creates a new instance implementing this interface by using the default implementation. |
private int handleW(String value,DoubleMetaphoneResult result,int index){
if (contains(value,index,2,"WR")) {
result.append('R');
index+=2;
}
else {
if (index == 0 && (isVowel(charAt(value,index + 1)) || contains(value,index,2,"WH"))) {
if (isVowel(charAt(value,index + 1))) {
result.append('A','F');
}
else {
result.append('A');
}
index++;
}
else if ((index == value.length() - 1 && isVowel(charAt(value,index - 1))) || contains(value,index - 1,5,"EWSKI","EWSKY","OWSKI","OWSKY") || contains(value,0,3,"SCH")) {
result.appendAlternate('F');
index++;
}
else if (contains(value,index,4,"WICZ","WITZ")) {
result.append("TS","FX");
index+=4;
}
else {
index++;
}
}
return index;
}
| Handles 'W' cases |
public static double quantile(double p,double k,double theta,double shift){
return Math.exp(GammaDistribution.quantile(p,k,theta)) + shift;
}
| Compute probit (inverse cdf) for LogGamma distributions. |
public static void dumpCursor(ICursor cursor,int maxColumnWidth,StringBuilder builder){
if (cursor == null) {
builder.append("Cursor is null");
return;
}
String[] columnNames=cursor.getColumnNames();
for ( String col : columnNames) {
addColumnToRowBuilder(builder,col,maxColumnWidth);
}
builder.append('\n');
for (int i=0; i < (maxColumnWidth + 1) * columnNames.length; i++) {
builder.append('=');
}
builder.append('\n');
int position=cursor.getPosition();
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
dumpCurrentRow(cursor,maxColumnWidth,builder);
builder.append('\n');
}
cursor.moveToPosition(position);
}
| Dump the contents of the cursor to the provided builder, formatted in a readable way |
static void writeCRC(IndexOutput output) throws IOException {
long value=output.getChecksum();
if ((value & 0xFFFFFFFF00000000L) != 0) {
throw new IllegalStateException("Illegal CRC-32 checksum: " + value + " (resource="+ output+ ")");
}
output.writeLong(value);
}
| Writes CRC32 value as a 64-bit long to the output. |
public Entry(final String clazz,final String subclazz,final boolean blocked){
this.clazz=clazz;
this.subclazz=subclazz;
this.blocked=blocked;
}
| Create a criteria entry. |
BeginParagraphAction(String nm,boolean select){
super(nm);
this.select=select;
}
| Create this action with the appropriate identifier. |
private void transmit(RtcpCompoundPacket packet) throws NetworkException {
byte[] data=packet.mData;
if (packet.mOffset > 0) {
System.arraycopy(data,packet.mOffset,data=new byte[packet.mLength],0,packet.mLength);
}
mStats.numBytes+=packet.mLength;
mStats.numPackets++;
mRtcpSession.updateavgrtcpsize(packet.mLength);
mRtcpSession.timeOfLastRTCPSent=mRtcpSession.currentTime();
if (data == null) {
return;
}
mDatagramConnection.send(mRemoteAddress,mRemotePort,data);
}
| Transmit a RTCP compound packet to the remote destination |
public boolean removeHeaderView(View v){
if (mHeaderViewInfos.size() > 0) {
boolean result=false;
ListAdapter adapter=getAdapter();
if (adapter != null && ((HeaderViewGridAdapter)adapter).removeHeader(v)) {
result=true;
}
removeFixedViewInfo(v,mHeaderViewInfos);
return result;
}
return false;
}
| Removes a previously-added header view. |
public static boolean isEqual(byte[] digesta,byte[] digestb){
if (digesta.length != digestb.length) {
return false;
}
for (int i=0; i < digesta.length; i++) {
if (digesta[i] != digestb[i]) {
return false;
}
}
return true;
}
| Indicates whether to digest are equal by performing a simply byte-per-byte compare of the two digests. |
private static void rewriteMaxRetries(int value) throws Exception {
BufferedReader fr=new BufferedReader(new FileReader(OneKDC.KRB5_CONF));
FileWriter fw=new FileWriter("alternative-krb5.conf");
while (true) {
String s=fr.readLine();
if (s == null) {
break;
}
if (s.startsWith("[realms]")) {
fw.write("max_retries = 2\n");
fw.write("kdc_timeout = " + BadKdc.toReal(5000) + "\n");
}
else if (s.trim().startsWith("kdc = ")) {
if (value != -1) {
fw.write(" max_retries = " + value + "\n");
fw.write(" kdc_timeout = " + BadKdc.toReal(value * 1000) + "\n");
}
fw.write(" kdc = localhost:33333\n");
}
fw.write(s + "\n");
}
fr.close();
fw.close();
sun.security.krb5.Config.refresh();
}
| Set max_retries and timeout value for realm. The global value is always 2 and 5000. |
public boolean addFriend(String name,String key,int via,String number){
SQLiteDatabase db=getWritableDatabase();
if (db == null) return false;
if (getFriendWithKey(key) != null) {
log.error("Contact was already in the store, data not changed");
return false;
}
ContentValues values=new ContentValues();
values.put(COL_DISPLAY_NAME,Utils.makeTextSafeForSQL(name));
values.put(COL_PUBLIC_KEY,key);
values.put(COL_ADDED_VIA,via);
values.put(COL_NUMBER,Utils.makeTextSafeForSQL(number));
db.insert(TABLE,null,values);
log.debug("Friend Added to store");
return true;
}
| Adds the given friend. |
private FilePosition posFrom(Mark startMark) throws ParseException {
return posFrom(startMark.getFilePosition());
}
| The file position that spans from startMark to the current position. |
private void traceOperation(String s){
}
| Trace the operation. Tracing is disabled by default. |
public Object read(InputNode node) throws Exception {
String name=node.getName();
String element=path.getElement(name);
Label label=elements.get(element);
Converter converter=label.getConverter(context);
return converter.read(node);
}
| The <code>read</code> method uses the name of the XML element to select a converter to be used to read the instance. Selection of the converter is done by looking up the associated label from the union group using the element name. Once the converter has been selected it is used to read the instance. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
int x=getInt(stack);
MediaFile mf=getMediaFile(stack);
return new Long(mf == null ? 0 : mf.getStart(x));
}
| Gets the starting time for a specified segment number in this MediaFile. |
public static void print(Closure self,Object value){
Object owner=getClosureOwner(self);
InvokerHelper.invokeMethod(owner,"print",new Object[]{value});
}
| Print a value to the standard output stream. This method delegates to the owner to execute the method. |
protected void appendDetail(StringBuffer buffer,String fieldName,Map map){
buffer.append(map);
}
| <p>Append to the <code>toString</code> a <code>Map<code>.</p> |
private void testContainerManager(StorageAgent agent) throws Exception {
dag.setAttribute(OperatorContext.STORAGE_AGENT,agent);
StatsListeningOperator o1=dag.addOperator("o1",StatsListeningOperator.class);
FSRecoveryHandler recoveryHandler=new FSRecoveryHandler(dag.assertAppPath(),new Configuration(false));
StreamingContainerManager scm=StreamingContainerManager.getInstance(recoveryHandler,dag,false);
File expFile=new File(recoveryHandler.getDir(),FSRecoveryHandler.FILE_SNAPSHOT);
Assert.assertTrue("snapshot file " + expFile,expFile.exists());
PhysicalPlan plan=scm.getPhysicalPlan();
assertEquals("number required containers",1,plan.getContainers().size());
PTOperator o1p1=plan.getOperators(dag.getMeta(o1)).get(0);
@SuppressWarnings("UnusedAssignment") MockContainer mc=new MockContainer(scm,o1p1.getContainer());
PTContainer originalContainer=o1p1.getContainer();
Assert.assertNotNull(o1p1.getContainer().bufferServerAddress);
assertEquals(PTContainer.State.ACTIVE,o1p1.getContainer().getState());
assertEquals("state " + o1p1,PTOperator.State.PENDING_DEPLOY,o1p1.getState());
dag=StramTestSupport.createDAG(testMeta);
scm=StreamingContainerManager.getInstance(new FSRecoveryHandler(dag.assertAppPath(),new Configuration(false)),dag,false);
dag=scm.getLogicalPlan();
plan=scm.getPhysicalPlan();
o1p1=plan.getOperators(dag.getOperatorMeta("o1")).get(0);
assertEquals("post restore state " + o1p1,PTOperator.State.PENDING_DEPLOY,o1p1.getState());
o1=(StatsListeningOperator)o1p1.getOperatorMeta().getOperator();
assertEquals("containerId",originalContainer.getExternalId(),o1p1.getContainer().getExternalId());
assertEquals("stats listener",1,o1p1.statsListeners.size());
assertEquals("number stats calls",0,o1.processStatsCnt);
assertEquals("post restore 1",PTContainer.State.ALLOCATED,o1p1.getContainer().getState());
assertEquals("post restore 1",originalContainer.bufferServerAddress,o1p1.getContainer().bufferServerAddress);
StreamingContainerAgent sca=scm.getContainerAgent(originalContainer.getExternalId());
Assert.assertNotNull("allocated container restored " + originalContainer,sca);
assertEquals("memory usage allocated container",(int)OperatorContext.MEMORY_MB.defaultValue,sca.container.getAllocatedMemoryMB());
scm.scheduleContainerRestart(originalContainer.getExternalId());
assertEquals("memory usage of failed container",0,sca.container.getAllocatedMemoryMB());
Checkpoint firstCheckpoint=new Checkpoint(3,0,0);
mc=new MockContainer(scm,o1p1.getContainer());
checkpoint(scm,o1p1,firstCheckpoint);
mc.stats(o1p1.getId()).deployState(OperatorHeartbeat.DeployState.ACTIVE).currentWindowId(3).checkpointWindowId(3);
mc.sendHeartbeat();
assertEquals("state " + o1p1,PTOperator.State.ACTIVE,o1p1.getState());
CreateOperatorRequest cor=new CreateOperatorRequest();
cor.setOperatorFQCN(GenericTestOperator.class.getName());
cor.setOperatorName("o2");
CreateStreamRequest csr=new CreateStreamRequest();
csr.setSourceOperatorName("o1");
csr.setSourceOperatorPortName("outport");
csr.setSinkOperatorName("o2");
csr.setSinkOperatorPortName("inport1");
FutureTask<?> lpmf=scm.logicalPlanModification(Lists.newArrayList(cor,csr));
while (!lpmf.isDone()) {
scm.monitorHeartbeat();
}
Assert.assertNull(lpmf.get());
Assert.assertSame("dag references",dag,scm.getLogicalPlan());
assertEquals("number operators after plan modification",2,dag.getAllOperators().size());
o1p1.setState(PTOperator.State.INACTIVE);
Checkpoint offlineCheckpoint=new Checkpoint(10,0,0);
checkpoint(scm,o1p1,offlineCheckpoint);
dag=StramTestSupport.createDAG(testMeta);
scm=StreamingContainerManager.getInstance(new FSRecoveryHandler(dag.assertAppPath(),new Configuration(false)),dag,false);
Assert.assertNotSame("dag references",dag,scm.getLogicalPlan());
assertEquals("number operators after restore",2,scm.getLogicalPlan().getAllOperators().size());
dag=scm.getLogicalPlan();
plan=scm.getPhysicalPlan();
o1p1=plan.getOperators(dag.getOperatorMeta("o1")).get(0);
assertEquals("post restore state " + o1p1,PTOperator.State.INACTIVE,o1p1.getState());
o1=(StatsListeningOperator)o1p1.getOperatorMeta().getOperator();
assertEquals("stats listener",1,o1p1.statsListeners.size());
assertEquals("number stats calls post restore",1,o1.processStatsCnt);
assertEquals("post restore 1",PTContainer.State.ACTIVE,o1p1.getContainer().getState());
assertEquals("post restore 1",originalContainer.bufferServerAddress,o1p1.getContainer().bufferServerAddress);
assertEquals("checkpoints after recovery",Lists.newArrayList(firstCheckpoint,offlineCheckpoint),o1p1.checkpoints);
}
| Test serialization of the container manager with mock execution layer. |
public static boolean substringMatch(CharSequence str,int index,CharSequence substring){
for (int j=0; j < substring.length(); j++) {
int i=index + j;
if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
return false;
}
}
return true;
}
| Test whether the given string matches the given substring at the given index. |
public void addToken(Segment segment,int start,int end,int tokenType,int startOffset){
switch (tokenType) {
case Token.IDENTIFIER:
int value=wordsToHighlight.get(segment,start,end);
if (value != -1) tokenType=value;
break;
case Token.WHITESPACE:
case Token.SEPARATOR:
case Token.OPERATOR:
case Token.LITERAL_NUMBER_DECIMAL_INT:
case Token.LITERAL_STRING_DOUBLE_QUOTE:
case Token.LITERAL_CHAR:
case Token.LITERAL_BACKQUOTE:
case Token.COMMENT_EOL:
case Token.PREPROCESSOR:
case Token.VARIABLE:
break;
default :
new Exception("Unknown tokenType: '" + tokenType + "'").printStackTrace();
tokenType=Token.IDENTIFIER;
break;
}
super.addToken(segment,start,end,tokenType,startOffset);
}
| Checks the token to give it the exact ID it deserves before being passed up to the super method. |
protected void startDocumentInternal() throws org.xml.sax.SAXException {
if (m_tracer != null) this.fireStartDoc();
}
| This method handles what needs to be done at a startDocument() call, whether from an external caller, or internally called in the serializer. For historical reasons the serializer is flexible to startDocument() not always being called. Even if no external call is made into startDocument() this method will always be called as a self generated internal startDocument, it handles what needs to be done at a startDocument() call. This method exists just to make sure that startDocument() is only ever called from an external caller, which in principle is just a matter of style. |
public static int determineConsecutiveDigitCount(CharSequence msg,int startpos){
int count=0;
int len=msg.length();
int idx=startpos;
if (idx < len) {
char ch=msg.charAt(idx);
while (isDigit(ch) && idx < len) {
count++;
idx++;
if (idx < len) {
ch=msg.charAt(idx);
}
}
}
return count;
}
| Determines the number of consecutive characters that are encodable using numeric compaction. |
@Override public String toString(){
return "CUDA_ARRAY3D_DESCRIPTOR[" + "Width=" + Width + ","+ "Height="+ Height+ ","+ "CUarray_format_Format="+ Format+ ","+ "NumChannels="+ NumChannels+ "]";
}
| Returns a String representation of this object. |
private QuadData doQuadsPatternClause(final Node node,final Object data,final boolean allowBlankNodes) throws VisitorException {
final GroupGraphPattern parentGP=graphPattern;
graphPattern=new GroupGraphPattern();
graphPattern.setStatementPatternScope(parentGP.getStatementPatternScope());
graphPattern.setContextVar(parentGP.getContext());
for (int i=0; i < node.jjtGetNumChildren(); i++) {
node.jjtGetChild(i).jjtAccept(this,data);
}
final QuadData quadData=graphPattern.buildGroup(new QuadData());
if (!allowBlankNodes) {
final Iterator<StatementPatternNode> itr=BOpUtility.visitAll(quadData,StatementPatternNode.class);
while (itr.hasNext()) {
final StatementPatternNode sp=itr.next();
assertNotAnonymousVariable(sp.s());
assertNotAnonymousVariable(sp.o());
}
}
graphPattern=parentGP;
return quadData;
}
| Collect quads patterns for a DELETE/INSERT operation. This form allows variables in the quads patterns. |
public static String localize(double amount,boolean showDecimalPlaces){
NumberFormat defaultFormat=NumberFormat.getCurrencyInstance();
int decimalPlaces=showDecimalPlaces ? 2 : 0;
defaultFormat.setMinimumFractionDigits(decimalPlaces);
defaultFormat.setMaximumFractionDigits(2);
return defaultFormat.format(amount);
}
| Method for localizing an amount to include a string with correct currency symbol based on user's language settings on device. |
public boolean isError(){
return error != null;
}
| Determines if the tasks completed with an error. |
public SQLTransientException(String reason,String sqlState,int vendorCode){
super(reason,sqlState,vendorCode);
}
| Creates an SQLTransientException object. The Reason string is set to the given reason string, the SQLState string is set to the given SQLState string and the Error Code is set to the given error code value. |
public static LongRange resolveRange(LongRange range,long numberSequences){
final long start=range.getStart() == LongRange.MISSING ? 0 : range.getStart();
if (start < 0) {
throw new IllegalArgumentException();
}
if (start > numberSequences || (numberSequences != 0 && start == numberSequences)) {
throw new NoTalkbackSlimException("The start sequence id \"" + start + "\" must be less than than the number of available sequences \""+ numberSequences+ "\".");
}
long end=range.getEnd() == LongRange.MISSING ? numberSequences : range.getEnd();
if (end > numberSequences) {
Diagnostic.warning("The end sequence id \"" + range.getEnd() + "\" is out of range, it"+ " must be from \""+ (start + 1)+ "\" to \""+ numberSequences+ "\". Defaulting end to \""+ numberSequences+ "\"");
end=numberSequences;
}
return new LongRange(start,end);
}
| Resolves an inital range (supplied by the user, and may have unbounded ends) to the available sequences. If end is greater than number of sequences it sets end to number of sequences. |
public void closeJsonStream() throws IOException {
if (generator == null) {
return;
}
while (!stack.isEmpty()) {
writeEndComponent();
}
if (wrapInArray) {
generator.writeEndArray();
}
if (closeGenerator) {
generator.close();
}
}
| Finishes writing the JSON document so that it is syntactically correct. No more data can be written once this method is called. |
public ServiceManager(Iterable<? extends Service> services){
ImmutableList<Service> copy=ImmutableList.copyOf(services);
if (copy.isEmpty()) {
logger.log(Level.WARNING,"ServiceManager configured with no services. Is your application configured properly?",new EmptyServiceManagerWarning());
copy=ImmutableList.<Service>of(new NoOpService());
}
this.state=new ServiceManagerState(copy);
this.services=copy;
WeakReference<ServiceManagerState> stateReference=new WeakReference<ServiceManagerState>(state);
for ( Service service : copy) {
service.addListener(new ServiceListener(service,stateReference),directExecutor());
checkArgument(service.state() == NEW,"Can only manage NEW services, %s",service);
}
this.state.markReady();
}
| Constructs a new instance for managing the given services. |
@Override public void delete(){
ResourceAssignmentCollectionImpl.this.deleteAssignment(getResource());
myAssignmentToResource.delete();
}
| Deletes all the assignments and all the related assignments |
public static double powerCurveToLinear(final double[] curve,double value){
return Math.log((value - curve[0]) / curve[1]) / curve[2];
}
| Map a value on a power curve to a linear value |
private boolean isSelected(Class<? extends DefaultData> clazz){
for ( TableItem tableItem : table.getItems()) {
if (ObjectUtils.equals(tableItem.getData(),clazz)) {
return tableItem.getChecked();
}
}
return false;
}
| Returns if the class is selected in the table. |
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.legendLine=SerialUtilities.readShape(stream);
this.fillComposite=SerialUtilities.readComposite(stream);
}
| Provides serialization support. |
public ActuallyInheritedAndConsumedMembersIterator actuallyInheritedAndMixedMembers(){
return new ActuallyInheritedAndConsumedMembersIterator();
}
| Returns all actually inherited and actually consumed in members. The latter requires them to be set before. Owned members are always actual members (and usually handled elsewhere by caller). |
public void writeRawByte(final int value) throws IOException {
writeRawByte((byte)value);
}
| Write a single byte, represented by an integer value. |
public RegExpExpression(boolean isNot){
this.not=isNot;
}
| Ctor - for use to create an expression tree, without child expression. |
private DeviceScannerFactory(){
}
| Creates a new instance of DeviceScannerFactory |
String rrToString(){
StringBuffer sb=new StringBuffer();
sb.append(priority + " ");
sb.append(weight + " ");
sb.append(port + " ");
sb.append(target);
return sb.toString();
}
| Converts rdata to a String |
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:10.676 -0500",hash_original_method="CAFFB5BC78A2E3A526CF37E51EA3E6DA",hash_generated_method="CAFFB5BC78A2E3A526CF37E51EA3E6DA") void addHeader(String name,String value){
if (name == null) {
String damage="Null http header name";
HttpLog.e(damage);
throw new NullPointerException(damage);
}
if (value == null || value.length() == 0) {
String damage="Null or empty value for header \"" + name + "\"";
HttpLog.e(damage);
throw new RuntimeException(damage);
}
mHttpRequest.addHeader(name,value);
}
| Add header represented by given pair to request. Header will be formatted in request as "name: value\r\n". |
public void add(final ConversationStates state,final Collection<String> triggerStrings,final ChatCondition condition,boolean secondary,final ConversationStates nextState,final String reply,final ChatAction action){
if (triggerStrings == null) {
throw new IllegalArgumentException("trigger list must not be null");
}
Collection<Expression> triggerExpressions=createUniqueTriggerExpressions(state,triggerStrings,null,condition,reply,action);
add(triggerExpressions,state,condition,secondary,nextState,reply,action);
}
| Adds a new set of transitions to the FSM. |
public static boolean isDefaultUseSystemBrowser(){
return BrowserUtil.canUseSystemBrowser();
}
| Returns whether the system browser is used by default |
public FastAdapterBottomSheetDialog<Item> withOnPreClickListener(FastAdapter.OnClickListener<Item> onPreClickListener){
this.mFastItemAdapter.withOnPreClickListener(onPreClickListener);
return this;
}
| Define the OnPreClickListener which will be used for a single item and is called after all internal methods are done |
@SuppressWarnings({"rawtypes","unchecked"}) private void addExtraParamTofirst(Object param,boolean occasional){
final ObjectExpression expr=new ObjectExpression(param);
expr.setIsOccasional(occasional);
if (mParamAccessInfos == null) {
mParamAccessInfos=new ArrayList();
mParamAccessInfos.add(expr);
}
else {
if (mParamAccessInfos.size() > 0) mParamAccessInfos.add(0,expr);
else mParamAccessInfos.add(expr);
}
}
| add the param to the fist of param accessInfo |
public static int installSilent(Context context,String filePath,String pmParams){
if (filePath == null || filePath.length() == 0) {
return INSTALL_FAILED_INVALID_URI;
}
File file=new File(filePath);
if (file == null || file.length() <= 0 || !file.exists() || !file.isFile()) {
return INSTALL_FAILED_INVALID_URI;
}
StringBuilder command=new StringBuilder().append("LD_LIBRARY_PATH=/vendor/lib:/system/lib pm install ").append(pmParams == null ? "" : pmParams).append(" ").append(filePath.replace(" ","\\ "));
ShellUtil.CommandResult commandResult=ShellUtil.execCommand(command.toString(),!isSystemApplication(context),true);
if (commandResult.successMsg != null && (commandResult.successMsg.contains("Success") || commandResult.successMsg.contains("success"))) {
return INSTALL_SUCCEEDED;
}
Logger.e(new StringBuilder().append("installSilent successMsg:").append(commandResult.successMsg).append(", ErrorMsg:").append(commandResult.errorMsg).toString());
if (commandResult.errorMsg == null) {
return INSTALL_FAILED_OTHER;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_ALREADY_EXISTS")) {
return INSTALL_FAILED_ALREADY_EXISTS;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_INVALID_APK")) {
return INSTALL_FAILED_INVALID_APK;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_INVALID_URI")) {
return INSTALL_FAILED_INVALID_URI;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_INSUFFICIENT_STORAGE")) {
return INSTALL_FAILED_INSUFFICIENT_STORAGE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_DUPLICATE_PACKAGE")) {
return INSTALL_FAILED_DUPLICATE_PACKAGE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_NO_SHARED_USER")) {
return INSTALL_FAILED_NO_SHARED_USER;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_UPDATE_INCOMPATIBLE")) {
return INSTALL_FAILED_UPDATE_INCOMPATIBLE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_SHARED_USER_INCOMPATIBLE")) {
return INSTALL_FAILED_SHARED_USER_INCOMPATIBLE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_MISSING_SHARED_LIBRARY")) {
return INSTALL_FAILED_MISSING_SHARED_LIBRARY;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_REPLACE_COULDNT_DELETE")) {
return INSTALL_FAILED_REPLACE_COULDNT_DELETE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_DEXOPT")) {
return INSTALL_FAILED_DEXOPT;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_OLDER_SDK")) {
return INSTALL_FAILED_OLDER_SDK;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_CONFLICTING_PROVIDER")) {
return INSTALL_FAILED_CONFLICTING_PROVIDER;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_NEWER_SDK")) {
return INSTALL_FAILED_NEWER_SDK;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_TEST_ONLY")) {
return INSTALL_FAILED_TEST_ONLY;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_CPU_ABI_INCOMPATIBLE")) {
return INSTALL_FAILED_CPU_ABI_INCOMPATIBLE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_MISSING_FEATURE")) {
return INSTALL_FAILED_MISSING_FEATURE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_CONTAINER_ERROR")) {
return INSTALL_FAILED_CONTAINER_ERROR;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_INVALID_INSTALL_LOCATION")) {
return INSTALL_FAILED_INVALID_INSTALL_LOCATION;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_MEDIA_UNAVAILABLE")) {
return INSTALL_FAILED_MEDIA_UNAVAILABLE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_VERIFICATION_TIMEOUT")) {
return INSTALL_FAILED_VERIFICATION_TIMEOUT;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_VERIFICATION_FAILURE")) {
return INSTALL_FAILED_VERIFICATION_FAILURE;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_PACKAGE_CHANGED")) {
return INSTALL_FAILED_PACKAGE_CHANGED;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_UID_CHANGED")) {
return INSTALL_FAILED_UID_CHANGED;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_NOT_APK")) {
return INSTALL_PARSE_FAILED_NOT_APK;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_BAD_MANIFEST")) {
return INSTALL_PARSE_FAILED_BAD_MANIFEST;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION")) {
return INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_NO_CERTIFICATES")) {
return INSTALL_PARSE_FAILED_NO_CERTIFICATES;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES")) {
return INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING")) {
return INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME")) {
return INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID")) {
return INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_MANIFEST_MALFORMED")) {
return INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
}
if (commandResult.errorMsg.contains("INSTALL_PARSE_FAILED_MANIFEST_EMPTY")) {
return INSTALL_PARSE_FAILED_MANIFEST_EMPTY;
}
if (commandResult.errorMsg.contains("INSTALL_FAILED_INTERNAL_ERROR")) {
return INSTALL_FAILED_INTERNAL_ERROR;
}
return INSTALL_FAILED_OTHER;
}
| install package silent by root <ul> <strong>Attentions:</strong> <li>Don't call this on the ui thread, it may costs some times.</li> <li>You should add <strong>android.permission.INSTALL_PACKAGES</strong> in manifest, so no need to request root permission, if you are system app.</li> </ul> |
@Override public void serialize(OFMatch match,JsonGenerator jGen,SerializerProvider serializer) throws IOException, JsonProcessingException {
jGen.writeStartObject();
jGen.writeStringField("dataLayerDestination",HexString.toHexString(match.getDataLayerDestination()));
jGen.writeStringField("dataLayerSource",HexString.toHexString(match.getDataLayerSource()));
String dataType=Integer.toHexString(match.getDataLayerType());
while (dataType.length() < 4) {
dataType="0".concat(dataType);
}
jGen.writeStringField("dataLayerType","0x" + dataType);
jGen.writeNumberField("dataLayerVirtualLan",match.getDataLayerVirtualLan());
jGen.writeNumberField("dataLayerVirtualLanPriorityCodePoint",match.getDataLayerVirtualLanPriorityCodePoint());
jGen.writeNumberField("inputPort",match.getInputPort());
jGen.writeStringField("networkDestination",intToIp(match.getNetworkDestination()));
jGen.writeNumberField("networkDestinationMaskLen",match.getNetworkDestinationMaskLen());
jGen.writeNumberField("networkProtocol",match.getNetworkProtocol());
jGen.writeStringField("networkSource",intToIp(match.getNetworkSource()));
jGen.writeNumberField("networkSourceMaskLen",match.getNetworkSourceMaskLen());
jGen.writeNumberField("networkTypeOfService",match.getNetworkTypeOfService());
jGen.writeNumberField("transportDestination",match.getTransportDestination());
jGen.writeNumberField("transportSource",match.getTransportSource());
jGen.writeNumberField("wildcards",match.getWildcards());
jGen.writeEndObject();
}
| Performs the serialization of a OFMatch object |
public void testSubmitAfterShutdown(){
ForkJoinPool p=new ForkJoinPool(1);
PoolCleaner cleaner=null;
try {
cleaner=cleaner(p);
p.shutdown();
assertTrue(p.isShutdown());
try {
@SuppressWarnings("unused") ForkJoinTask<Integer> f=p.submit(new FibTask(8));
shouldThrow();
}
catch ( RejectedExecutionException success) {
}
}
finally {
if (cleaner != null) {
cleaner.close();
}
}
}
| A task submitted after shutdown is rejected |
public ServerConnectivityException(Throwable cause){
super(cause);
}
| Create a new instance of ServerConnectivityException with a cause |
protected LocationType(){
}
| Dear JPA... |
public ClaimBuilder putResource(String resource){
return put("resource",resource);
}
| Puts a resource claim. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:13.814 -0500",hash_original_method="3E78E5A9498D2FA8094C2F6169A192AD",hash_generated_method="8C83FF4C61A9DB1335C855AB0D226F3A") public DERExternal(DERObjectIdentifier directReference,DERInteger indirectReference,ASN1Object dataValueDescriptor,DERTaggedObject externalData){
this(directReference,indirectReference,dataValueDescriptor,externalData.getTagNo(),externalData.getDERObject());
}
| Creates a new instance of DERExternal See X.690 for more informations about the meaning of these parameters |
protected boolean parsePredicate(PsiBuilder builder){
final PsiBuilder.Marker marker=builder.mark();
if (builder.getTokenType() != XPathTokenTypes.LBRACKET) {
marker.drop();
return false;
}
builder.advanceLexer();
if (!parseExpr(builder)) {
builder.error("expression expected");
}
checkMatches(builder,XPathTokenTypes.RBRACKET,"] expected");
marker.done(XPathElementTypes.PREDICATE);
return true;
}
| [8] Predicate ::= '[' PredicateExpr ']' [9] PredicateExpr ::= Expr |
public synchronized boolean unregister(Platform platform){
checkNotNull(platform);
boolean removed=platforms.remove(platform);
if (removed) {
logger.log(Level.FINE,"Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit");
boolean choosePreferred=false;
Iterator<Entry<Capability,Platform>> it=preferences.entrySet().iterator();
while (it.hasNext()) {
Entry<Capability,Platform> entry=it.next();
if (entry.getValue().equals(platform)) {
Capability key=entry.getKey();
try {
Method methodUnload=key.getClass().getDeclaredMethod("unload",PlatformManager.class,Platform.class);
methodUnload.setAccessible(true);
methodUnload.invoke(key,this,entry.getValue());
}
catch ( Throwable e) {
throw new RuntimeException(e);
}
it.remove();
choosePreferred=true;
}
}
if (choosePreferred) {
choosePreferred();
}
}
return removed;
}
| Unregister a platform from WorldEdit. <p>If the platform has been chosen for any capabilities, then a new platform will be found.</p> |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:07.050 -0500",hash_original_method="220130DBC584D5B5D45771D972950D18",hash_generated_method="9A5787370DD2B664E63383C7AA2A5BCE") @Override public boolean equals(Object object){
if (object == this) {
return true;
}
if (!(object instanceof NativeDecimalFormat)) {
return false;
}
NativeDecimalFormat obj=(NativeDecimalFormat)object;
if (obj.address == this.address) {
return true;
}
return obj.toPattern().equals(this.toPattern()) && obj.isDecimalSeparatorAlwaysShown() == this.isDecimalSeparatorAlwaysShown() && obj.getGroupingSize() == this.getGroupingSize() && obj.getMultiplier() == this.getMultiplier() && obj.getNegativePrefix().equals(this.getNegativePrefix()) && obj.getNegativeSuffix().equals(this.getNegativeSuffix()) && obj.getPositivePrefix().equals(this.getPositivePrefix()) && obj.getPositiveSuffix().equals(this.getPositiveSuffix()) && obj.getMaximumIntegerDigits() == this.getMaximumIntegerDigits() && obj.getMaximumFractionDigits() == this.getMaximumFractionDigits() && obj.getMinimumIntegerDigits() == this.getMinimumIntegerDigits() && obj.getMinimumFractionDigits() == this.getMinimumFractionDigits() && obj.isGroupingUsed() == this.isGroupingUsed();
}
| Note: this doesn't check that the underlying native DecimalFormat objects' configured native DecimalFormatSymbols objects are equal. It is assumed that the caller (DecimalFormat) will check the DecimalFormatSymbols objects instead, for performance. This is also unreasonably expensive, calling down to JNI multiple times. TODO: remove this and just have DecimalFormat.equals do the right thing itself. |
public BatchFraction threadPool(final String name,final int maxThreads,final int keepAliveTime,final TimeUnit keepAliveUnits){
final ThreadPool<?> threadPool=new ThreadPool<>(name);
threadPool.maxThreads(maxThreads).keepaliveTime("time",Integer.toBinaryString(keepAliveTime)).keepaliveTime("unit",keepAliveUnits.name().toLowerCase(Locale.ROOT));
return threadPool(threadPool);
}
| Creates a new thread-pool that can be used for batch jobs. |
public Bundler putIntArray(String key,int[] value){
bundle.putIntArray(key,value);
return this;
}
| Inserts an int array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. |
public final Bag clear(){
Bag bag=new Bag();
Object[][][] field=this.field;
Object[][] fieldx=null;
Object[] fieldxy=null;
final int width=this.width;
final int height=this.height;
final int length=this.length;
for (int x=0; x < width; x++) {
fieldx=field[x];
for (int y=0; y < height; y++) {
fieldxy=fieldx[y];
for (int z=0; z < length; z++) {
if (fieldxy[z] != null) bag.add(fieldxy[z]);
fieldxy[z]=null;
}
}
}
return bag;
}
| Sets all the locations in the grid to null, and returns in a Bag all stored objects (including duplicates but not null values). You are free to modify the Bag. |
private void removeSlingContent(BundleContext bundleContext){
ServiceReference ResourceResolverFactoryReference=bundleContext.getServiceReference(ResourceResolverFactory.class.getName());
ResourceResolverFactory resolverFactory=(ResourceResolverFactory)bundleContext.getService(ResourceResolverFactoryReference);
if (resolverFactory != null) {
ResourceResolver resolver=null;
try {
resolver=resolverFactory.getAdministrativeResourceResolver(null);
Resource resource=resolver.getResource("/index.html");
if (resource != null) {
try {
resolver.delete(resource);
resolver.commit();
}
catch ( PersistenceException e) {
LOGGER.error("Could not delete resource",e);
}
}
}
catch ( LoginException e) {
LOGGER.error("Could not login to repository",e);
}
finally {
if (resolver != null && resolver.isLive()) {
resolver.close();
resolver=null;
}
}
}
}
| Remove default Sling content such as /index.html. |
protected ColladaAbstractShader(String namespaceURI){
super(namespaceURI);
}
| Construct an instance. |
@Override public String toString(){
if (eIsProxy()) return super.toString();
StringBuffer result=new StringBuffer(super.toString());
result.append(" (key: ");
result.append(key);
result.append(", firstFacet: ");
result.append(firstFacet);
result.append(')');
return result.toString();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.