code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public boolean match(CRL crl){
if (!(crl instanceof X509CRL)) {
return false;
}
X509CRL crlist=(X509CRL)crl;
if ((issuerNames != null) && !(issuerNames.contains(crlist.getIssuerX500Principal().getName(X500Principal.CANONICAL)))) {
return false;
}
if ((minCRL != null) || (maxCRL != null)) {
try {
byte[] bytes=crlist.getExtensionValue("2.5.29.20");
bytes=(byte[])ASN1OctetString.getInstance().decode(bytes);
BigInteger crlNumber=new BigInteger((byte[])ASN1Integer.getInstance().decode(bytes));
if ((minCRL != null) && (crlNumber.compareTo(minCRL) < 0)) {
return false;
}
if ((maxCRL != null) && (crlNumber.compareTo(maxCRL) > 0)) {
return false;
}
}
catch ( IOException e) {
return false;
}
}
if (dateAndTime != -1) {
Date thisUp=crlist.getThisUpdate();
Date nextUp=crlist.getNextUpdate();
if ((thisUp == null) || (nextUp == null)) {
return false;
}
if ((dateAndTime < thisUp.getTime()) || (dateAndTime > nextUp.getTime())) {
return false;
}
}
return true;
}
| Returns whether the specified CRL matches all the criteria collected in this instance. |
public INNER_JOIN INNER_JOIN(String tableToJoin){
return new INNER_JOIN(this,tableToJoin);
}
| Add a INNER JOIN |
public String toString(){
return (attributeValue.toString());
}
| Returns the attribute in user readable form. |
public Map flatten(Map target){
if (target == null) target=new ConfigObject();
populate("",target,this);
return target;
}
| Flattens this ConfigObject populating the results into the target Map |
public static long[] shiftRightI(long[] v,int off){
if (off == 0) {
return v;
}
if (off < 0) {
return shiftLeftI(v,-off);
}
final int shiftWords=off >>> LONG_LOG2_SIZE;
final int shiftBits=off & LONG_LOG2_MASK;
if (shiftWords >= v.length) {
return zeroI(v);
}
if (shiftBits == 0) {
System.arraycopy(v,shiftWords,v,0,v.length - shiftWords);
Arrays.fill(v,v.length - shiftWords,v.length,0);
return v;
}
final int unshiftBits=Long.SIZE - shiftBits;
for (int i=0; i < v.length - shiftWords - 1; i++) {
final int src=i + shiftWords;
v[i]=(v[src + 1] << unshiftBits) | (v[src] >>> shiftBits);
}
v[v.length - shiftWords - 1]=v[v.length - 1] >>> shiftBits;
Arrays.fill(v,v.length - shiftWords,v.length,0);
return v;
}
| Shift a long[] bitset inplace. Low-endian layout for the array. |
void remove(SuperCardToast superCardToast){
mList.remove(superCardToast);
}
| Removes a SuperCardToast from the list. |
private void insert(ByteString byteString){
int depthBin=getDepthBinForLength(byteString.size());
int binEnd=minLengthByDepth[depthBin + 1];
if (prefixesStack.isEmpty() || prefixesStack.peek().size() >= binEnd) {
prefixesStack.push(byteString);
}
else {
int binStart=minLengthByDepth[depthBin];
ByteString newTree=prefixesStack.pop();
while (!prefixesStack.isEmpty() && prefixesStack.peek().size() < binStart) {
ByteString left=prefixesStack.pop();
newTree=new RopeByteString(left,newTree);
}
newTree=new RopeByteString(newTree,byteString);
while (!prefixesStack.isEmpty()) {
depthBin=getDepthBinForLength(newTree.size());
binEnd=minLengthByDepth[depthBin + 1];
if (prefixesStack.peek().size() < binEnd) {
ByteString left=prefixesStack.pop();
newTree=new RopeByteString(left,newTree);
}
else {
break;
}
}
prefixesStack.push(newTree);
}
}
| Push a string on the balance stack (BAP95). BAP95 uses an array and calls the elements in the array 'bins'. We instead use a stack, so the 'bins' of lengths are represented by differences between the elements of minLengthByDepth. <p>If the length bin for our string, and all shorter length bins, are empty, we just push it on the stack. Otherwise, we need to start concatenating, putting the given string in the "middle" and continuing until we land in an empty length bin that matches the length of our concatenation. |
@Override public void onClick(View v){
if (v.getId() == R.id.btnSelect) {
List<IContact> contacts=contactSelectedAdapter.getSelectedContacts();
if (option.allowSelectEmpty || checkMinMaxSelection(contacts.size())) {
ArrayList<String> selectedAccounts=new ArrayList<>();
for ( IContact c : contacts) {
selectedAccounts.add(c.getContactId());
}
onSelected(selectedAccounts);
}
}
}
| ************************** select |
public static ObjectMetadata parseObjectMetadata(Map<String,String> headers) throws ResponseParseException {
try {
ObjectMetadata objectMetadata=new ObjectMetadata();
for (Iterator<String> it=headers.keySet().iterator(); it.hasNext(); ) {
String key=it.next();
if (key.indexOf(OSSHeaders.OSS_USER_METADATA_PREFIX) >= 0) {
key=key.substring(OSSHeaders.OSS_USER_METADATA_PREFIX.length());
objectMetadata.addUserMetadata(key,headers.get(OSSHeaders.OSS_USER_METADATA_PREFIX + key));
}
else if (key.equals(OSSHeaders.LAST_MODIFIED) || key.equals(OSSHeaders.DATE)) {
try {
objectMetadata.setHeader(key,DateUtil.parseRfc822Date(headers.get(key)));
}
catch ( ParseException pe) {
throw new ResponseParseException(pe.getMessage(),pe);
}
}
else if (key.equals(OSSHeaders.CONTENT_LENGTH)) {
Long value=Long.valueOf(headers.get(key));
objectMetadata.setHeader(key,value);
}
else if (key.equals(OSSHeaders.ETAG)) {
objectMetadata.setHeader(key,trimQuotes(headers.get(key)));
}
else {
objectMetadata.setHeader(key,headers.get(key));
}
}
return objectMetadata;
}
catch ( Exception e) {
throw new ResponseParseException(e.getMessage(),e);
}
}
| Unmarshall object metadata from response headers. |
public void clearRect(int x,int y,int width,int height){
Rectangle2D.Float rect=new Rectangle2D.Float(x,y,width,height);
addDrawingRect(rect);
mPrintMetrics.clear(this);
}
| Clears the specified rectangle by filling it with the background color of the current drawing surface. This operation does not use the current paint mode. <p> Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use <code>setColor</code> followed by <code>fillRect</code> to ensure that an offscreen image is cleared to a specific color. |
protected void checkTransactionalRead(TransactionConcurrency concurrency,TransactionIsolation isolation) throws IgniteCheckedException {
IgniteCache<String,Integer> cache=jcache(0);
cache.clear();
Transaction tx=grid(0).transactions().txStart(concurrency,isolation);
try {
cache.put("key",1);
assertEquals("Invalid value after put",1,cache.get("key").intValue());
tx.commit();
}
finally {
tx.close();
}
assertEquals("Invalid cache size after put",1,cache.size());
try {
tx=grid(0).transactions().txStart(concurrency,isolation);
assertEquals("Invalid value inside transactional read",Integer.valueOf(1),cache.get("key"));
tx.commit();
}
finally {
tx.close();
}
}
| Tests sequential value write and read inside transaction. |
protected String computeRemoteAddress() throws MessagingException, UnknownHostException {
String domain=getRemoteDomain();
String address;
String validatedAddress;
int ipAddressStart=domain.indexOf('[');
int ipAddressEnd=-1;
if (ipAddressStart > -1) {
ipAddressEnd=domain.indexOf(']',ipAddressStart);
}
else {
ipAddressStart=domain.indexOf('(');
if (ipAddressStart > -1) {
ipAddressEnd=domain.indexOf(')',ipAddressStart);
}
}
if (ipAddressEnd > -1) {
address=domain.substring(ipAddressStart + 1,ipAddressEnd);
}
else {
int hostNameEnd=domain.indexOf(' ');
if (hostNameEnd == -1) hostNameEnd=domain.length();
address=domain.substring(0,hostNameEnd);
}
validatedAddress=getDNSServer().getByName(address).getHostAddress();
return validatedAddress;
}
| Answer the IP Address of the remote server for the message being processed. |
private void testUpload(final int size,final boolean useFileStorage) throws TimeoutException {
mWaiter=new Waiter();
if (useFileStorage) {
mSocket.setUploadStorageType(UploadStorageType.FILE_STORAGE);
}
mSocket.startUpload(SPEED_TEST_SERVER_HOST,SPEED_TEST_SERVER_PORT,SPEED_TEST_SERVER_URI_UL,size);
mWaiter.await(WAITING_TIMEOUT_LONG_OPERATION,SECONDS);
testTransferRate();
mSocket.forceStopTask();
}
| Test upload with given packet size. |
public void openKeyStore(File keyStoreFile,String defaultPassword){
try {
if (!keyStoreFile.isFile()) {
JOptionPane.showMessageDialog(frame,MessageFormat.format(res.getString("OpenAction.NotFile.message"),keyStoreFile),res.getString("OpenAction.OpenKeyStore.Title"),JOptionPane.WARNING_MESSAGE);
return;
}
if (isKeyStoreFileOpen(keyStoreFile)) {
JOptionPane.showMessageDialog(frame,MessageFormat.format(res.getString("OpenAction.NoOpenKeyStoreAlreadyOpen.message"),keyStoreFile),res.getString("OpenAction.OpenKeyStore.Title"),JOptionPane.WARNING_MESSAGE);
return;
}
Password password=(defaultPassword != null) ? new Password(defaultPassword.toCharArray()) : null;
KeyStore openedKeyStore=null;
boolean firstTry=true;
while (true) {
if (password == null) {
password=showPasswordDialog(keyStoreFile);
}
if (password == null) {
return;
}
try {
openedKeyStore=KeyStoreUtil.load(keyStoreFile,password);
break;
}
catch ( KeyStoreLoadException klex) {
if (defaultPassword == null || !firstTry) {
int tryAgainChoice=showErrorMessage(keyStoreFile,klex);
if (tryAgainChoice == JOptionPane.NO_OPTION) {
return;
}
}
}
password.nullPassword();
password=null;
firstTry=false;
}
if (openedKeyStore == null) {
JOptionPane.showMessageDialog(frame,MessageFormat.format(res.getString("OpenAction.FileNotRecognisedType.message"),keyStoreFile.getName()),res.getString("OpenAction.OpenKeyStore.Title"),JOptionPane.WARNING_MESSAGE);
return;
}
kseFrame.addKeyStore(openedKeyStore,keyStoreFile,password);
}
catch ( FileNotFoundException ex) {
JOptionPane.showMessageDialog(frame,MessageFormat.format(res.getString("OpenAction.NoReadFile.message"),keyStoreFile),res.getString("OpenAction.OpenKeyStore.Title"),JOptionPane.WARNING_MESSAGE);
}
catch ( Exception ex) {
DError.displayError(frame,ex);
}
}
| Open the supplied KeyStore file from disk. |
public void install(JFormattedTextField ftf){
super.install(ftf);
if (ftf != null) {
Object value=ftf.getValue();
try {
stringToValue(valueToString(value));
}
catch ( ParseException pe) {
setEditValid(false);
}
}
}
| Installs the <code>DefaultFormatter</code> onto a particular <code>JFormattedTextField</code>. This will invoke <code>valueToString</code> to convert the current value from the <code>JFormattedTextField</code> to a String. This will then install the <code>Action</code>s from <code>getActions</code>, the <code>DocumentFilter</code> returned from <code>getDocumentFilter</code> and the <code>NavigationFilter</code> returned from <code>getNavigationFilter</code> onto the <code>JFormattedTextField</code>. <p> Subclasses will typically only need to override this if they wish to install additional listeners on the <code>JFormattedTextField</code>. <p> If there is a <code>ParseException</code> in converting the current value to a String, this will set the text to an empty String, and mark the <code>JFormattedTextField</code> as being in an invalid state. <p> While this is a public method, this is typically only useful for subclassers of <code>JFormattedTextField</code>. <code>JFormattedTextField</code> will invoke this method at the appropriate times when the value changes, or its internal state changes. |
public SIRtree(){
this(10);
}
| Constructs an SIRtree with the default node capacity. |
@NotNull public static <Type extends PsiElement>Type addBlockIntoParent(@NotNull Type statement) throws IncorrectOperationException {
PsiElement parent=statement.getParent();
PsiElement child=statement;
while (!(parent instanceof GrLoopStatement) && !(parent instanceof GrIfStatement) && !(parent instanceof GrVariableDeclarationOwner)&& parent != null) {
parent=parent.getParent();
child=child.getParent();
}
if (parent instanceof GrWhileStatement && child == ((GrWhileStatement)parent).getCondition() || parent instanceof GrIfStatement && child == ((GrIfStatement)parent).getCondition()) {
parent=parent.getParent();
}
assert parent != null;
if (parent instanceof GrVariableDeclarationOwner) {
return statement;
}
GroovyPsiElementFactory factory=GroovyPsiElementFactory.getInstance(statement.getProject());
PsiElement tempStmt=statement;
while (parent != tempStmt.getParent()) {
tempStmt=tempStmt.getParent();
}
GrStatement toAdd=(GrStatement)tempStmt.copy();
GrBlockStatement blockStatement=factory.createBlockStatement();
if (parent instanceof GrLoopStatement) {
((GrLoopStatement)parent).replaceBody(blockStatement);
}
else {
GrIfStatement ifStatement=(GrIfStatement)parent;
if (tempStmt == ifStatement.getThenBranch()) {
ifStatement.replaceThenBranch(blockStatement);
}
else if (tempStmt == ifStatement.getElseBranch()) {
ifStatement.replaceElseBranch(blockStatement);
}
}
GrStatement result=blockStatement.getBlock().addStatementBefore(toAdd,null);
if (result instanceof GrReturnStatement) {
statement=(Type)((GrReturnStatement)result).getReturnValue();
}
else {
statement=(Type)result;
}
return statement;
}
| adds block statement in parent of statement if needed. For Example: while (true) a=foo() will be replaced with while(true) {a=foo()} |
private static void writeMajorStatisticsString(BufferedWriter output,SAZone zone) throws IOException {
output.write(zone.getName());
output.write(delimiter);
output.write(String.valueOf(zone.getMajorActivityCount()));
output.write(delimiter);
for (int i=0; i < 24; i++) {
output.write(String.valueOf(zone.getMajorActivityCountDetail(i)));
output.write(delimiter);
}
for (int i=0; i < 23; i++) {
output.write(String.valueOf(zone.getMajorActivityDurationDetail(i)));
output.write(delimiter);
}
output.write(String.valueOf(zone.getMajorActivityDurationDetail(23)));
}
| Method to create a statistics string for 'major' activities. |
private boolean isAlphaUsedForScale(){
return android.os.Build.VERSION.SDK_INT < 11;
}
| Pre API 11, alpha is used to make the progress circle appear instead of scale. |
@SuppressWarnings("deprecation") private void configBluetoothSensor(){
ListPreference preference=(ListPreference)findPreference(getString(R.string.bluetooth_sensor_key));
String value=PreferencesUtils.getString(this,R.string.bluetooth_sensor_key,PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT);
List<String> optionsList=new ArrayList<String>();
List<String> valuesList=new ArrayList<String>();
BluetoothAdapter bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter != null) {
BluetoothDeviceUtils.populateDeviceLists(bluetoothAdapter,optionsList,valuesList);
}
String[] options=optionsList.toArray(new String[optionsList.size()]);
String[] values=valuesList.toArray(new String[valuesList.size()]);
if (valuesList.size() == 1) {
if (!valuesList.get(0).equals(value)) {
value=valuesList.get(0);
PreferencesUtils.setString(this,R.string.bluetooth_sensor_key,value);
}
}
else {
if (!valuesList.contains(value)) {
value=PreferencesUtils.BLUETOOTH_SENSOR_DEFAULT;
PreferencesUtils.setString(this,R.string.bluetooth_sensor_key,value);
}
}
configureListPreference(preference,options,options,values,value,null);
}
| Configures the bluetooth sensor. |
@Override public void onViewCreated(View view,Bundle savedInstanceState){
super.onViewCreated(view,savedInstanceState);
ensureList();
}
| Attach to list view once the view hierarchy has been created. |
public void writeUint64(long n){
check(8);
buffer[write_pos++]=(byte)((n & 0x00ff00000000000000L) >> 56);
buffer[write_pos++]=(byte)((n & 0x00ff000000000000L) >> 48);
buffer[write_pos++]=(byte)((n & 0x00ff0000000000L) >> 40);
buffer[write_pos++]=(byte)((n & 0x00ff00000000L) >> 32);
buffer[write_pos++]=(byte)((n & 0x00ff000000) >> 24);
buffer[write_pos++]=(byte)((n & 0x00ff0000) >> 16);
buffer[write_pos++]=(byte)((n & 0x00ff00) >> 8);
buffer[write_pos++]=(byte)(n & 0x00ff);
}
| Writes Uint64 value |
public ClientHello(SecureRandom sr,byte[] version,byte[] ses_id,CipherSuite[] cipher_suite){
client_version=version;
long gmt_unix_time=System.currentTimeMillis() / 1000;
sr.nextBytes(random);
random[0]=(byte)(gmt_unix_time & 0xFF000000 >>> 24);
random[1]=(byte)(gmt_unix_time & 0xFF0000 >>> 16);
random[2]=(byte)(gmt_unix_time & 0xFF00 >>> 8);
random[3]=(byte)(gmt_unix_time & 0xFF);
session_id=ses_id;
this.cipher_suites=cipher_suite;
compression_methods=new byte[]{0};
length=38 + session_id.length + (this.cipher_suites.length << 1)+ compression_methods.length;
}
| Creates outbound message |
private void releaseWakeLock(){
if (wakeLock != null && wakeLock.isHeld()) {
wakeLock.release();
wakeLock=null;
}
}
| Releases the wake lock. |
@Override public byte[] executeAttack(){
byte[] paddedDecryptedData=new byte[encryptedData.length - blockSize];
int lastBlockLength=0;
int blockPairNumber=(encryptedData.length / blockSize) - 1;
FindIVMethodProperties.Type type=FindIVMethodProperties.Type.UNDEFINED;
for (int i=0; i < blockPairNumber; i++) {
boolean processingLastBlock=(i == (blockPairNumber - 1));
int start=i * blockSize;
byte[] iv=Arrays.copyOfRange(encryptedData,start,start + blockSize);
byte[] c1=Arrays.copyOfRange(encryptedData,start + blockSize,start + 2 * blockSize);
FindIVMethodSimple fim=new FindIVMethodSimple(m_Oracle,iv,c1,processingLastBlock,type);
byte[] decrypted=fim.executeAttack();
System.arraycopy(decrypted,0,paddedDecryptedData,start,decrypted.length);
lastBlockLength=decrypted.length;
if (type == FindIVMethodProperties.Type.UNDEFINED) {
type=fim.getProperties().getType();
}
}
final int resultLength=paddedDecryptedData.length - blockSize + lastBlockLength;
byte[] result=Arrays.copyOf(paddedDecryptedData,resultLength);
return result;
}
| execute attack on the given ciphertext using the existing m_Oracle |
public void checkForNullValue(String value){
if (value == null) {
throw new NullPointerException();
}
}
| null keys would corrupt the shared pref file and make them unreadable this is a preventive measure the pref key |
private boolean isIPConstrained(byte ip[],byte[] constraint){
int ipLength=ip.length;
if (ipLength != (constraint.length / 2)) {
return false;
}
byte[] subnetMask=new byte[ipLength];
System.arraycopy(constraint,ipLength,subnetMask,0,ipLength);
byte[] permittedSubnetAddress=new byte[ipLength];
byte[] ipSubnetAddress=new byte[ipLength];
for (int i=0; i < ipLength; i++) {
permittedSubnetAddress[i]=(byte)(constraint[i] & subnetMask[i]);
ipSubnetAddress[i]=(byte)(ip[i] & subnetMask[i]);
}
return Arrays.areEqual(permittedSubnetAddress,ipSubnetAddress);
}
| Checks if the IP address <code>ip</code> is constrained by <code>constraint</code>. |
public void initLayout(){
closePosition=0;
layoutSize=0;
isArranged=false;
isCalculatedSize=false;
savedState=null;
if (isVertical()) {
measure(MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(getHeight(),MeasureSpec.UNSPECIFIED));
}
else {
measure(MeasureSpec.makeMeasureSpec(getWidth(),MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(getHeight(),MeasureSpec.EXACTLY));
}
}
| Initializes this layout. |
public static final OCSPResp fromBasicToResp(final BasicOCSPResp basicOCSPResp){
try {
final byte[] encoded=basicOCSPResp.getEncoded();
final OCSPResp ocspResp=fromBasicToResp(encoded);
return ocspResp;
}
catch ( IOException e) {
throw new DSSException(e);
}
}
| Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL). |
public static String random(int count,boolean letters,boolean numbers){
return random(count,0,0,letters,numbers);
}
| <p>Creates a random string whose length is the number of characters specified.</p> <p>Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments.</p> |
public boolean on(ASN1ObjectIdentifier stem){
String id=getId(), stemId=stem.getId();
return id.length() > stemId.length() && id.charAt(stemId.length()) == '.' && id.startsWith(stemId);
}
| Return true if this oid is an extension of the passed in branch, stem. |
public Code39Reader(boolean usingCheckDigit){
this.usingCheckDigit=usingCheckDigit;
this.extendedMode=false;
}
| Creates a reader that can be configured to check the last character as a check digit. It will not decoded "extended Code 39" sequences. |
protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound){
}
| (abstract) Protected helper method to write subclass entity data to NBT. |
public boolean userCanViewUser(int connectedUserId,String entidad) throws Exception {
boolean can=false;
try {
can=hasUserAuth(connectedUserId,USER_ACTION_ID_VIEW,Defs.NULL_ID,Defs.NULL_ID,entidad);
}
catch ( Exception e) {
_logger.error(e);
throw e;
}
return can;
}
| Obtiene si el usuario conectado puede consultar usuarios |
public synchronized long waitMinTime(long time,long seqno) throws InterruptedException {
while (head != null && time > head.time) {
wait(1000);
}
if (head == null) return 0;
else return head.time;
}
| Wait until the minimum time in array is greater than or equal to the request time. If there is nothing in the array we return immediately. |
public void go(OutputStream out) throws IOException {
buildPage().write(out);
}
| Writes the hCards to an output stream. |
public void run(){
for ( LocalGossipMember member : members.keySet()) {
if (member != me) {
member.startTimeoutTimer();
}
}
try {
passiveGossipThread=passiveGossipThreadClass.getConstructor(GossipManager.class).newInstance(this);
gossipThreadExecutor.execute(passiveGossipThread);
activeGossipThread=activeGossipThreadClass.getConstructor(GossipManager.class).newInstance(this);
gossipThreadExecutor.execute(activeGossipThread);
}
catch ( InstantiationException|IllegalAccessException|IllegalArgumentException|InvocationTargetException|NoSuchMethodException|SecurityException e1) {
throw new RuntimeException(e1);
}
GossipService.LOGGER.debug("The GossipService is started.");
while (gossipServiceRunning.get()) {
try {
TimeUnit.MILLISECONDS.sleep(1);
}
catch ( InterruptedException e) {
GossipService.LOGGER.warn("The GossipClient was interrupted.");
}
}
}
| Starts the client. Specifically, start the various cycles for this protocol. Start the gossip thread and start the receiver thread. |
private Node addConditionWaiter(){
Node t=lastWaiter;
if (t != null && t.waitStatus != Node.CONDITION) {
unlinkCancelledWaiters();
t=lastWaiter;
}
Node node=new Node(Thread.currentThread(),Node.CONDITION);
if (t == null) firstWaiter=node;
else t.nextWaiter=node;
lastWaiter=node;
return node;
}
| Adds a new waiter to wait queue. |
public final void addToTiersByVarNames(List<String> myNodes){
if (!this.myNodes.containsAll(myNodes)) {
for ( String variable : myNodes) {
if (!checkVarName(variable)) {
throw new IllegalArgumentException("Bad variable name: " + variable);
}
addVariable(variable);
}
}
for ( Object variable : myNodes) {
String MyNode=(String)variable;
int index=MyNode.lastIndexOf(":t");
if (index != -1) {
String substring=MyNode.substring(index + 2);
addToTier(new Integer(substring),MyNode);
}
}
}
| Puts a variable into tier i if its name is xxx:ti for some xxx and some i. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:40.373 -0500",hash_original_method="276C18C659FAD0D183192D3E613DC123",hash_generated_method="BE93730CA41BE33A2A3EB37CEE8379CD") public ViolationInfo(Parcel in,boolean unsetGatheringBit){
crashInfo=new ApplicationErrorReport.CrashInfo(in);
int rawPolicy=in.readInt();
if (unsetGatheringBit) {
policy=rawPolicy & ~PENALTY_GATHER;
}
else {
policy=rawPolicy;
}
durationMillis=in.readInt();
violationNumThisLoop=in.readInt();
numAnimationsRunning=in.readInt();
violationUptimeMillis=in.readLong();
numInstances=in.readLong();
broadcastIntentAction=in.readString();
tags=in.readStringArray();
}
| Create an instance of ViolationInfo initialized from a Parcel. |
public boolean exportSelected(){
return exportSelected;
}
| Has the user chosen to export? |
public ClassPath appendClassPath(String pathname) throws NotFoundException {
return source.appendClassPath(pathname);
}
| Appends a directory or a jar (or zip) file to the end of the search path. |
private static void readChar(ByteToChar converter,CharReader is,int ch,boolean isTop) throws IOException {
if (ch == '+') {
if (isTop) converter.addByte(' ');
else converter.addChar(' ');
}
else if (ch == '%') {
int ch1=is.next();
if (ch1 == 'u') {
ch1=is.next();
int ch2=is.next();
int ch3=is.next();
int ch4=is.next();
converter.addChar((char)((toHex(ch1) << 12) + (toHex(ch2) << 8) + (toHex(ch3) << 4)+ (toHex(ch4))));
}
else {
int ch2=is.next();
converter.addByte(((toHex(ch1) << 4) + toHex(ch2)));
}
}
else if (isTop) {
converter.addByte((byte)ch);
}
else {
converter.addChar((char)ch);
}
}
| Scans the next character from the input stream, adding it to the converter. |
public MainMenu(TDA listener){
this.listener=listener;
createMenuBar();
}
| Creates a new instance of the MainMenu |
private boolean isHardwareKeyboardPresent(){
Configuration config=getResources().getConfiguration();
boolean returnValue=false;
if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
returnValue=true;
}
return returnValue;
}
| Returns true if a hardware keyboard is detected, otherwise false. |
public PowerVm(final int id,final int userId,final double mips,final int pesNumber,final int ram,final long bw,final long size,final int priority,final String vmm,final CloudletScheduler cloudletScheduler,final double schedulingInterval){
super(id,userId,mips,pesNumber,ram,bw,size,vmm,cloudletScheduler);
setSchedulingInterval(schedulingInterval);
}
| Instantiates a new PowerVm. |
public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException, JsonGenerationException {
jg.writeRaw(':');
}
| Method called after an object field has been output, but before the value is output. <p> Default handling will just output a single colon to separate the two, without additional spaces. |
public static <T>boolean allSatisfy(Iterable<T> iterable,Predicate<? super T> predicate){
if (iterable instanceof RichIterable) {
return ((RichIterable<T>)iterable).allSatisfy(predicate);
}
if (iterable instanceof ArrayList) {
return ArrayListIterate.allSatisfy((ArrayList<T>)iterable,predicate);
}
if (iterable instanceof RandomAccess) {
return RandomAccessListIterate.allSatisfy((List<T>)iterable,predicate);
}
if (iterable != null) {
return IterableIterate.allSatisfy(iterable,predicate);
}
throw new IllegalArgumentException("Cannot perform an allSatisfy on null");
}
| Returns true if the predicate evaluates to true for every element of the iterable, or returns false. Returns true if the iterable is empty. |
public MatchQueryBuilder cutoffFrequency(float cutoff){
this.cutoff_Frequency=cutoff;
return this;
}
| Set a cutoff value in [0..1] (or absolute number >=1) representing the maximum threshold of a terms document frequency to be considered a low frequency term. |
private void injectDiscoveryProfile(AccessProfile accessProfile,StorageSystem system) throws DatabaseException, DeviceControllerException {
StorageProvider provider=getActiveProviderForStorageSystem(system,accessProfile);
populateSMISAccessProfile(accessProfile,provider);
accessProfile.setSystemId(system.getId());
accessProfile.setSystemClazz(system.getClass());
accessProfile.setserialID(system.getSerialNumber());
accessProfile.setSystemType(system.getSystemType());
String namespace=Constants.EMC_NAMESPACE;
if (Type.ibmxiv.name().equals(system.getSystemType())) {
namespace=Constants.IBM_NAMESPACE;
}
accessProfile.setInteropNamespace(namespace);
}
| inject Details needed for Discovery |
private void updateProductInfo(int C_AcctSchema_ID){
log.fine("C_Invoice_ID=" + get_ID());
StringBuffer sql=new StringBuffer("UPDATE M_Product_Costing pc " + "SET (PriceLastInv, TotalInvAmt,TotalInvQty) = " + "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),"+ " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"+ " AND il.c_invoiceline_id = (SELECT MIN(C_InvoiceLine_ID) FROM C_InvoiceLine il2"+ " WHERE il2.M_PRODUCT_ID=il.M_PRODUCT_ID AND C_Invoice_ID=").append(get_ID()).append(")" + " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID" + " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=").append(get_ID()).append(") ").append("WHERE EXISTS (SELECT * " + "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a " + "WHERE i.C_Invoice_ID=il.C_Invoice_ID"+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=").append(get_ID()).append(")");
int no=DB.executeUpdate(sql.toString(),getTrxName());
log.fine("M_Product_Costing - Updated=" + no);
}
| Update Product Info (old). - Costing (PriceLastInv) - PO (PriceLastInv) |
public boolean isDashedLineEnabled(){
return mDashPathEffect == null ? false : true;
}
| Returns true if the dashed-line effect is enabled, false if not. Default: disabled |
public double[] distributionForInstance(Instance instance) throws Exception {
double[] sums=new double[instance.numClasses()], newProbs;
double numPreds=0;
for (int i=0; i < m_NumIterations; i++) {
if (instance.classAttribute().isNumeric() == true) {
double pred=m_Classifiers[i].classifyInstance(instance);
if (!Utils.isMissingValue(pred)) {
sums[0]+=pred;
numPreds++;
}
}
else {
newProbs=m_Classifiers[i].distributionForInstance(instance);
for (int j=0; j < newProbs.length; j++) sums[j]+=newProbs[j];
}
}
if (instance.classAttribute().isNumeric() == true) {
if (numPreds == 0) {
sums[0]=Utils.missingValue();
}
else {
sums[0]/=numPreds;
}
return sums;
}
else if (Utils.eq(Utils.sum(sums),0)) {
return sums;
}
else {
Utils.normalize(sums);
return sums;
}
}
| Calculates the class membership probabilities for the given test instance. |
protected void installDefaultPainter(Style s){
if (s.getBgPainter() == null) {
s.setBgPainter(new BGPainter(s));
}
}
| Allows subclasses to create their own custom style types and install the background painter into them |
public boolean isAfterLast(){
return this.index >= this.rows.size() && this.rows.size() != 0;
}
| Returns true if we got the last element. |
@Override public void shutdown(){
super.shutdown();
disconnect();
}
| Stop sensing. |
protected int select(double[] array,int[] indices,int left,int right,final int indexStart,int k){
if (left == right) {
return left;
}
else {
int middle=partition(array,indices,left,right,indexStart);
if ((middle - left + 1) >= k) {
return select(array,indices,left,middle,indexStart,k);
}
else {
return select(array,indices,middle + 1,right,indexStart,k - (middle - left + 1));
}
}
}
| Implements computation of the kth-smallest element according to Manber's "Introduction to Algorithms". |
public void add(Permission permission){
if (isReadOnly()) throw new SecurityException("attempt to add a Permission " + "to a readonly PermissionCollection");
if (!(permission instanceof CryptoPermission)) return;
permissions.addElement(permission);
}
| Adds a permission to the CryptoPermissionCollection. |
public void reset(){
if (rules != null) {
rules.clear();
}
includesCount=excludesCount=0;
blacklist=true;
}
| Resets all the rules in this rule engine. |
public final int valueCount(){
return values.size();
}
| Returns the number of onNext values received. |
public IdentityHashMap(int maxSize){
if (maxSize >= 0) {
this.size=0;
threshold=getThreshold(maxSize);
elementData=newElementArray(computeElementArraySize());
}
else {
throw new IllegalArgumentException();
}
}
| Creates an IdentityHashMap with the specified maximum size parameter. |
public Collection<SynchronizingStorageEngine> values(){
return localStores.values();
}
| Get a collection containing all the currently-registered stores |
private boolean isPending(BlockMirror mirror){
return !isInactive(mirror) && isNullOrEmpty(mirror.getSynchronizedInstance());
}
| Check if a mirror exists in ViPR as an active model and is pending creation on the storage array. |
public void close(){
if (dialog != null) {
dialog.setVisible(false);
dialog.dispose();
dialog=null;
pane=null;
myBar=null;
}
}
| Indicate that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early. |
public static void attach(@NonNull Activity activity){
init(activity.getApplication());
if (sInstance.mStates == null) {
sInstance.mStates=new StateLinkedList(3);
}
}
| Attach an activity to Toro. Toro register activity's life cycle to properly handle Screen visibility: free necessary resource if User doesn't need it anymore |
public static <T,X extends Throwable>Tuple3<CompletableFuture<Subscription>,Runnable,CompletableFuture<Boolean>> forEachEvent(final LazyFutureStream<T> stream,final Consumer<? super T> consumerElement,final Consumer<? super Throwable> consumerError,final Runnable onComplete){
final CompletableFuture<Subscription> subscription=new CompletableFuture<>();
final CompletableFuture<Boolean> streamCompleted=new CompletableFuture<>();
return tuple(subscription,null,streamCompleted);
}
| Perform a forEach operation over the Stream capturing any elements and errors in the supplied consumers when the entire Stream has been processed an onComplete event will be recieved. <pre> |
@Override public void write(byte[] buffer,int offset,int length) throws IOException {
while ((mByteToSkip > 0 || mByteToCopy > 0 || mState != STATE_JPEG_DATA) && length > 0) {
if (mByteToSkip > 0) {
int byteToProcess=length > mByteToSkip ? mByteToSkip : length;
length-=byteToProcess;
mByteToSkip-=byteToProcess;
offset+=byteToProcess;
}
if (mByteToCopy > 0) {
int byteToProcess=length > mByteToCopy ? mByteToCopy : length;
out.write(buffer,offset,byteToProcess);
mSize+=byteToProcess;
length-=byteToProcess;
mByteToCopy-=byteToProcess;
offset+=byteToProcess;
}
if (length == 0) {
return;
}
switch (mState) {
case STATE_SOI:
int byteRead=requestByteToBuffer(2,buffer,offset,length);
offset+=byteRead;
length-=byteRead;
if (mBuffer.position() < 2) {
return;
}
mBuffer.rewind();
if (mBuffer.getShort() != JpegHeader.SOI) {
throw new IOException("Not a valid jpeg image, cannot write exif");
}
out.write(mBuffer.array(),0,2);
mSize+=2;
mState=STATE_FRAME_HEADER;
mBuffer.rewind();
writeExifData();
break;
case STATE_FRAME_HEADER:
byteRead=requestByteToBuffer(4,buffer,offset,length);
offset+=byteRead;
length-=byteRead;
if (mBuffer.position() == 2) {
short tag=mBuffer.getShort();
if (tag == JpegHeader.EOI) {
out.write(mBuffer.array(),0,2);
mSize+=2;
mBuffer.rewind();
}
}
if (mBuffer.position() < 4) {
return;
}
mBuffer.rewind();
short marker=mBuffer.getShort();
if (marker == JpegHeader.APP1) {
mByteToSkip=(mBuffer.getShort() & 0x0000ffff) - 2;
mState=STATE_JPEG_DATA;
}
else if (!JpegHeader.isSofMarker(marker)) {
out.write(mBuffer.array(),0,4);
mSize+=4;
mByteToCopy=(mBuffer.getShort() & 0x0000ffff) - 2;
}
else {
out.write(mBuffer.array(),0,4);
mSize+=4;
mState=STATE_JPEG_DATA;
}
mBuffer.rewind();
}
}
if (length > 0) {
out.write(buffer,offset,length);
mSize+=length;
}
}
| Writes the image out. The input data should be a valid JPEG format. After writing, it's Exif header will be replaced by the given header. |
public TileEntityElectricMachine(String soundPath,String name,double perTick,int ticksRequired,double maxEnergy){
super(soundPath,name,MekanismUtils.getResource(ResourceType.GUI,"GuiBasicMachine.png"),perTick,ticksRequired,maxEnergy);
configComponent=new TileComponentConfig(this,TransmissionType.ITEM,TransmissionType.ENERGY);
configComponent.addOutput(TransmissionType.ITEM,new SideData("None",EnumColor.GREY,InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM,new SideData("Input",EnumColor.DARK_RED,new int[]{0}));
configComponent.addOutput(TransmissionType.ITEM,new SideData("Energy",EnumColor.DARK_GREEN,new int[]{1}));
configComponent.addOutput(TransmissionType.ITEM,new SideData("Output",EnumColor.DARK_BLUE,new int[]{2}));
configComponent.setConfig(TransmissionType.ITEM,new byte[]{2,1,0,0,0,3});
configComponent.setInputEnergyConfig();
inventory=new ItemStack[4];
upgradeComponent=new TileComponentUpgrade(this,3);
ejectorComponent=new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM,configComponent.getOutputs(TransmissionType.ITEM).get(3));
}
| A simple electrical machine. This has 3 slots - the input slot (0), the energy slot (1), output slot (2), and the upgrade slot (3). It will not run if it does not have enough energy. |
public boolean isImageDefined(){
return imageDefined;
}
| Checks whether an image was defined which is used when customers subscribe to the service. |
public static byte[] combine(final List<byte[]> dataChunks){
int totalSize=0;
for ( final byte[] dataPart : dataChunks) {
totalSize+=dataPart.length;
}
final byte[] data=new byte[totalSize];
int index=0;
for ( final byte[] dataPart : dataChunks) {
System.arraycopy(dataPart,0,data,index,dataPart.length);
index+=dataPart.length;
}
return data;
}
| Combines a list of byte arrays into one big byte array. |
public boolean isStateActive(State state){
switch (state) {
case constOnlyNamedScope_main_region_A:
return stateVector[0] == State.constOnlyNamedScope_main_region_A;
case constOnlyNamedScope_main_region_B:
return stateVector[0] == State.constOnlyNamedScope_main_region_B;
case constOnlyNamedScope_main_region_C:
return stateVector[0] == State.constOnlyNamedScope_main_region_C;
default :
return false;
}
}
| Returns true if the given state is currently active otherwise false. |
private static void checkArgs(final long[] min,final long[] max){
if (min == null || max == null || min.length == 0 || max.length == 0) {
throw new IllegalArgumentException("min/max range values cannot be null or empty");
}
if (min.length != max.length) {
throw new IllegalArgumentException("min/max ranges must agree");
}
if (min.length > 4) {
throw new IllegalArgumentException("LongRangeField does not support greater than 4 dimensions");
}
}
| validate the arguments |
public final void lazySet(long newValue){
unsafe.putOrderedLong(this,valueOffset,newValue);
}
| Eventually sets to the given value. |
public Word loadWord(){
return new Word(loadArchitecturalWord());
}
| Loads a word value from the memory location pointed to by the current instance. |
public boolean isDefault(){
Object oo=get_Value(COLUMNNAME_IsDefault);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Default. |
private void executeCommand(HttpServletRequest request,String p_cmd,MobileSessionCtx wsc,WWindowStatus ws){
String p_tab=MobileUtil.getParameter(request,P_Tab);
String p_row=MobileUtil.getParameter(request,P_MR_RowNo);
log.config(p_cmd + " - Tab=" + p_tab+ " - Row="+ p_row);
if (p_row != null && p_row.length() > 0) {
try {
int newRowNo=Integer.parseInt(p_row);
ws.curTab.navigate(newRowNo);
ws.curTab.setSingleRow(true);
}
catch ( Exception e) {
log.log(Level.SEVERE,"Parse RowNo=" + p_row,e);
}
}
else if (p_tab != null && p_tab.length() > 0) {
int newTabNo=0;
try {
newTabNo=Integer.parseInt(p_tab);
}
catch ( Exception e) {
log.log(Level.SEVERE,"Parse TabNo=" + p_tab,e);
}
if (newTabNo > ws.curTab.getTabNo()) {
ws.mWindow.initTab(newTabNo);
ws.curTab=ws.mWindow.getTab(newTabNo);
ws.curTab.query(false);
ws.curTab.navigate(0);
if (ws.curTab.getRowCount() < 1) {
if (!ws.curTab.dataNew(false)) ws.curTab.dataIgnore();
}
}
else if (newTabNo < ws.curTab.getTabNo()) {
ws.curTab=ws.mWindow.getTab(newTabNo);
ws.curTab.dataRefresh();
}
}
else if (p_cmd.equals("Multi")) {
boolean single=ws.curTab.isSingleRow();
ws.curTab.setSingleRow(!single);
if (single) ws.curTab.navigate(0);
}
else if (p_cmd.equals("Refresh")) {
ws.curTab.dataRefreshAll();
}
else if (p_cmd.equals("Attachment")) {
}
else if (p_cmd.equals("New")) {
if (!ws.curTab.dataNew(false)) ws.curTab.dataIgnore();
}
else if (p_cmd.equals("Delete")) {
ws.curTab.dataDelete();
}
else if (p_cmd.equals("Save")) {
executeSave(request,wsc,ws);
}
else if (p_cmd.equals("Find")) {
String strSearch=MobileUtil.getParameter(request,"txtSearch");
if (strSearch != null) {
MQuery query=new MQuery();
if (strSearch.length() != 0) query.addRestriction(m_searchField,MQuery.LIKE,strSearch);
ws.curTab.setQuery(query);
ws.curTab.query(false);
ws.curTab.navigate(0);
}
}
else if (p_cmd.equals("FindAdv")) {
}
}
| Execute Command. |
@Override @SuppressWarnings("unchecked") public Object invoke(Object object,Method nativeMethod,Object[] objects) throws Throwable {
log.debug("Invoked response method. NativeMethod={}, method args length={}",nativeMethod.getName(),objects.length);
E event=(E)createGenericEvent(objects[0]);
R response=(R)createGenericResponse(objects[1]);
try {
log.debug("Created event {}",genericEventClass.getSimpleName());
Method method=genericHandler.getClass().getMethod(nativeMethod.getName(),new Class[]{genericEventClass,genericResponseClass});
log.debug("Invoking {}.{}({},{}) ",new Object[]{genericHandler.getClass().getSimpleName(),method.getName(),method.getParameterTypes()[0].getSimpleName(),method.getParameterTypes()[1].getSimpleName()});
return method.invoke(genericHandler,event,response);
}
catch ( NoSuchMethodException e) {
log.warn("Got a NoSuchMethodException. Method = '" + nativeMethod.getName() + "'");
e.printStackTrace();
if (nativeMethod.getName().equals("equals") && objects.length == 1) {
return object == objects[0];
}
return null;
}
}
| Handles the invocation |
private Object findFlushingPropertyContrust(){
if (flashingProperty.indexOf("Color") > -1) {
int val=Integer.decode("0x" + originalFlashingPropertyValue);
if (val > 0xf0f0f0) {
return "000000";
}
else {
return "ffffff";
}
}
if (flashingProperty.indexOf("derive") > -1) {
return "NoPropertyUIIDExists";
}
if (flashingProperty.indexOf("font") > -1) {
if ((((com.codename1.ui.Font)originalFlashingPropertyValue).getStyle() & com.codename1.ui.Font.STYLE_BOLD) != 0) {
return com.codename1.ui.Font.createSystemFont(com.codename1.ui.Font.FACE_SYSTEM,com.codename1.ui.Font.STYLE_PLAIN,com.codename1.ui.Font.SIZE_LARGE);
}
return com.codename1.ui.Font.createSystemFont(com.codename1.ui.Font.FACE_SYSTEM,com.codename1.ui.Font.STYLE_BOLD,com.codename1.ui.Font.SIZE_LARGE);
}
if (flashingProperty.indexOf("bgImage") > -1) {
com.codename1.ui.Image i=(com.codename1.ui.Image)originalFlashingPropertyValue;
return i.modifyAlpha((byte)128);
}
if (flashingProperty.indexOf("transparency") > -1) {
int v=Integer.parseInt((String)originalFlashingPropertyValue);
if (v < 128) {
return "255";
}
else {
return "100";
}
}
if (flashingProperty.indexOf("padding") > -1 || flashingProperty.indexOf("margin") > -1) {
return "10,10,10,10";
}
if (flashingProperty.indexOf("border") > -1) {
if (originalFlashingPropertyValue != null) {
Border pressed=((Border)originalFlashingPropertyValue).createPressedVersion();
if (pressed != null) {
return pressed;
}
}
return Border.createBevelRaised();
}
if (flashingProperty.indexOf("bgType") > -1) {
return originalFlashingPropertyValue;
}
if (flashingProperty.indexOf("bgGradient") > -1) {
Object[] gradient=new Object[4];
System.arraycopy(originalFlashingPropertyValue,0,gradient,0,4);
gradient[0]=((Object[])originalFlashingPropertyValue)[1];
gradient[1]=((Object[])originalFlashingPropertyValue)[0];
return gradient;
}
if (flashingProperty.indexOf("align") > -1 || flashingProperty.indexOf("textDecoration") > -1) {
return originalFlashingPropertyValue;
}
throw new IllegalArgumentException("Unsupported property type: " + flashingProperty);
}
| Returns a "contrasting" value for the property to flash, e.g. for a font, return a differnet font or for a color return a ligher/darker color... |
private boolean fillBuffer(){
assertOpen();
if (ft != null) {
throw new AssertionError();
}
try {
while (src.hasNext() && buffer.remainingCapacity() > 0) {
final Justification jst=(Justification)src.next().getObject();
try {
buffer.put(jst);
numBuffered++;
}
catch ( InterruptedException ex) {
throw new RuntimeException(ex);
}
}
return !buffer.isEmpty();
}
finally {
if (log.isDebugEnabled()) log.debug("(Re-)filled buffer: size=" + buffer.size() + ", remainingCapacity="+ buffer.remainingCapacity()+ ", done="+ !src.hasNext());
}
}
| (Re-)fills the buffer up to its capacity or the exhaustion of the source iterator. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:37:58.877 -0500",hash_original_method="BCC81355363782E84A460D40E9FAB2BD",hash_generated_method="BCC81355363782E84A460D40E9FAB2BD") boolean _requestedDo(int option){
return ((_options[option] & _REQUESTED_DO_MASK) != 0);
}
| Looks for the state of the option. <p> |
public ConnectionConfig(jmri.jmrix.SerialPortAdapter p){
super(p);
}
| Ctor for an object being created during load process; Swing init is deferred. |
default String renderType(Generator gen,M model){
return gen.on(model.getType()).map(null).orElse(EMPTY);
}
| Render the type of the model appended by an extra space. |
public boolean invalidateIt(){
log.info(toString());
setDocAction(DOCACTION_Prepare);
return true;
}
| Invalidate Document |
public void testContinuousMode() throws Throwable {
processTest(CONTINUOUS);
}
| Test GridDeploymentMode.CONTINUOUS mode. |
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError {
PoolingByteArrayOutputStream bytes=new PoolingByteArrayOutputStream(mPool,(int)entity.getContentLength());
byte[] buffer=null;
try {
InputStream in=entity.getContent();
if (in == null) {
throw new ServerError();
}
buffer=mPool.getBuf(1024);
int count;
while ((count=in.read(buffer)) != -1) {
bytes.write(buffer,0,count);
}
return bytes.toByteArray();
}
finally {
try {
entity.consumeContent();
}
catch ( IOException e) {
VolleyLog.v("Error occured when calling consumingContent");
}
mPool.returnBuf(buffer);
bytes.close();
}
}
| Reads the contents of HttpEntity into a byte[]. |
public void repaint(){
}
| Overriden to do nothing and remove a performance issue where renderer changes perform needless repaint calls |
public CachingMetadataReaderFactory(ResourceLoader resourceLoader){
super(resourceLoader);
}
| Create a new CachingMetadataReaderFactory for the given resource loader. |
private void inflateContentView(){
contentContainer=(ViewGroup)rootView.findViewById(R.id.content_container);
contentContainer.removeAllViews();
if (customView != null) {
contentContainer.setVisibility(View.VISIBLE);
contentContainer.addView(customView);
}
else if (customViewId != -1) {
contentContainer.setVisibility(View.VISIBLE);
LayoutInflater layoutInflater=LayoutInflater.from(getContext());
View view=layoutInflater.inflate(customViewId,contentContainer,false);
contentContainer.addView(view);
}
else {
LayoutInflater layoutInflater=LayoutInflater.from(getContext());
View view=layoutInflater.inflate(R.layout.bottom_sheet_grid_view,contentContainer,false);
contentContainer.addView(view);
}
showGridView();
}
| Inflates the layout, which is used to show the bottom sheet's content. The layout may either be the default one or a custom view, if one has been set before. |
public void addConf(String s){
conf.add(s);
}
| Add realm-specific krb5.conf setting |
public void testCreateConfigurationWhenInvalidHint(){
try {
this.factory.createConfiguration("testableContainerId",ContainerType.INSTALLED,new ConfigurationType("invalidhint"));
}
catch ( ContainerException expected) {
assertEquals("Cannot create configuration. There's no registered configuration for " + "the parameters (container [id = [testableContainerId], type = " + "[installed]], configuration type [invalidhint]). Actually there are no "+ "valid types registered for this configuration. Maybe you've made a mistake "+ "spelling it?",expected.getMessage());
}
}
| Test configuration creation with invalid hint. |
private void insertCOMMarkerSegment(COMMarkerSegment newGuy){
int lastCOM=findMarkerSegmentPosition(COMMarkerSegment.class,false);
boolean hasJFIF=(findMarkerSegment(JFIFMarkerSegment.class,true) != null);
int firstAdobe=findMarkerSegmentPosition(AdobeMarkerSegment.class,true);
if (lastCOM != -1) {
markerSequence.add(lastCOM + 1,newGuy);
}
else if (hasJFIF) {
markerSequence.add(1,newGuy);
}
else if (firstAdobe != -1) {
markerSequence.add(firstAdobe + 1,newGuy);
}
else {
markerSequence.add(0,newGuy);
}
}
| Insert a new COM marker segment into an appropriate place in the marker sequence, as follows: If there already exist COM marker segments, the new one is inserted after the last one. If there are no COM segments, the new COM segment is inserted after the JFIF segment, if there is one. If there is no JFIF segment, the new COM segment is inserted after the Adobe marker segment, if there is one. If there is no Adobe segment, the new COM segment is inserted at the beginning of the sequence. |
private static void s_uackp(SparseBlock a,double[] c,int m,int n,KahanObject kbuff,KahanPlus kplus,int rl,int ru){
if (a.isContiguous()) {
sumAgg(a.values(rl),c,a.indexes(rl),a.pos(rl),(int)a.size(rl,ru),n,kbuff,kplus);
}
else {
for (int i=rl; i < ru; i++) {
if (!a.isEmpty(i)) sumAgg(a.values(i),c,a.indexes(i),a.pos(i),a.size(i),n,kbuff,kplus);
}
}
}
| COLSUM, opcode: uack+, sparse input. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:35:19.739 -0500",hash_original_method="B3CD0EA91E55821485199A61F4C775D4",hash_generated_method="B6ED1071D2558B7B04C360A56B033244") public boolean shouldIncludeInGlobalSearch(){
return mIncludeInGlobalSearch;
}
| Checks whether the searchable should be included in global search. |
public void hincrByFloat(String key,String field,double doubleValue){
connection.hincrbyfloat(key,field,doubleValue);
if (keyExpiryTime != -1) {
connection.expire(key,keyExpiryTime);
}
}
| Calls hincrbyfloat on the redis store. |
public SnackbarBuilder icon(Drawable icon){
this.icon=icon;
return this;
}
| Set an icon to display on the Snackbar next to the message. |
@SuppressWarnings("unchecked") public static EntityView<IEntity> create(final IEntity entity){
try {
if (entity.isUser()) {
Entity2DView<IEntity> user2DView=new User2DView();
user2DView.initialize(entity);
return user2DView;
}
final String type=entity.getType();
String eclass=entity.getEntityClass();
String subClass=entity.getEntitySubclass();
final Class<? extends EntityView> entityClass=getViewClass(type,eclass,subClass);
if (entityClass == null) {
LOGGER.debug("No view for this entity. type: " + type + " class: "+ eclass+ " subclass: "+ subClass);
return null;
}
if (entityClass == Blood2DView.class) {
boolean showBlood=Boolean.parseBoolean(WtWindowManager.getInstance().getProperty("gamescreen.blood","true"));
if (!showBlood) {
return null;
}
}
final EntityView<IEntity> en=entityClass.newInstance();
en.initialize(entity);
return en;
}
catch ( final Exception e) {
LOGGER.error("Error creating entity for object: " + entity,e);
return null;
}
}
| Create an entity view from an entity. |
protected static Map<String,String> convertHeaders(Header[] headers){
Map<String,String> result=new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
for (int i=0; i < headers.length; i++) {
result.put(headers[i].getName(),headers[i].getValue());
}
return result;
}
| Converts Headers[] to Map<String, String>. |
public void paintToolBarDragWindowBackground(SynthContext context,Graphics g,int x,int y,int w,int h){
paintBackground(context,g,x,y,w,h,null);
}
| Paints the background of the window containing the tool bar when it has been detached from its primary frame. |
public static Color shadow(Color c,int amount){
return new Color(Math.max(0,c.getRed() - amount),Math.max(0,c.getGreen() - amount),Math.max(0,c.getBlue() - amount),c.getAlpha());
}
| Blackens the specified color by casting a black shadow of the specified amount on the color. |
public void checkOwnsNoSchemas(){
for ( Schema s : database.getAllSchemas()) {
if (this == s.getOwner()) {
throw DbException.get(ErrorCode.CANNOT_DROP_2,getName(),s.getName());
}
}
}
| Check that this user does not own any schema. An exception is thrown if he owns one or more schemas. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.