code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static final boolean isIplSpecificIdentityReportMessage(LocoNetMessage m,Integer hostMfr,Integer hostDevice){
if (!isIplIdentityReportMessage(m)) {
return false;
}
if ((m.getElement(4) == hostMfr) && (m.getElement(5) == hostDevice)) {
return true;
}
return false;
}
| Checks message m to determine if it contains a IPL Identity Report message for a specific host manufacturer and specific host device type. |
public static boolean isBetween(double val,double theshold1,double theshold2){
return theshold2 > theshold1 ? val > theshold1 && val < theshold2 : val > theshold2 && val < theshold1;
}
| Used to determine whether a value is between two thresholds. |
public void testFloatingPrecision1() throws Exception {
new BufferValidator(100,"LINESTRING (331771 5530174, 331776 5530175, 331782 5530177, 331787 5530177, 331791 5530178, 331796 5530178, 331800 5530178, 331805 5530177, 331811 5530176, 331817 5530175, 331823 5530173, 331828 5530171, 331832 5530169, 331835 5530167, 331839 5530163, 331843 5530160, 331846 5530157, 331849 5530154, 331853 5530150, 331855 5530145, 331857 5530141)").test();
}
| The #testFloatingPrecisionN tests were taken from bufferError-dist 100.jml. |
public AttributeCertificateHolder(int digestedObjectType,String digestAlgorithm,String otherObjectTypeID,byte[] objectDigest){
holder=new Holder(new ObjectDigestInfo(digestedObjectType,new ASN1ObjectIdentifier(otherObjectTypeID),new AlgorithmIdentifier(digestAlgorithm),Arrays.clone(objectDigest)));
}
| Constructs a holder for v2 attribute certificates with a hash value for some type of object. <p> <code>digestedObjectType</code> can be one of the following: <ul> <li>0 - publicKey - A hash of the public key of the holder must be passed. <li>1 - publicKeyCert - A hash of the public key certificate of the holder must be passed. <li>2 - otherObjectDigest - A hash of some other object type must be passed. <code>otherObjectTypeID</code> must not be empty. </ul> <p> This cannot be used if a v1 attribute certificate is used. |
public void incrementTargetsCountAll(){
targetsCountAll.incrementAndGet();
}
| increments the targets all counter. |
@Override protected boolean isSuccessful(final Player player){
return getState() > 0;
}
| Decides if the activity was successful. |
void mutateStaticField(String field){
PurityNode node=PurityGlobalNode.node;
mutated.put(node,field);
nodes.add(node);
if (doCheck) sanityCheck();
}
| Store a primitive type into a static field left.field = v |
public void testFlipBitException(){
byte aBytes[]={-1,-128,56,100,-2,-76,89,45,91,3,-15,35,26};
int aSign=1;
int number=-7;
BigInteger aNumber=new BigInteger(aSign,aBytes);
try {
aNumber.flipBit(number);
fail("ArithmeticException has not been caught");
}
catch ( ArithmeticException e) {
}
}
| flipBit(int n) of a negative n |
private static long sublong(String value,int begin_index,int end_index){
String substring=value.substring(begin_index,end_index);
return (substring.length() > 0) ? Long.parseLong(substring) : -1;
}
| Returns a substring of the given string value from the given begin index to the given end index as a long. If the substring is empty, then -1 will be returned. |
private void processBlockChanges(){
synchronized (blockChanges) {
List<BlockChangeMessage> messages=new ArrayList<>(blockChanges);
blockChanges.clear();
Map<Key,Map<BlockVector,BlockChangeMessage>> chunks=new HashMap<>();
for ( BlockChangeMessage message : messages) {
if (message != null) {
Key key=new Key(message.getX() >> 4,message.getZ() >> 4);
if (canSeeChunk(key)) {
Map<BlockVector,BlockChangeMessage> map=chunks.get(key);
if (map == null) {
map=new HashMap<>();
chunks.put(key,map);
}
map.put(new BlockVector(message.getX(),message.getY(),message.getZ()),message);
}
}
}
for ( Map.Entry<Key,Map<BlockVector,BlockChangeMessage>> entry : chunks.entrySet()) {
Key key=entry.getKey();
List<BlockChangeMessage> value=new ArrayList<>(entry.getValue().values());
if (value.size() == 1) {
session.send(value.get(0));
}
else if (value.size() > 1) {
session.send(new MultiBlockChangeMessage(key.getX(),key.getZ(),value));
}
}
List<Message> postMessages=new ArrayList<>(afterBlockChanges);
afterBlockChanges.clear();
postMessages.forEach(null);
}
}
| Process and send pending BlockChangeMessages. |
@Override public void onConnected(Bundle connectionHint){
mLastLocation=LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (mLastLocation != null) {
mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude()));
mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude()));
}
}
| Runs when a GoogleApiClient object successfully connects. |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Attr newAttribute;
Node testAddress;
NamedNodeMap attributes;
Attr districtNode;
String attrValue;
Node setNode;
doc=(Document)load("hc_staff",true);
elementList=doc.getElementsByTagName("acronym");
testAddress=elementList.item(1);
newAttribute=doc.createAttribute("class");
attributes=testAddress.getAttributes();
setNode=attributes.setNamedItem(newAttribute);
districtNode=(Attr)attributes.getNamedItem("class");
attrValue=districtNode.getNodeValue();
assertEquals("namednodemapSetNamedItemThatExistsAssert","",attrValue);
}
| Runs the test case. |
@Nullable @Override public final ImageFormat determineFormat(byte[] headerBytes,int headerSize){
Preconditions.checkNotNull(headerBytes);
if (WebpSupportStatus.isWebpHeader(headerBytes,0,headerSize)) {
return getWebpFormat(headerBytes,headerSize);
}
if (isJpegHeader(headerBytes,headerSize)) {
return DefaultImageFormats.JPEG;
}
if (isPngHeader(headerBytes,headerSize)) {
return DefaultImageFormats.PNG;
}
if (isGifHeader(headerBytes,headerSize)) {
return DefaultImageFormats.GIF;
}
if (isBmpHeader(headerBytes,headerSize)) {
return DefaultImageFormats.BMP;
}
return ImageFormat.UNKNOWN;
}
| Tries to match imageHeaderByte and headerSize against every known image format. If any match succeeds, corresponding ImageFormat is returned. |
public SymbolTableEntryOriginal createSymbolTableEntryOriginal(){
SymbolTableEntryOriginalImpl symbolTableEntryOriginal=new SymbolTableEntryOriginalImpl();
return symbolTableEntryOriginal;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public boolean isPrinted(){
Object oo=get_Value(COLUMNNAME_IsPrinted);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Printed. |
public TaskDescriptionCompat(String label,Bitmap icon,int colorPrimary){
if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) {
throw new RuntimeException("A TaskDescription's primary color should be opaque");
}
mLabel=label;
mIcon=icon;
mColorPrimary=colorPrimary;
}
| Creates the TaskDescription to the specified values. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:49.464 -0400",hash_original_method="31F26CED2D9DD4AAAFE52ACDE68992E7",hash_generated_method="11FC7D3D554A594833AA979DB176E76F") private int handleX(String value,DoubleMetaphoneResult result,int index){
if (index == 0) {
result.append('S');
index++;
}
else {
if (!((index == value.length() - 1) && (contains(value,index - 3,3,"IAU","EAU") || contains(value,index - 2,2,"AU","OU")))) {
result.append("KS");
}
index=contains(value,index + 1,1,"C","X") ? index + 2 : index + 1;
}
return index;
}
| Handles 'X' cases |
protected void sequence_TStructMemberList_ThisTypeRefStructural_TypeRefWithoutModifiers(ISerializationContext context,ThisTypeRefStructural semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: TypeRefWithoutModifiers returns ThisTypeRefStructural Constraint: (definedTypingStrategy=TypingStrategyUseSiteOperator astStructuralMembers+=TStructMember* dynamic?='+'?) |
public void openOSM(File file){
osm=new OSM(file.getPath());
LOG.info("Read OSM");
}
| TODO Javadoc. What is this for? |
void initNullKeyForUrl(String url){
initNullKeyForUrlInternal(url,false);
}
| init null key for url |
@VisibleForTesting void overrideDecidedStateForTesting(boolean decidedState){
mDidOverrideDecidedStateForTesting=true;
mDecidedStateForTesting=decidedState;
}
| Overrides the decided/undecided state for the user preference. |
private GPOUtils(){
}
| This class should not be instantiated |
public Object eval(CallStack callstack,Interpreter interpreter) throws EvalError {
try {
NameSpace namespace=callstack.top();
BSHType typeNode=getTypeNode();
Class type=typeNode.getType(callstack,interpreter);
BSHVariableDeclarator[] bvda=getDeclarators();
for (int i=0; i < bvda.length; i++) {
BSHVariableDeclarator dec=bvda[i];
Object value=dec.eval(typeNode,callstack,interpreter);
try {
namespace.setTypedVariable(dec.name,type,value,modifiers);
}
catch ( UtilEvalError e) {
throw e.toEvalError(this,callstack);
}
}
}
catch ( EvalError e) {
e.reThrow("Typed variable declaration");
}
return Primitive.VOID;
}
| evaluate the type and one or more variable declarators, e.g.: int a, b=5, c; |
public static boolean isVisible(Class<?> clazz,ClassLoader classLoader){
if (classLoader == null) {
return true;
}
try {
Class<?> actualClass=classLoader.loadClass(clazz.getName());
return (clazz == actualClass);
}
catch ( ClassNotFoundException ex) {
return false;
}
}
| Check whether the given class is visible in the given ClassLoader. |
public final static HeaderElement parseHeaderElement(final String value,HeaderValueParser parser) throws ParseException {
if (value == null) {
throw new IllegalArgumentException("Value to parse may not be null");
}
if (parser == null) parser=BasicHeaderValueParser.DEFAULT;
CharArrayBuffer buffer=new CharArrayBuffer(value.length());
buffer.append(value);
ParserCursor cursor=new ParserCursor(0,value.length());
return parser.parseHeaderElement(buffer,cursor);
}
| Parses an element with the given parser. |
private SnapshotIndexCommit snapshot(SnapshotIndexCommit commit) throws IOException {
SnapshotHolder snapshotHolder=snapshots.get(commit.getGeneration());
if (snapshotHolder == null) {
snapshotHolder=new SnapshotHolder(0);
snapshots.put(commit.getGeneration(),snapshotHolder);
}
snapshotHolder.counter++;
return new OneTimeReleaseSnapshotIndexCommit(this,commit);
}
| Helper method to snapshot a give commit. |
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit){
switch (hexDigit) {
case '0':
return FFFF.clone();
case '1':
return FFFT.clone();
case '2':
return FFTF.clone();
case '3':
return FFTT.clone();
case '4':
return FTFF.clone();
case '5':
return FTFT.clone();
case '6':
return FTTF.clone();
case '7':
return FTTT.clone();
case '8':
return TFFF.clone();
case '9':
return TFFT.clone();
case 'a':
case 'A':
return TFTF.clone();
case 'b':
case 'B':
return TFTT.clone();
case 'c':
case 'C':
return TTFF.clone();
case 'd':
case 'D':
return TTFT.clone();
case 'e':
case 'E':
return TTTF.clone();
case 'f':
case 'F':
return TTTT.clone();
default :
throw new IllegalArgumentException("Cannot interpret '" + hexDigit + "' as a hexadecimal digit");
}
}
| <p> Converts a hexadecimal digit into binary (represented as boolean array) using the Msb0 bit ordering. </p> <p> '1' is converted as follow: (0, 0, 0, 1) </p> |
public static <E>SortedSet<E> synchronizedSortedSet(SortedSet<E> set){
if (set == null) {
throw new NullPointerException();
}
return new SynchronizedSortedSet<E>(set);
}
| Returns a wrapper on the specified sorted set which synchronizes all access to the sorted set. |
private void cleanMapping(){
ArrayList<Integer> toRemove=new ArrayList<Integer>();
int size=mListMapping.size();
for (int i=0; i < size; ++i) {
if (mListMapping.keyAt(i) == mListMapping.valueAt(i)) {
toRemove.add(mListMapping.keyAt(i));
}
}
size=toRemove.size();
for (int i=0; i < size; ++i) {
mListMapping.delete(toRemove.get(i));
}
}
| Remove unnecessary mappings from sparse array. |
public void onMessage(Message message){
}
| Empty implementation of MessageListener. |
private void add(Geometry geom){
if (geom.isEmpty()) return;
if (geom instanceof Point) {
addPoint(geom.getCoordinate());
}
else if (geom instanceof LineString) {
addLineSegments(geom.getCoordinates());
}
else if (geom instanceof Polygon) {
Polygon poly=(Polygon)geom;
add(poly);
}
else if (geom instanceof GeometryCollection) {
GeometryCollection gc=(GeometryCollection)geom;
for (int i=0; i < gc.getNumGeometries(); i++) {
add(gc.getGeometryN(i));
}
}
}
| Adds a Geometry to the centroid total. |
@Override public boolean contractorBillNumberChangeRequired(final EgBillregister bill,final WorkOrder workOrder,final CFinancialYear financialYear){
return true;
}
| The method return true if the bill number has to be re-generated |
@Override public void eUnset(int featureID){
switch (featureID) {
case N4JSPackage.EXPORTED_VARIABLE_STATEMENT__ANNOTATION_LIST:
setAnnotationList((AnnotationList)null);
return;
case N4JSPackage.EXPORTED_VARIABLE_STATEMENT__DECLARED_MODIFIERS:
getDeclaredModifiers().clear();
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public int alloc(final RWStore store,final int size,final IAllocationContext context){
try {
if (size <= 0) throw new IllegalArgumentException("Allocate requires positive size, got: " + size);
if (size > m_size) throw new IllegalArgumentException("FixedAllocator with slots of " + m_size + " bytes requested allocation for "+ size+ " bytes");
if (m_freeBits == 0) {
throw new IllegalStateException("Request to allocate from " + m_size + "byte slot FixedAllocator with zero bits free - should not be on the Free List");
}
int addr=-1;
if (m_size <= m_store.cSmallSlot) {
return allocFromIndex(size);
}
final Iterator<AllocBlock> iter=m_allocBlocks.iterator();
int count=-1;
while (addr == -1 && iter.hasNext()) {
count++;
final AllocBlock block=iter.next();
checkBlock(block);
addr=block.alloc(m_size);
}
if (addr != -1) {
addr+=3;
if (--m_freeBits == 0) {
if (s_islogTrace) log.trace("Remove from free list");
removeFromFreeList();
if (m_freeList.size() > 0) {
if (s_islogDebug) {
final FixedAllocator nxt=(FixedAllocator)m_freeList.get(0);
log.debug("Freelist head: " + nxt.getSummaryStats());
}
}
}
addr+=(count * 32 * m_bitSize);
final int value=-((m_index << RWStore.OFFSET_BITS) + addr);
if (m_statsBucket != null) {
m_statsBucket.allocate(size);
}
return value;
}
else {
StringBuilder sb=new StringBuilder();
sb.append("FixedAllocator returning null address, with freeBits: " + m_freeBits + "\n");
for ( AllocBlock ab : m_allocBlocks) {
sb.append(ab.show() + "\n");
}
log.error(sb);
return 0;
}
}
finally {
if (s_islogDebug) checkBits();
}
}
| The introduction of IAllocationContexts has added some complexity to the older concept of a free list. With AllocationContexts it is possibly for allocator to have free space available but this being restricted to a specific AllocationContext. <p> In addition to the standard free allocation search we want to add a "density" restriction for small slots to encourage the aggregation of writes (by increasing the likelihood of sibling slot allocation). <p> There is some "Do What I mean" complexity here, with difficulty in determining a good rule to identify an initial allocation point. There is a danger of significantly reducing the allocation efficiency of short transactions if we too naively check committed bit density. We should only do this when identifying the initial allocation, and when the allocIndex is incremented. |
private static String generateIB(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String wBit,final IOperandTreeNode rootNodeOfRegisterList){
final String startAddress=environment.getNextVariableString();
final String endAddress=environment.getNextVariableString();
final Integer numberOfSetBits=rootNodeOfRegisterList.getChildren().size();
long baseOffset=offset;
instructions.add(ReilHelpers.createAdd(baseOffset++,dw,registerNodeValue,dw,String.valueOf(4),dw,startAddress));
instructions.add(ReilHelpers.createAdd(baseOffset++,dw,registerNodeValue,dw,String.valueOf(numberOfSetBits * 4),dw,endAddress));
if (wBit.equals("2")) {
instructions.add(ReilHelpers.createStr(baseOffset++,dw,endAddress,dw,registerNodeValue));
}
return startAddress;
}
| Increment before IB ( LDMIB || LDMED ) || ( STMIB || STMFA ) start_address = Rn + 4 end_address = Rn + (Number_Of_Set_Bits_In(register_list) * 4) if ConditionPassed(cond) and W == 1 then Rn = Rn + (Number_Of_Set_Bits_In(register_list) * 4) |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:20.267 -0500",hash_original_method="41C1A121517CD12760C521BBD9AF1967",hash_generated_method="AF18146D80DB438DD0A2F77C34F0CB67") public void drawRoundRect(RectF rect,float rx,float ry,Paint paint){
if (rect == null) {
throw new NullPointerException();
}
native_drawRoundRect(mNativeCanvas,rect,rx,ry,paint.mNativePaint);
}
| Draw the specified round-rect using the specified paint. The roundrect will be filled or framed based on the Style in the paint. |
private static String prettyPrintObject(LzPersistentBaseImpl<? extends GenericPK> object,PrettyPrintOptions options){
if (options != null && options.getStyle() == ReferenceStyle.NAME) {
if (options.isExplicitType()) {
return PrettyPrintConstant.IDENTIFIER_TAG + AnalysisScope.AXIS + ":"+ PrettyPrintConstant.OPEN_IDENT+ object.getName()+ PrettyPrintConstant.CLOSE_IDENT;
}
else {
return PrettyPrintConstant.OPEN_IDENT + object.getName() + PrettyPrintConstant.CLOSE_IDENT;
}
}
else {
return PrettyPrintConstant.IDENTIFIER_TAG + PrettyPrintConstant.OPEN_IDENT + object.getOid()+ PrettyPrintConstant.CLOSE_IDENT;
}
}
| utility method to pretty-print a object id |
public AbstractPreferencePagePresenter(String title,String category,ImageResource icon){
this.title=title;
this.category=category;
this.icon=icon;
}
| Create preference page. |
public static void inexistentField(String targetFieldName,String targetClassName){
throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException5,targetFieldName,targetClassName));
}
| Thrown when the target field doesn't exist. |
public static String displaySymbolTable(LocalVariableMap symbolTable){
StringBuilder sb=new StringBuilder();
Set<String> keys=symbolTable.keySet();
if (keys.isEmpty()) {
sb.append("None\n");
}
else {
int count=0;
for ( String key : keys) {
sb.append(" [");
sb.append(++count);
sb.append("]");
sb.append(" (");
sb.append(determineOutputTypeAsString(symbolTable,key));
sb.append(") ");
sb.append(key);
sb.append(": ");
sb.append(symbolTable.get(key));
sb.append("\n");
}
}
return sb.toString();
}
| Display the keys and values in the symbol table |
public ReilBlock(final List<ReilInstruction> instructions){
Preconditions.checkNotNull(instructions,"Error: Instructions argument can not be null");
for ( final ReilInstruction instruction : instructions) {
Preconditions.checkNotNull(instruction,"Error: Instructions list contains a null-element");
}
m_instructions=new ArrayList<ReilInstruction>(instructions);
}
| Creates a new REIL block. |
public void assertValidRange(int range[],String sname) throws SettingsError {
if (range.length != 2) {
throw new SettingsError("Range setting " + getFullPropertyName(sname) + " should contain only two comma separated integer values");
}
if (range[0] > range[1]) {
throw new SettingsError("Range setting's " + getFullPropertyName(sname) + " first value should be smaller or equal to second value");
}
}
| Checks that the given integer array contains a valid range. I.e., the length of the array must be two and <code>first_value <= second_value</code>. |
public GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException {
if (primaryKey == null) {
return null;
}
GenericValue genericValue=GenericValue.create(primaryKey);
genericDAO.select(genericValue);
return genericValue;
}
| Find a Generic Entity by its Primary Key |
public static boolean hideSoftInput(Activity activity){
if (activity.getCurrentFocus() != null) {
InputMethodManager imm=(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),0);
}
return false;
}
| Hide Soft Input |
public TeamCommand(Server server){
super(server,"t","Allows players on the same team to chat with each other in the game.");
}
| Creates new WhoCommand |
public T caseNamespace_(Namespace_ object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Namespace </em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
public Portfolio findById(Integer id){
try {
EntityManager entityManager=EntityManagerHelper.getEntityManager();
entityManager.getTransaction().begin();
Portfolio instance=entityManager.find(Portfolio.class,id);
instance.getPortfolioAccounts().size();
entityManager.getTransaction().commit();
return instance;
}
catch ( Exception re) {
EntityManagerHelper.rollback();
throw re;
}
finally {
EntityManagerHelper.close();
}
}
| Method findById. |
public void unlock(long stamp){
long a=stamp & ABITS, m, s;
WNode h;
while (((s=state) & SBITS) == (stamp & SBITS)) {
if ((m=s & ABITS) == 0L) break;
else if (m == WBIT) {
if (a != m) break;
U.putLongVolatile(this,STATE,(s+=WBIT) == 0L ? ORIGIN : s);
if ((h=whead) != null && h.status != 0) release(h);
return;
}
else if (a == 0L || a >= WBIT) break;
else if (m < RFULL) {
if (U.compareAndSwapLong(this,STATE,s,s - RUNIT)) {
if (m == RUNIT && (h=whead) != null && h.status != 0) release(h);
return;
}
}
else if (tryDecReaderOverflow(s) != 0L) return;
}
throw new IllegalMonitorStateException();
}
| If the lock state matches the given stamp, releases the corresponding mode of the lock. |
public void remove(int start,int end){
checkWidget();
this.table.remove(start,end);
}
| Removes the items from the receiver's list which are between the given zero-relative start and end indices (inclusive). |
private void defineInternalFrameMenuButtons(UIDefaults d){
String p="InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\"";
String c=PAINTER_PREFIX + "TitlePaneMenuButtonPainter";
d.put(p + ".WindowNotFocused",new TitlePaneMenuButtonWindowNotFocusedState());
d.put(p + ".contentMargins",new InsetsUIResource(0,0,0,0));
d.put(p + "[Enabled].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_ENABLED));
d.put(p + "[Disabled].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_DISABLED));
d.put(p + "[MouseOver].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER));
d.put(p + "[Pressed].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_PRESSED));
d.put(p + "[Enabled+WindowNotFocused].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_ENABLED_WINDOWNOTFOCUSED));
d.put(p + "[MouseOver+WindowNotFocused].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER_WINDOWNOTFOCUSED));
d.put(p + "[Pressed+WindowNotFocused].iconPainter",new LazyPainter(c,TitlePaneMenuButtonPainter.Which.ICON_PRESSED_WINDOWNOTFOCUSED));
d.put(p + ".icon",new SeaGlassIcon(p,"iconPainter",19,18));
}
| Initialize the internal frame menu button settings. |
public void sourcesAreProperForm(final SteadyStateEvolutionState state,final BreedingPipeline[] breedingPipelines){
for (int x=0; x < breedingPipelines.length; x++) {
((SteadyStateBSourceForm)(breedingPipelines[x])).sourcesAreProperForm(state);
}
}
| Called to check to see if the breeding sources are correct -- if you use this method, you must call state.output.exitIfErrors() immediately afterwards. |
@SuppressFBWarnings("DM_EXIT") @VisibleForTesting void prepareNativeLibraries(){
try {
BrowserStartupController.get(getApplicationContext(),LibraryProcessType.PROCESS_BROWSER).startBrowserProcessesSync(false);
}
catch ( ProcessInitException e) {
Log.e(TAG,"ProcessInitException while starting the browser process");
System.exit(-1);
}
}
| Attempt to start up the browser processes and load the native libraries. |
public int numKeys(){
int result=basic.numKeys();
for ( DeterministicKeyChain chain : chains) result+=chain.numKeys();
return result;
}
| Returns the number of keys managed by this group, including the lookahead buffers. |
private void requestExpressionFocus(){
currentExpression.requestFocusInWindow();
}
| Requests focus on the expression text |
public boolean isSignedSet(){
if (signed == null) return false;
else return true;
}
| Returns true only if the signed flag has been set explicitly and is not in the default state. |
private static int decode4to3(byte[] source,int srcOffset,byte[] destination,int destOffset,int options){
if (source == null) {
throw new NullPointerException("Source array was null.");
}
if (destination == null) {
throw new NullPointerException("Destination array was null.");
}
if (srcOffset < 0 || srcOffset + 3 >= source.length) {
throw new IllegalArgumentException(String.format("Source array with length %d cannot have offset of %d and still process four bytes.",source.length,srcOffset));
}
if (destOffset < 0 || destOffset + 2 >= destination.length) {
throw new IllegalArgumentException(String.format("Destination array with length %d cannot have offset of %d and still store three bytes.",destination.length,destOffset));
}
byte[] DECODABET=getDecodabet(options);
if (source[srcOffset + 2] == EQUALS_SIGN) {
int outBuff=((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12);
destination[destOffset]=(byte)(outBuff >>> 16);
return 1;
}
else if (source[srcOffset + 3] == EQUALS_SIGN) {
int outBuff=((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6);
destination[destOffset]=(byte)(outBuff >>> 16);
destination[destOffset + 1]=(byte)(outBuff >>> 8);
return 2;
}
else {
int outBuff=((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6)| ((DECODABET[source[srcOffset + 3]] & 0xFF));
destination[destOffset]=(byte)(outBuff >> 16);
destination[destOffset + 1]=(byte)(outBuff >> 8);
destination[destOffset + 2]=(byte)(outBuff);
return 3;
}
}
| Decodes four bytes from array <var>source</var> and writes the resulting bytes (up to three of them) to <var>destination</var>. The source and destination arrays can be manipulated anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>. This method does not check to make sure your arrays are large enough to accomodate <var>srcOffset</var> + 4 for the <var>source</var> array or <var>destOffset</var> + 3 for the <var>destination</var> array. This method returns the actual number of bytes that were converted from the Base64 encoding. <p>This is the lowest level of the decoding methods with all possible parameters.</p> |
public String addAndStartProcess(ClusterProcess clusterProcess){
return addAndStartProcess(clusterProcess,clusterConfig.getTimeout());
}
| Starts a container. This container will be removed when the Mesos cluster is shut down. The method is used by frameworks |
SAXParserMMImpl(SAXParserFactoryMMImpl spf,Hashtable features) throws SAXException {
this(spf,features,false);
}
| Create a SAX parser with the associated features |
public ComponentPrinter(PrintableComponent... components){
this.components=components;
}
| The given components that should be printed. |
@Override public boolean containsValue(Object val){
return _map.containsValue(unwrapValue((V)val));
}
| Checks for the presence of <tt>val</tt> in the values of the map. |
public final boolean sendMessageAtFrontOfQueue(Message msg){
return mExec.sendMessageAtFrontOfQueue(msg);
}
| Enqueue a message at the front of the message queue, to be processed on the next iteration of the message loop. You will receive it in callback, in the thread attached to this handler. <b>This method is only for use in very special circumstances -- it can easily starve the message queue, cause ordering problems, or have other unexpected side-effects.</b> |
public NotificationData clone(){
NotificationData result=new NotificationData();
return result;
}
| Deep clone |
private static void initTestFile(File blah,long size) throws Exception {
if (blah.exists()) blah.delete();
FileOutputStream fos=new FileOutputStream(blah);
BufferedWriter awriter=new BufferedWriter(new OutputStreamWriter(fos,"8859_1"));
for (int i=0; i < size; i++) {
awriter.write("e");
}
awriter.flush();
awriter.close();
}
| Creates file blah of specified size in bytes. |
protected boolean useFastVectorHighlighter(SolrParams params,SchemaField schemaField){
boolean useFvhParam=params.getFieldBool(schemaField.getName(),HighlightParams.USE_FVH,false);
if (!useFvhParam) return false;
boolean termPosOff=schemaField.storeTermPositions() && schemaField.storeTermOffsets();
if (!termPosOff) {
log.warn("Solr will use the standard Highlighter instead of FastVectorHighlighter because the {} field " + "does not store TermVectors with TermPositions and TermOffsets.",schemaField.getName());
}
return termPosOff;
}
| Determines if we should use the FastVectorHighlighter for this field. |
public void write(char cbuf[],int off,int len){
if ((off < 0) || (off > cbuf.length) || (len < 0)|| ((off + len) > cbuf.length)|| ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
}
else if (len == 0) {
return;
}
buf.append(cbuf,off,len);
}
| Write a portion of an array of characters. |
@Override final public Constant<E> clone(){
return this;
}
| Clone is overridden to reduce heap churn. |
private void updateContact(int index){
Contact contact=contacts.get(index);
Intent intent=new Intent(this,ViewActivity.class);
intent.putExtra("CONTACT",contact);
startActivity(intent);
}
| Start ViewActivity to update a Contact. |
private List<IsilonNetworkPool> discoverNetworkPools(StorageSystem storageSystem) throws IsilonCollectionException {
List<IsilonNetworkPool> isilonNetworkPoolList=new ArrayList<IsilonNetworkPool>();
URI storageSystemId=storageSystem.getId();
_log.info("discoverNetworkPools for storage system {} - start",storageSystemId);
List<IsilonNetworkPool> isilonNetworkPoolsTemp=null;
try {
if (VersionChecker.verifyVersionDetails(ONEFS_V8,storageSystem.getFirmwareVersion()) >= 0) {
_log.info("Isilon release version {} and storagesystem label {}",storageSystem.getFirmwareVersion(),storageSystem.getLabel());
IsilonApi isilonApi=getIsilonDevice(storageSystem);
isilonNetworkPoolsTemp=isilonApi.getNetworkPools(null);
if (isilonNetworkPoolsTemp != null) {
isilonNetworkPoolList.addAll(isilonNetworkPoolsTemp);
}
}
else {
IsilonSshApi sshDmApi=new IsilonSshApi();
sshDmApi.setConnParams(storageSystem.getIpAddress(),storageSystem.getUsername(),storageSystem.getPassword());
Map<String,List<String>> networkPools=sshDmApi.getNetworkPools();
List<String> smartconnects=null;
IsilonNetworkPool isiNetworkPool=null;
for ( Map.Entry<String,List<String>> networkpool : networkPools.entrySet()) {
smartconnects=networkpool.getValue();
if (smartconnects != null) {
for ( String smartconnect : smartconnects) {
isiNetworkPool=new IsilonNetworkPool();
isiNetworkPool.setAccess_zone(networkpool.getKey());
isiNetworkPool.setSc_dns_zone(smartconnect);
isilonNetworkPoolList.add(isiNetworkPool);
}
}
}
}
}
catch ( Exception e) {
_log.error("discover of NetworkPools is failed. %s",e.getMessage());
}
return isilonNetworkPoolList;
}
| discover the network interface of given Isilon storage cluster |
void callbackJavascript(final String instanceId,final String callback,final Object data,boolean keepAlive){
if (TextUtils.isEmpty(instanceId) || TextUtils.isEmpty(callback) || mJSHandler == null) {
return;
}
addJSTask(METHOD_CALLBACK,instanceId,callback,data,keepAlive);
sendMessage(instanceId,WXJSBridgeMsgType.CALL_JS_BATCH);
}
| Callback to Javascript function. |
public Aspects findAspectsByClassName(String aspectClassName) throws PersistentModelException {
try {
if ("org.trade.persistent.dao.Strategy".equals(aspectClassName)) {
List<Strategy> items=m_strategyHome.findAll();
Aspects aspects=new Aspects();
for ( Object item : items) {
aspects.add((Aspect)item);
}
aspects.setDirty(false);
return aspects;
}
else if ("org.trade.persistent.dao.Portfolio".equals(aspectClassName)) {
List<Portfolio> items=m_portfolioHome.findAll();
Aspects aspects=new Aspects();
for ( Object item : items) {
aspects.add((Aspect)item);
}
aspects.setDirty(false);
return aspects;
}
else {
return m_aspectHome.findByClassName(aspectClassName);
}
}
catch ( Exception ex) {
throw new PersistentModelException("Error finding Aspects: " + ex.getMessage());
}
}
| Method findAspectsByClassName. |
public Builder collapseKey(String value){
collapseKey=value;
return this;
}
| Sets the collapseKey property. |
public static _Fields findByThriftId(int fieldId){
switch (fieldId) {
case 1:
return HEADER;
case 2:
return NODE_ID;
case 3:
return AUTH_SCHEME;
case 4:
return AUTH_CHALLENGE_RESPONSE;
default :
return null;
}
}
| Find the _Fields constant that matches fieldId, or null if its not found. |
public long optLong(int index){
return optLong(index,0);
}
| Get the optional long value associated with an index. Zero is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. |
public Set<Map.Entry<String,JsonElement>> entrySet(){
return Collections.unmodifiableSet(members.entrySet());
}
| Returns a set of members of this object. The set is ordered alphabetically. |
public JSONObject put(String key,Collection<?> value) throws JSONException {
this.put(key,new JSONArray(value));
return this;
}
| Put a key/value pair in the JSONObject, where the value will be a JSONArray which is produced from a Collection. |
public static IgniteState state(){
return state(null);
}
| Gets state of grid default grid. |
public static void deleteDirectory(final File directory) throws IOException {
if (!directory.exists()) {
return;
}
if (!isSymlink(directory)) {
cleanDirectory(directory);
}
if (!directory.delete()) {
final String message="Unable to delete directory " + directory + ".";
throw new IOException(message);
}
}
| Deletes a directory recursively. |
public Writer write(Writer writer) throws JSONException {
return this.write(writer,0,0);
}
| Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added. <p> Warning: This method assumes that the data structure is acyclical. |
public GeneralRuntimeException(){
super();
}
| Creates new <code>GeneralException</code> without detail message. |
private ClassControlFlowGraph computeCCFG(String className){
if (rawCFGs.get(className) == null) throw new IllegalArgumentException("can't compute CCFG, don't know CFGs for class " + className);
ClassCallGraph ccg=new ClassCallGraph(classLoader,className);
if (Properties.WRITE_CFG) ccg.toDot();
ClassControlFlowGraph ccfg=new ClassControlFlowGraph(ccg);
if (Properties.WRITE_CFG) ccfg.toDot();
return ccfg;
}
| Computes the CCFG for the given class If no CFG is known for the given class, an IllegalArgumentException is thrown |
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 isPingPongSupported(){
return clientVersion >= Pong.MIN_PROTOCOL_VERSION;
}
| Returns true if the clientVersion field is >= Pong.MIN_PROTOCOL_VERSION. If it is then ping() is usable. |
public boolean isCompleted(){
return isCompleted;
}
| Returns true if the dispatch completed for this future. |
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){
switch (featureID) {
case DatatypePackage.ENTITY__PROPERTIES:
return ((InternalEList<?>)getProperties()).basicRemove(otherEnd,msgs);
}
return super.eInverseRemove(otherEnd,featureID,msgs);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
SelectableLabel(String text){
super(text);
setEditable(false);
setBorder(null);
setOpaque(false);
JLabel tmp=new JLabel();
setFont(tmp.getFont());
}
| creates a new SelectableLabel |
protected void sequence_PatternCharacter_Term(ISerializationContext context,PatternCharacter semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: Disjunction returns PatternCharacter Disjunction.Disjunction_0_1_0 returns PatternCharacter Alternative returns PatternCharacter Alternative.Sequence_1_0 returns PatternCharacter Term returns PatternCharacter Constraint: ( ( value=PATTERN_CHARACTER_NO_DASH | value=UNICODE_LETTER | value=UNICODE_DIGIT | value='-' | value=',' | value='=' | value=':' | value='!' | value='{' | value='}' | value=']' ) quantifier=Quantifier? ) |
private static int gallopRight(Comparable<Object> key,Object[] a,int base,int len,int hint){
if (DEBUG) assert len > 0 && hint >= 0 && hint < len;
int ofs=1;
int lastOfs=0;
if (key.compareTo(a[base + hint]) < 0) {
int maxOfs=hint + 1;
while (ofs < maxOfs && key.compareTo(a[base + hint - ofs]) < 0) {
lastOfs=ofs;
ofs=(ofs << 1) + 1;
if (ofs <= 0) ofs=maxOfs;
}
if (ofs > maxOfs) ofs=maxOfs;
int tmp=lastOfs;
lastOfs=hint - ofs;
ofs=hint - tmp;
}
else {
int maxOfs=len - hint;
while (ofs < maxOfs && key.compareTo(a[base + hint + ofs]) >= 0) {
lastOfs=ofs;
ofs=(ofs << 1) + 1;
if (ofs <= 0) ofs=maxOfs;
}
if (ofs > maxOfs) ofs=maxOfs;
lastOfs+=hint;
ofs+=hint;
}
if (DEBUG) assert -1 <= lastOfs && lastOfs < ofs && ofs <= len;
lastOfs++;
while (lastOfs < ofs) {
int m=lastOfs + ((ofs - lastOfs) >>> 1);
if (key.compareTo(a[base + m]) < 0) ofs=m;
else lastOfs=m + 1;
}
if (DEBUG) assert lastOfs == ofs;
return ofs;
}
| Like gallopLeft, except that if the range contains an element equal to key, gallopRight returns the index after the rightmost equal element. |
public PerfDataBuffer(VmIdentifier vmid) throws MonitorException {
try {
ByteBuffer bb=perf.attach(vmid.getLocalVmId(),vmid.getMode());
createPerfDataBuffer(bb,vmid.getLocalVmId());
}
catch ( IllegalArgumentException e) {
try {
String filename=PerfDataFile.getTempDirectory() + PerfDataFile.dirNamePrefix + Integer.toString(vmid.getLocalVmId());
File f=new File(filename);
FileChannel fc=new RandomAccessFile(f,"r").getChannel();
ByteBuffer bb=fc.map(FileChannel.MapMode.READ_ONLY,0L,(int)fc.size());
fc.close();
createPerfDataBuffer(bb,vmid.getLocalVmId());
}
catch ( FileNotFoundException e2) {
throw new MonitorException(vmid.getLocalVmId() + " not found",e);
}
catch ( IOException e2) {
throw new MonitorException("Could not map 1.4.1 file for " + vmid.getLocalVmId(),e2);
}
}
catch ( IOException e) {
throw new MonitorException("Could not attach to " + vmid.getLocalVmId(),e);
}
}
| Create a PerfDataBuffer instance for accessing the specified instrumentation buffer. |
public void print(CharSequence text) throws IOException {
int size=text.length();
int pos=0;
for (int i=0; i < size; i++) {
if (text.charAt(i) == '\n') {
write(text.subSequence(pos,size),i - pos + 1);
pos=i + 1;
atStartOfLine=true;
}
}
write(text.subSequence(pos,size),size - pos);
}
| Print text to the output stream. |
@DSSpec(DSCat.IO) @DSSource({DSSourceKind.IO}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:56:45.235 -0500",hash_original_method="469514DB0DA90571D02A531A0FA63D6F",hash_generated_method="A9605FE51958909BD225DA582AF5352D") public final long readLong() throws IOException {
readFully(scratch,0,SizeOf.LONG);
return Memory.peekLong(scratch,0,ByteOrder.BIG_ENDIAN);
}
| Reads a big-endian 64-bit long from the current position in this file. Blocks until eight bytes have been read, the end of the file is reached or an exception is thrown. |
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 isTimeout(){
return m_timeout;
}
| Timeout - i.e process did not complete |
public boolean isWorking(){
return working;
}
| Determine if a ring is working. |
public static Map<String,List<User>> createRoleMap(List<User> users){
Map<String,List<User>> roles=new HashMap<String,List<User>>();
for ( User user : users) {
for ( String role : user.getRoles()) {
List<User> usersForRole;
if (roles.containsKey(role)) {
usersForRole=roles.get(role);
}
else {
usersForRole=new ArrayList<User>();
}
if (!usersForRole.contains(user)) {
usersForRole.add(user);
}
roles.put(role,usersForRole);
}
}
return roles;
}
| Create a user map indexed on the roles. |
void invalidate(){
m_row=-1;
}
| Invalidates this tuple. Called by an enclosing table when a row is deleted. |
public void uninstallUI(JComponent a){
for (int i=0; i < uis.size(); i++) {
((ComponentUI)(uis.elementAt(i))).uninstallUI(a);
}
}
| Invokes the <code>uninstallUI</code> method on each UI handled by this object. |
public double toDouble(){
if (m_length == 0) return Double.NaN;
int i;
char c;
String valueString=fsb().getString(m_start,m_length);
for (i=0; i < m_length; i++) if (!XMLCharacterRecognizer.isWhiteSpace(valueString.charAt(i))) break;
if (i == m_length) return Double.NaN;
if (valueString.charAt(i) == '-') i++;
for (; i < m_length; i++) {
c=valueString.charAt(i);
if (c != '.' && (c < '0' || c > '9')) break;
}
for (; i < m_length; i++) if (!XMLCharacterRecognizer.isWhiteSpace(valueString.charAt(i))) break;
if (i != m_length) return Double.NaN;
try {
return new Double(valueString).doubleValue();
}
catch ( NumberFormatException nfe) {
return Double.NaN;
}
}
| Convert a string to a double -- Allowed input is in fixed notation ddd.fff. %OPT% CHECK PERFORMANCE against generating a Java String and converting it to double. The advantage of running in native machine code -- perhaps even microcode, on some systems -- may more than make up for the cost of allocating and discarding the additional object. We need to benchmark this. %OPT% More importantly, we need to decide whether we _care_ about the performance of this operation. Does XString.toDouble constitute any measurable percentage of our typical runtime? I suspect not! |
@NonNull public List<TrayItem> queryProviderSafe(@NonNull final Uri uri){
try {
return queryProvider(uri);
}
catch ( TrayException e) {
return new ArrayList<>();
}
}
| sends a query for TrayItems to the provider, doesn't throw when the database access couldn't be established |
public static void dropTable(SQLiteDatabase db,boolean ifExists){
String sql="DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'PICTURE_CACHE'";
db.execSQL(sql);
}
| Drops the underlying database table. |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:57.174 -0400",hash_original_method="5A37259F0EF0B23F2917794B45619826",hash_generated_method="75DEA827C7EB00AC33348C52A8F99A33") protected File[] filterDirectoryContents(File directory,int depth,File[] files) throws IOException {
return files;
}
| Overridable callback method invoked with the contents of each directory. <p> This implementation returns the files unchanged |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.