code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public CharSequence loadDescription(PackageManager pm){
if (descriptionRes != 0) {
CharSequence label=pm.getText(packageName,descriptionRes,this);
if (label != null) {
return label;
}
}
return null;
}
|
Retrieve the textual description of the application. This will call back on the given PackageManager to load the description from the application.
|
public int difference(String s1,String s2) throws EncoderException {
return difference(this,s1,s2);
}
|
Encodes the Strings and returns the number of characters in the two encoded Strings that are the same. This return value ranges from 0 through 4: 0 indicates little or no similarity, and 4 indicates strong similarity or identical values.
|
protected boolean hasAttemptRemaining(){
return mCurrentRetryCount <= mMaxNumRetries;
}
|
Returns true if this policy has attempts remaining, false otherwise.
|
public static String prepareInsertTemplateWithoutColumn(String tableName,int columnNum){
return "INSERT INTO " + tableName + " VALUES "+ generatePlaceholder(columnNum);
}
|
prepare SQL insert template with placeholders, 'INSERT INTO table VALUES (?,?,?)'
|
public Task<FileShareRestRep> export(URI id,FileSystemExportParam input){
return postTask(input,getExportsUrl(),id);
}
|
Exports the given file system by ID. <p> API Call: <tt>POST /file/filesystems/{id}/exports</tt>
|
public void addEntry(LocalVarEntry e){
vars.addElement(e);
}
|
Add a LocalVar Entry to the attribute
|
protected Shape createInnerFocus(final SegmentType segmentType,final int x,final int y,final int w,final int h){
switch (segmentType) {
case FIRST:
return shapeGenerator.createRoundRectangle(x - 1,y - 1,w + 2,h + 1,CornerSize.INNER_FOCUS,CornerStyle.ROUNDED,CornerStyle.ROUNDED,CornerStyle.SQUARE,CornerStyle.SQUARE);
case MIDDLE:
return shapeGenerator.createRectangle(x - 2,y - 1,w + 3,h + 1);
case LAST:
return shapeGenerator.createRoundRectangle(x - 2,y - 1,w + 2,h + 1,CornerSize.INNER_FOCUS,CornerStyle.SQUARE,CornerStyle.SQUARE,CornerStyle.ROUNDED,CornerStyle.ROUNDED);
default :
return shapeGenerator.createRoundRectangle(x - 1,y - 1,w + 1,h + 1,CornerSize.INNER_FOCUS);
}
}
|
Create the shape for the inner focus ring. Designed to be drawn rather than filled.
|
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.
|
@After public void tearDown(){
file=null;
}
|
Removes references to any shared objects for garbage collection.
|
@Override public int findSegment(Point2D.Double find,double tolerance){
if (get(TRANSFORM) != null) {
try {
find=(Point2D.Double)get(TRANSFORM).inverseTransform(find,new Point2D.Double());
}
catch ( NoninvertibleTransformException ex) {
System.err.println("Warning: SVGBezierFigure.findSegment. Figure has noninvertible Transform.");
}
}
return getBezierPath().findSegment(find,tolerance);
}
|
Gets the segment of the polyline that is hit by the given Point2D.Double.
|
public Money exchange(final Money amount){
switch (type_) {
case Direct:
if (amount.currency().eq(source_)) {
return new Money(amount.value() * rate_,target_);
}
else if (amount.currency().eq(target_)) {
return new Money(amount.value() / rate_,source_);
}
else {
throw new LibraryException("exchange rate not applicable");
}
case Derived:
if (amount.currency() == rateChain_.first().source() || amount.currency() == rateChain_.first().target()) {
return rateChain_.second().exchange(rateChain_.first().exchange(amount));
}
else if (amount.currency() == rateChain_.second().source() || amount.currency() == rateChain_.second().target()) {
return rateChain_.first().exchange(rateChain_.second().exchange(amount));
}
else {
throw new LibraryException("exchange rate not applicable");
}
default :
throw new LibraryException("unknown exchange-rate type");
}
}
|
Apply this ExchangeRate an amount of cash. A new money instance will be returned. The input remains unchanged.
|
public boolean isMax(){
return value.isMax();
}
|
Test for zero. Equivalent to .EQ(Word.max())
|
public static void cursorFillWindow(final ICursor cursor,int position,final CursorWindow window){
if (position < 0 || position >= cursor.getCount()) {
return;
}
final int oldPos=cursor.getPosition();
final int numColumns=cursor.getColumnCount();
window.clear();
window.setStartPosition(position);
window.setNumColumns(numColumns);
if (cursor.moveToPosition(position)) {
do {
if (!window.allocRow()) {
break;
}
for (int i=0; i < numColumns; i++) {
final int type=cursor.getType(i);
final boolean success;
switch (type) {
case ICursor.FIELD_TYPE_NULL:
success=window.putNull(position,i);
break;
case ICursor.FIELD_TYPE_INTEGER:
success=window.putLong(cursor.getLong(i),position,i);
break;
case ICursor.FIELD_TYPE_FLOAT:
success=window.putDouble(cursor.getDouble(i),position,i);
break;
case ICursor.FIELD_TYPE_BLOB:
{
final byte[] value=cursor.getBlob(i);
success=value != null ? window.putBlob(value,position,i) : window.putNull(position,i);
break;
}
default :
case ICursor.FIELD_TYPE_STRING:
{
final String value=cursor.getString(i);
success=value != null ? window.putString(value,position,i) : window.putNull(position,i);
break;
}
}
if (!success) {
window.freeLastRow();
break;
}
}
position+=1;
}
while (cursor.moveToNext());
}
cursor.moveToPosition(oldPos);
}
|
Fills the specified cursor window by iterating over the contents of the cursor. The window is filled until the cursor is exhausted or the window runs out of space. The original position of the cursor is left unchanged by this operation.
|
public GF2Polynomial(GF2Polynomial b){
len=b.len;
blocks=b.blocks;
value=IntUtils.clone(b.value);
}
|
Creates a new GF2Polynomial by cloneing the given GF2Polynomial <i>b</i>.
|
@Override public boolean equals(Object o){
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
AbstractIconRetriever that=(AbstractIconRetriever)o;
return this.retrieverPath != null ? this.retrieverPath.equals(that.retrieverPath) : that.retrieverPath == null;
}
|
Indicates whether or not this retriever is equal to another.
|
public static BigDecimal allocatedAmt(int C_Invoice_ID,int C_Currency_ID,int C_ConversionType_ID,BigDecimal MultiplierAP) throws SQLException {
BigDecimal paidAmt=Adempiere.ZERO;
String sql="SELECT a.AD_Client_ID, a.AD_Org_ID," + " al.Amount, al.DiscountAmt, al.WriteOffAmt," + " a.C_Currency_ID, a.DateTrx "+ "FROM C_AllocationLine al"+ " INNER JOIN C_AllocationHdr a ON (al.C_AllocationHdr_ID=a.C_AllocationHdr_ID) "+ "WHERE al.C_Invoice_ID=?"+ " AND a.IsActive='Y'";
PreparedStatement pstmt=Adempiere.prepareStatement(sql);
pstmt.setInt(1,C_Invoice_ID);
ResultSet rs=pstmt.executeQuery();
while (rs.next()) {
int AD_Client_ID=rs.getInt(1);
int AD_Org_ID=rs.getInt(2);
BigDecimal Amount=rs.getBigDecimal(3);
BigDecimal DiscountAmt=rs.getBigDecimal(4);
BigDecimal WriteOffAmt=rs.getBigDecimal(5);
int C_CurrencyFrom_ID=rs.getInt(6);
Timestamp DateTrx=rs.getTimestamp(7);
BigDecimal invAmt=Amount.add(DiscountAmt).add(WriteOffAmt);
BigDecimal allocation=Currency.convert(invAmt.multiply(MultiplierAP),C_CurrencyFrom_ID,C_Currency_ID,DateTrx,C_ConversionType_ID,AD_Client_ID,AD_Org_ID);
if (allocation != null) paidAmt=paidAmt.add(allocation);
}
rs.close();
pstmt.close();
pstmt=null;
return paidAmt;
}
|
Get Allocated Amt (not directly used)
|
public boolean isWrapOnTyping(@Nullable Language language){
if (language != null) {
CommonCodeStyleSettings langSettings=getCommonSettings(language);
if (langSettings != null) {
if (langSettings.WRAP_ON_TYPING != WrapOnTyping.DEFAULT.intValue) {
return langSettings.WRAP_ON_TYPING == WrapOnTyping.WRAP.intValue;
}
}
}
return WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
}
|
Defines whether or not wrapping should occur when typing reaches right margin.
|
public void usingAnd(){
BiPredicate<Employee,Manager> isPersonalAssistant=empManagerPredicate.and(managerHasAssistantPredicate);
}
|
Using AND function
|
public TransactionOutput addOutput(Coin value,Address address){
return addOutput(new TransactionOutput(params,this,value,address));
}
|
Creates an output based on the given address and value, adds it to this transaction, and returns the new output.
|
static void test4(File blah) throws Exception {
try (FileChannel fc=new FileOutputStream(blah,true).getChannel()){
fc.tryLock().release();
fc.tryLock(0L,1L,false).release();
fc.lock().release();
fc.lock(0L,1L,false).release();
}
try (FileChannel fc=FileChannel.open(blah.toPath(),APPEND)){
fc.tryLock().release();
fc.tryLock(0L,1L,false).release();
fc.lock().release();
fc.lock(0L,1L,false).release();
}
}
|
Test file locking when file is opened for append
|
public int numCps(){
if (cpStr2Int == null) {
return 0;
}
else {
return cpStr2Int.size();
}
}
|
Num cps.
|
public static boolean startWithSpace(String s){
return s.length() > 0 && Character.isWhitespace(s.charAt(0));
}
|
Check whether the statement starts with a whitespace.
|
private void onOpenConversation(){
new LoadConversationTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,null);
}
|
To be called when the user opens a conversation. Initializes the Conversation objects, sets up the draft, and marks the conversation as read. <p> Note: This will have no effect if the context has not been initialized yet.
|
public void circle(Object[] vertices,double r,double left,double top){
int vertexCount=vertices.length;
double phi=2 * Math.PI / vertexCount;
for (int i=0; i < vertexCount; i++) {
if (isVertexMovable(vertices[i])) {
setVertexLocation(vertices[i],left + r + r * Math.sin(i * phi),top + r + r * Math.cos(i * phi));
}
}
}
|
Executes the circular layout for the specified array of vertices and the given radius.
|
public BRqTest(String name){
super(name);
}
|
Initializes the test.
|
public Compiler(){
m_errorHandler=null;
m_locator=null;
}
|
Construct a Compiler instance that has a null error listener and a null source locator.
|
public void init(){
Debug.message("eomg","EditableOMGraphicList.init()");
getEditables();
setStateMachine(new ListStateMachine(this));
}
|
Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points. Also allocates the grab point array needed by the EditableOMGraphicList.
|
void verify(){
byte[] d=digest.digest();
if (!MessageDigest.isEqual(d,Base64.decode(hash))) {
throw invalidDigest(JarFile.MANIFEST_NAME,name,jarName);
}
verifiedEntries.put(name,certificates);
}
|
Verifies that the digests stored in the manifest match the decrypted digests from the .SF file. This indicates the validity of the signing, not the integrity of the file, as it's digest must be calculated and verified when its contents are read.
|
long totalLength(){
return mTotalLength;
}
|
Get the total length. Should only be used for testing.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:42.960 -0500",hash_original_method="025E1AD213DC2532673CB1D1FC75B1CC",hash_generated_method="AF9BD842838DEB26BE1BF73447B9C978") public ContentEncodingParser(String contentEncoding){
super(contentEncoding);
}
|
Creates a new instance of ContentEncodingParser
|
public Bitmap decodeBestRegion(int requiredWidth,int requiredHeight,int gravity){
boolean upscaling=false;
int realWidth=getWidth();
int realHeight=getHeight();
BitmapFactory.Options options=new BitmapFactory.Options();
if (!(requiredWidth <= realWidth && requiredHeight <= realHeight)) {
float widthRatio=(float)requiredWidth / realWidth;
float heightRatio=(float)requiredHeight / realHeight;
float destinationRatio=Math.max(widthRatio,heightRatio);
requiredWidth=Math.round(((float)requiredWidth / destinationRatio));
requiredHeight=Math.round(((float)requiredHeight / destinationRatio));
upscaling=true;
}
boolean limitReached=false;
int basePow=0;
int actualScale;
while (!limitReached) {
actualScale=(int)Math.pow(2,basePow + 1);
if (requiredWidth <= realWidth / actualScale && requiredHeight <= realHeight / actualScale) {
basePow++;
}
else {
limitReached=true;
}
}
options.inSampleSize=(int)Math.pow(2,basePow);
int fromTop=0;
int fromLeft=0;
if (gravity == Gravity.CENTER) {
fromTop=(realHeight - requiredHeight * options.inSampleSize) / 2;
fromLeft=(realWidth - requiredWidth * options.inSampleSize) / 2;
}
else {
int horizontalGravity=gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
int verticalGravity=gravity & Gravity.VERTICAL_GRAVITY_MASK;
if (horizontalGravity == Gravity.LEFT) fromLeft=0;
else if (horizontalGravity == Gravity.RIGHT) fromLeft=realWidth - requiredWidth * options.inSampleSize;
else if (horizontalGravity == Gravity.CENTER_HORIZONTAL) fromLeft=(realWidth - requiredWidth * options.inSampleSize) / 2;
if (verticalGravity == Gravity.TOP) fromTop=0;
else if (verticalGravity == Gravity.BOTTOM) fromTop=realHeight - requiredHeight * options.inSampleSize;
else if (verticalGravity == Gravity.CENTER_VERTICAL) fromTop=(realHeight - requiredHeight * options.inSampleSize) / 2;
}
Rect area=new Rect(fromLeft,fromTop,fromLeft + requiredWidth * options.inSampleSize,fromTop + requiredHeight * options.inSampleSize);
return impl.decodeRegion(area,options);
}
|
Extracts the "best" rectangle region based on the specified dimensions. The "best" region means the biggest region of the original (downsampled) image, given the required gravity and output sizes/ratio. You should use this method when you have a big source image that have to be fit/be partially displayed.
|
public static void quote(Appendable buffer,String input){
try {
buffer.append('"');
for (int i=0; i < input.length(); ++i) {
char c=input.charAt(i);
if (c >= 32) {
if (c == '"' || c == '\\') buffer.append('\\');
buffer.append(c);
}
else {
char escape=escapes[c];
if (escape == 0xFFFF) {
buffer.append('\\').append('u').append('0').append('0');
if (c < 0x10) buffer.append('0');
buffer.append(Integer.toString(c,16));
}
else {
buffer.append('\\').append(escape);
}
}
}
buffer.append('"');
}
catch ( IOException x) {
throw new RuntimeException(x);
}
}
|
Quote a string into an Appendable. The characters ", \, \n, \r, \t, \f and \b are escaped
|
public String deleteThickLogicalUnits(String systemObjectId,Set<String> logicalUnitIdList,String model) throws Exception {
return hdsApiVolumeManager.deleteThickLogicalUnits(systemObjectId,logicalUnitIdList,model);
}
|
Client call to delete logicalunits.
|
void submit(String submitKey,String submitVal){
if (action == null) {
return;
}
boolean error=false;
String url=action;
String params=null;
if (comps.size() > 0) {
params="";
for (Enumeration e=comps.keys(); e.hasMoreElements(); ) {
String key=(String)e.nextElement();
Object input=comps.get(key);
key=HTMLUtils.encodeString(key);
String value="";
if (input instanceof String) {
value=HTMLUtils.encodeString((String)input);
params+=key + "=" + value+ "&";
}
else if (input instanceof Hashtable) {
Hashtable options=(Hashtable)input;
for (Enumeration e2=options.keys(); e2.hasMoreElements(); ) {
Button b=(Button)e2.nextElement();
if (b.isSelected()) {
params+=key + "=" + HTMLUtils.encodeString((String)options.get(b))+ "&";
}
}
}
else if (input instanceof TextArea) {
TextArea tf=((TextArea)input);
String text=tf.getText();
String errorMsg=null;
if (HTMLComponent.SUPPORT_INPUT_FORMAT) {
boolean ok=false;
if (text.equals("")) {
if (emptyNotOk.contains(tf)) {
errorMsg=htmlC.getUIManager().localize("html.format.emptynotok","Field can't be empty");
error=true;
}
else if (emptyOk.contains(tf)) {
ok=true;
}
}
if ((!error) && (!ok)) {
HTMLInputFormat inputFormat=(HTMLInputFormat)inputFormats.get(tf);
if ((inputFormat != null) && (!inputFormat.verifyString(text))) {
String emptyStr="";
if (emptyOk.contains(tf)) {
emptyStr=htmlC.getUIManager().localize("html.format.oremptyok"," or an empty string");
}
else if (emptyNotOk.contains(tf)) {
emptyStr=htmlC.getUIManager().localize("html.format.andemptynotok"," and cannot be an empty string");
}
errorMsg=htmlC.getUIManager().localize("html.format.errordesc","Malformed text. Correct value: ") + inputFormat.toString() + emptyStr;
error=true;
}
}
}
if (htmlC.getHTMLCallback() != null) {
int type=HTMLCallback.FIELD_TEXT;
if ((tf.getConstraint() & TextArea.PASSWORD) != 0) {
type=HTMLCallback.FIELD_PASSWORD;
}
text=htmlC.getHTMLCallback().fieldSubmitted(htmlC,tf,url,key,text,type,errorMsg);
}
if (errorMsg == null) {
params+=key + "=" + HTMLUtils.encodeString(text)+ "&";
}
}
else if (input instanceof ComboBox) {
Object item=((ComboBox)input).getSelectedItem();
if (item instanceof OptionItem) {
value=((OptionItem)item).getValue();
params+=key + "=" + HTMLUtils.encodeString(value)+ "&";
}
}
else if (input instanceof MultiComboBox) {
Vector selected=((MultiComboBox)input).getSelected();
for (int i=0; i < selected.size(); i++) {
Object item=selected.elementAt(i);
if (item instanceof OptionItem) {
value=((OptionItem)item).getValue();
params+=key + "=" + HTMLUtils.encodeString(value)+ "&";
}
}
}
}
if (params.endsWith("&")) {
params=params.substring(0,params.length() - 1);
}
}
if (submitKey != null) {
if (params == null) {
params="";
}
if (!params.equals("")) {
params=params + "&";
}
params=params + HTMLUtils.encodeString(submitKey) + "="+ HTMLUtils.encodeString(submitVal);
}
if (!error) {
DocumentInfo docInfo=new DocumentInfo(url,params,isPostMethod);
if ((encType != null) && (!encType.equals(""))) {
docInfo.setEncoding(encType);
}
htmlC.setPage(docInfo);
}
}
|
Called when the a form submit is needed. This querys all form fields, creates a URL accordingly and sets it to the HTMLComponent
|
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case N4JSPackage.ABSTRACT_CASE_CLAUSE__STATEMENTS:
return getStatements();
}
return super.eGet(featureID,resolve,coreType);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
@Override public MethodVisitor visitMethod(int access,String base,String desc,String signature,String[] exceptions){
MethodVisitor mv=cv.visitMethod(access,base,desc,signature,exceptions);
if (mv != null) {
JSRInlinerAdapter jsria=new JSRInlinerAdapter(mv,access,base,desc,signature,exceptions);
AllocationMethodAdapter aimv=new AllocationMethodAdapter(jsria,recorderClass,recorderMethod);
LocalVariablesSorter lvs=new LocalVariablesSorter(access,desc,aimv);
aimv.lvs=lvs;
mv=lvs;
}
return mv;
}
|
For each method in the class being instrumented, <code>visitMethod</code> is called and the returned MethodVisitor is used to visit the method. Note that a new MethodVisitor is constructed for each method.
|
public void mdctCalc(float[] output,int outputOffset,float[] input,int inputOffset){
int n=1 << mdctBits;
int n2=n >> 1;
int n4=n >> 2;
int n8=n >> 3;
int n3=3 * n4;
for (int i=0; i < n8; i++) {
float re=-input[inputOffset + 2 * i + n3] - input[inputOffset + n3 - 1 - 2 * i];
float im=-input[inputOffset + n4 + 2 * i] + input[inputOffset + n4 - 1 - 2 * i];
int j=revtab[i];
CMUL(output,outputOffset + 2 * j + 0,outputOffset + 2 * j + 1,re,im,-tcos[i],tsin[i]);
re=input[inputOffset + 2 * i] - input[inputOffset + n2 - 1 - 2 * i];
im=-input[inputOffset + n2 + 2 * i] - input[inputOffset + n - 1 - 2 * i];
j=revtab[n8 + i];
CMUL(output,outputOffset + 2 * j + 0,outputOffset + 2 * j + 1,re,im,-tcos[n8 + i],tsin[n8 + i]);
}
fftCalcFloat(output,outputOffset);
final float r[]=new float[4];
for (int i=0; i < n8; i++) {
CMUL(r,3,0,output[outputOffset + (n8 - i - 1) * 2 + 0],output[outputOffset + (n8 - i - 1) * 2 + 1],-tsin[n8 - i - 1],-tcos[n8 - i - 1]);
CMUL(r,1,2,output[outputOffset + (n8 + i) * 2 + 0],output[outputOffset + (n8 + i) * 2 + 1],-tsin[n8 + i],-tcos[n8 + i]);
output[outputOffset + (n8 - i - 1) * 2 + 0]=r[0];
output[outputOffset + (n8 - i - 1) * 2 + 1]=r[1];
output[outputOffset + (n8 + i) * 2 + 0]=r[2];
output[outputOffset + (n8 + i) * 2 + 1]=r[3];
}
}
|
Compute MDCT of size N = 2^nbits
|
public static double largeEstimatorCutoff(final int log2m,final int registerSizeInBits){
return (TWO_TO_L[(REG_WIDTH_INDEX_MULTIPLIER * registerSizeInBits) + log2m]) / 30.0;
}
|
The cutoff for using the "large range correction" formula, from the HyperLogLog algorithm, adapted for 64 bit hashes.
|
public FormUploadException(final String msg){
this(msg,null);
}
|
Constructs a new <code>FileUploadException</code> with specified detail message.
|
public final int offsetToX(int line,int offset){
painter.currentLineTokens=null;
return _offsetToX(line,offset);
}
|
Converts an offset in a line into an x co-ordinate. This is a slow version that can be used any time.
|
public static Class toClass(ClassFile cf,ClassLoader loader) throws CannotCompileException {
return toClass(cf,loader,null);
}
|
Loads a class file by a given class loader. This method uses a default protection domain for the class but it may not work with a security manager or a sigend jar file.
|
@RequestMapping(value="/jobs/ids/{id}",method=RequestMethod.DELETE) @Secured(SecurityFunctions.FN_JOBS_DELETE) public Job deleteJob(@PathVariable("id") String id,@RequestBody JobDeleteRequest jobDeleteRequest) throws Exception {
return jobService.deleteJob(id,jobDeleteRequest);
}
|
Deletes a currently running job and preserves the job state in history. <p>Requires EXECUTE permission on namespace</p>
|
public static int repoZipArchiveSize(){
int size=-1;
try {
PACKAGE_MANAGER.setPackageRepositoryURL(REP_URL);
String numPackagesS=PACKAGE_MANAGER.getPackageRepositoryURL().toString() + "/repoSize.txt";
URLConnection conn=null;
URL connURL=new URL(numPackagesS);
if (PACKAGE_MANAGER.setProxyAuthentication(connURL)) {
conn=connURL.openConnection(PACKAGE_MANAGER.getProxy());
}
else {
conn=connURL.openConnection();
}
conn.setConnectTimeout(30000);
BufferedReader bi=new BufferedReader(new InputStreamReader(conn.getInputStream()));
String n=bi.readLine();
try {
size=Integer.parseInt(n);
}
catch ( NumberFormatException ne) {
System.err.println("[WekaPackageManager] problem parsing the size " + "of repository zip archive from the server.");
}
bi.close();
}
catch ( Exception ex) {
ex.printStackTrace();
}
return size;
}
|
Retrieves the size (in KB) of the repository zip archive stored on the server.
|
public int readIntFromXML(Element node) throws Exception {
if (DEBUG) {
trace(new Throwable(),node.getAttribute(ATT_NAME));
}
m_CurrentNode=node;
return ((Integer)getPrimitive(node)).intValue();
}
|
builds the primitive from the given DOM node.
|
public Token peekToken(){
while (needMoreTokens()) {
fetchMoreTokens();
}
return this.tokens.get(0);
}
|
Return the next token, but do not delete it from the queue.
|
private JobDefinition createJobDefinitionFromEntity(JobDefinitionEntity jobDefinitionEntity) throws IOException {
JobDefinition jobDefinition=new JobDefinition();
jobDefinition.setId(jobDefinitionEntity.getId());
jobDefinition.setNamespace(jobDefinitionEntity.getNamespace().getCode());
jobDefinition.setJobName(jobDefinitionEntity.getName());
jobDefinition.setDescription(jobDefinitionEntity.getDescription());
String s3BucketName=jobDefinitionEntity.getS3BucketName();
String s3ObjectKey=jobDefinitionEntity.getS3ObjectKey();
if (s3BucketName != null && s3ObjectKey != null) {
S3PropertiesLocation s3PropertiesLocation=new S3PropertiesLocation();
s3PropertiesLocation.setBucketName(s3BucketName);
s3PropertiesLocation.setKey(s3ObjectKey);
jobDefinition.setS3PropertiesLocation(s3PropertiesLocation);
}
ProcessDefinition processDefinition=activitiRepositoryService.createProcessDefinitionQuery().processDefinitionId(jobDefinitionEntity.getActivitiId()).singleResult();
InputStream xmlStream=activitiRepositoryService.getResourceAsStream(processDefinition.getDeploymentId(),processDefinition.getResourceName());
jobDefinition.setActivitiJobXml(IOUtils.toString(xmlStream));
List<Parameter> parameters=new ArrayList<>();
jobDefinition.setParameters(parameters);
for ( JobDefinitionParameterEntity parameterEntity : jobDefinitionEntity.getParameters()) {
Parameter parameter=new Parameter(parameterEntity.getName(),parameterEntity.getValue());
jobDefinitionHelper.maskPassword(parameter);
parameters.add(parameter);
}
jobDefinition.setLastUpdatedByUserId(jobDefinitionEntity.getUpdatedBy());
return jobDefinition;
}
|
Creates the job definition from the persisted entity.
|
public ColumnMetadata(Table table,String column,Comparator cmp,boolean dynamic){
m_table=table;
m_field=column;
m_cmp=cmp;
m_dynamic=dynamic;
}
|
Creates a new ColumnMetadata instance.
|
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:01:05.005 -0500",hash_original_method="227FECEA7131D056EF18EE2E9369B9A1",hash_generated_method="459DC1330B09FE06A09C222972E31D1D") @Override protected byte[] decrypt(byte type,byte[] fragment,int offset,int len){
byte[] data=decCipher.update(fragment,offset,len);
byte[] content;
if (block_size != 0) {
int padding_length=data[data.length - 1];
for (int i=0; i < padding_length; i++) {
if (data[data.length - 2 - i] != padding_length) {
throw new AlertException(AlertProtocol.DECRYPTION_FAILED,new SSLProtocolException("Received message has bad padding"));
}
}
content=new byte[data.length - hash_size - padding_length- 1];
}
else {
content=new byte[data.length - hash_size];
}
byte[] mac_value;
mac_material_part[0]=type;
mac_material_part[1]=(byte)((0x00FF00 & content.length) >> 8);
mac_material_part[2]=(byte)(0x0000FF & content.length);
messageDigest.update(mac_read_secret);
messageDigest.update(pad_1);
messageDigest.update(read_seq_num);
messageDigest.update(mac_material_part);
messageDigest.update(data,0,content.length);
mac_value=messageDigest.digest();
messageDigest.update(mac_read_secret);
messageDigest.update(pad_2);
messageDigest.update(mac_value);
mac_value=messageDigest.digest();
if (logger != null) {
logger.println("Decrypted:");
logger.print(data);
logger.println("Expected mac value:");
logger.print(mac_value);
}
for (int i=0; i < hash_size; i++) {
if (mac_value[i] != data[i + content.length]) {
throw new AlertException(AlertProtocol.BAD_RECORD_MAC,new SSLProtocolException("Bad record MAC"));
}
}
System.arraycopy(data,0,content,0,content.length);
incSequenceNumber(read_seq_num);
return content;
}
|
Retrieves the fragment of the Plaintext structure of the specified type from the provided data.
|
public Node removeNamedItemNS(String namespaceURI,String localName) throws DOMException {
throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
}
|
Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the <code>Node</code> interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. <br>HTML-only DOM implementations do not need to implement this method.
|
public void refreshCompletely(){
initialize();
}
|
Makes the log perform complete refresh for all roots. It fairly retrieves the data from the VCS and rebuilds the whole log.
|
@Override public void createUser(User user) throws SQLException {
String skeleton;
if (user.isPrivileged()) {
skeleton="grant all on *.* to %s@'%%' identified by '%s' with grant option";
String sql=String.format(skeleton,user.getLogin(),user.getPassword());
execute(sql);
}
else {
skeleton="grant select on *.* to %s@'%%' identified by '%s' with grant option";
String sql=String.format(skeleton,user.getLogin(),user.getPassword());
execute(sql);
Statement stmt=null;
ResultSet rs=null;
String currentSchema=null;
try {
stmt=dbConn.createStatement();
rs=stmt.executeQuery("select database() as \"database\"");
while (rs.next()) {
currentSchema=rs.getString("database");
}
}
finally {
if (rs != null) rs.close();
if (stmt != null) stmt.close();
}
skeleton="grant all on %s.* to %s@'%%' identified by '%s' with grant option";
String sql2=String.format(skeleton,currentSchema,user.getLogin(),user.getPassword());
execute(sql2);
}
}
|
Creates a user that can connect from any location. If the user is a superuser, grant all on *.*, otherwise just grant select.
|
public Boolean isEagerZero(){
return eagerZero;
}
|
Gets the value of the eagerZero property.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.188 -0400",hash_original_method="C1AF40BAF4362B77A9C74A69039A6769",hash_generated_method="8A0434476D39CA378011B884C5880AAF") public static void write(File file,CharSequence data,String encoding,boolean append) throws IOException {
write(file,data,Charsets.toCharset(encoding),append);
}
|
Writes a CharSequence to a file creating the file if it does not exist.
|
private static void createBillingResultDataMock(){
Long subscriptionKey=1L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_EUR,BigDecimal.valueOf(120),getProductHistory(subscriptionKey)));
subscriptionKey=2L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_EUR,BigDecimal.valueOf(210.15),getProductHistory(subscriptionKey)));
subscriptionKey=3L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_EUR,BigDecimal.valueOf(187.99),getProductHistory(subscriptionKey)));
subscriptionKey=4L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_EUR,BigDecimal.valueOf(26),getProductHistory(subscriptionKey)));
subscriptionKey=5L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_USD,BigDecimal.valueOf(523.56),getProductHistory(subscriptionKey)));
subscriptionKey=6L;
billingResultDataMock.put(subscriptionKey,new BillingResultDataMock(CURRENCY_EUR,BigDecimal.valueOf(176.44),getProductHistory(subscriptionKey)));
printTestData();
}
|
Subscription;ProductId;ProductKey;Currency;NetAmount;Supplier <br/> 1; productId_1; 1; EUR; 120; 1 <br/> 2; productId_1; 1; EUR; 210.15; 1 <br/> 3; productId_2; 2; EUR; 187.99; 1 <br/> 4; productId_3; 3; EUR; 26; 2 <br/> 5; productId_3; 3; USD; 523.56; 2 <br/> 6; productId_1; 1; EUR; 176.44; 1 <br/>
|
public ScientificFormat(int sigDigit,int maxWidth,boolean SciNote){
setSigDigits(sigDigit);
setMaxWidth(maxWidth);
setScientificNotationStyle(SciNote);
}
|
Sets the significant digits, maximum allowable width and number formatting style (SciNote == true for Pure formatting).
|
public Boolean isNestedHVEnabled(){
return nestedHVEnabled;
}
|
Gets the value of the nestedHVEnabled property.
|
public Document createDefaultDocument(Font defaultFont,Color foreground){
StyleSheet styles=getStyleSheet();
StyleSheet ss=new StyleSheet();
ss.addStyleSheet(styles);
BasicDocument doc=new BasicDocument(ss,defaultFont,foreground);
doc.setAsynchronousLoadPriority(Integer.MAX_VALUE);
doc.setPreservesUnknownTags(false);
return doc;
}
|
Sets the async policy to flush everything in one chunk, and to not display unknown tags.
|
public void add(Handler handler){
_logHandlerConfig.add(handler);
}
|
Adds a handler
|
@Override public boolean provides(Class<?> type){
if (getDisabled()) {
return false;
}
if (type.equals(jmri.ProgrammerManager.class)) {
return true;
}
if (type.equals(jmri.GlobalProgrammerManager.class)) {
return getProgrammerManager().isGlobalProgrammerAvailable();
}
if (type.equals(jmri.AddressedProgrammerManager.class)) {
return getProgrammerManager().isAddressedModePossible();
}
if (type.equals(jmri.ThrottleManager.class)) {
return true;
}
if (type.equals(jmri.PowerManager.class)) {
return true;
}
if (type.equals(jmri.SensorManager.class)) {
return true;
}
if (type.equals(jmri.TurnoutManager.class)) {
return true;
}
if (type.equals(jmri.LightManager.class)) {
return true;
}
if (type.equals(jmri.ReporterManager.class)) {
return true;
}
if (type.equals(jmri.ConsistManager.class)) {
return true;
}
if (type.equals(jmri.ClockControl.class)) {
return true;
}
if (type.equals(jmri.CommandStation.class)) {
return true;
}
return false;
}
|
Tells which managers this provides by class
|
public void startUpdate(String targetId) throws IOException {
startChangesIfNecessary();
inUpdate=true;
ResponseWriter writer=getWrapped();
writer.startElement("update",null);
writer.writeAttribute("id",targetId,null);
writer.startCDATA();
}
|
<p class="changed_added_2_0">Write the start of an update operation.</p>
|
public final void add(Matrix4f m1,Matrix4f m2){
this.m00=m1.m00 + m2.m00;
this.m01=m1.m01 + m2.m01;
this.m02=m1.m02 + m2.m02;
this.m03=m1.m03 + m2.m03;
this.m10=m1.m10 + m2.m10;
this.m11=m1.m11 + m2.m11;
this.m12=m1.m12 + m2.m12;
this.m13=m1.m13 + m2.m13;
this.m20=m1.m20 + m2.m20;
this.m21=m1.m21 + m2.m21;
this.m22=m1.m22 + m2.m22;
this.m23=m1.m23 + m2.m23;
this.m30=m1.m30 + m2.m30;
this.m31=m1.m31 + m2.m31;
this.m32=m1.m32 + m2.m32;
this.m33=m1.m33 + m2.m33;
}
|
Sets the value of this matrix to the matrix sum of matrices m1 and m2.
|
private XSDatatype deriveSimpleType(XSDatatype baseType,Element xsdRestriction){
TypeIncubator incubator=new TypeIncubator(baseType);
ValidationContext context=null;
try {
for (Iterator<Element> iter=xsdRestriction.elementIterator(); iter.hasNext(); ) {
Element element=iter.next();
String name=element.getName();
String value=element.attributeValue("value");
boolean fixed=AttributeHelper.booleanValue(element,"fixed");
incubator.addFacet(name,value,fixed,context);
}
String newTypeName=null;
return incubator.derive("",newTypeName);
}
catch ( DatatypeException e) {
onSchemaError("Invalid restriction: " + e.getMessage() + " when trying to build restriction: "+ xsdRestriction);
return null;
}
}
|
Derives a new type from a base type and a set of restrictions
|
private ReplaceTokens createWarDirToken(){
ReplaceTokens.Token tokenWarDir=new ReplaceTokens.Token();
tokenWarDir.setKey(TOKEN_KEY_WAR_DIR);
tokenWarDir.setValue(new File(getHome(),"webapp/host").toString());
ReplaceTokens replaceWarDir=new ReplaceTokens();
replaceWarDir.addConfiguredToken(tokenWarDir);
return replaceWarDir;
}
|
Creates tokens for the hotdeployment war dir.
|
public static Paint newGuidelinePaint(){
final Paint paint=new Paint();
paint.setColor(Color.parseColor(SEMI_TRANSPARENT));
paint.setStrokeWidth(DEFAULT_GUIDELINE_THICKNESS_PX);
return paint;
}
|
Creates the Paint object for drawing the crop window guidelines.
|
public boolean visit(ThrowStatement node){
return true;
}
|
Visits the given type-specific AST node. <p> The default implementation does nothing and return true. Subclasses may reimplement. </p>
|
protected void loadValue(String sValue){
sValue=sValue.trim();
try {
int r=Integer.parseInt(sValue.substring(1,3),16);
int g=Integer.parseInt(sValue.substring(3,5),16);
int b=Integer.parseInt(sValue.substring(5,7),16);
value=new Color(r,g,b);
}
catch ( NumberFormatException nfe) {
revertToDefault();
}
catch ( StringIndexOutOfBoundsException sioobe) {
revertToDefault();
}
}
|
Returns the value of this setting.
|
private Set<KnowledgeEdge> generateForbiddenEdgeList(){
Set<KnowledgeEdge> forbiddenEdges=new HashSet<>();
List<String> vars=new ArrayList<>(tierMap.keySet());
for (int i=0; i < vars.size(); i++) {
for (int j=0; j < vars.size(); j++) {
if (i == j) {
continue;
}
String var1=vars.get(i);
String var2=vars.get(j);
if (isForbiddenByTiers(var1,var2)) {
forbiddenEdges.add(new KnowledgeEdge(var1,var2));
}
}
}
for ( KnowledgeGroup group : this.knowledgeGroups) {
if (group.getType() == KnowledgeGroup.FORBIDDEN) {
forbiddenEdges.addAll(group.getEdges());
}
}
return forbiddenEdges;
}
|
Method generateForbiddenEdgeList
|
private void generateAlwaysBlock(Fingerprint.Payload payload,ConditionalBlock block,Fingerprint.Payload.Always always){
LinearBlock linearBlock=null;
for ( Return return_ : always.getReturn()) {
DetailBlockTemplate template=new DetailBlockTemplate().setFingerprintName(payload.getFor()).setReturn(return_);
if (linearBlock == null) {
linearBlock=new LinearBlock(template);
}
else {
linearBlock.appendBody(new LinearBlock(template));
}
}
block.appendBody(linearBlock);
}
|
Generate the "Always" blocks which have slightly different conditional needs then typical Fingerprint Operations.
|
private String numberToMd5(String number,MD5 md5){
String hash="";
if (!TextUtils.isEmpty(number)) {
try {
md5.Init();
md5.Update(number,HTTP.ISO_8859_1);
hash=md5.asHex();
}
catch ( UnsupportedEncodingException e) {
hash="";
}
}
return hash;
}
|
Method that converts a phone number to an MD5 Hash
|
private boolean isSubscribed(){
final SharedPreferences settings=getSharedPreferencesForCurrentUser();
return settings.getBoolean(HAS_SUBSCRIPTION,false);
}
|
Helper method to check if the customer is subscribed.
|
@SafeVarargs public static <T>OutputMatcher<T> allOf(OutputMatcher<T>... matchers){
return OutputMatcherFactory.create(AllOf.allOf(matchers));
}
|
Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers.
|
public CategoricalDistribution fixedLagSmoothing(List<AssignmentProposition> et){
Matrix O_tmd, O_t;
e_tmd_to_t.add(hmm.getEvidence(et));
O_t=e_tmd_to_t.get(e_tmd_to_t.size() - 1);
if (t > d) {
e_tmd_to_t.remove(0);
O_tmd=e_tmd_to_t.get(0);
f=forward(f,O_tmd);
B=O_tmd.inverse().times(hmm.getTransitionModel().inverse()).times(B).times(hmm.getTransitionModel()).times(O_t);
}
else {
B=B.times(hmm.getTransitionModel()).times(O_t);
}
CategoricalDistribution rVal=null;
if (t > d) {
rVal=hmm.convert(hmm.normalize(f.arrayTimes(B.times(unitMessage))));
}
t=t + 1;
return rVal;
}
|
Algorithm for smoothing with a fixed time lag of d steps, implemented as an online algorithm that outputs the new smoothed estimate given the observation for a new time step.
|
public void actionPerformed(ActionEvent e){
int pos=viewToModel(new Point(popup.x,popup.y));
popup.setVisible(false);
String cmd=e.getActionCommand();
int line=-1;
try {
line=getLineOfOffset(pos);
}
catch ( Exception exc) {
}
if (cmd.equals("Set Breakpoint")) {
w.setBreakPoint(line + 1);
}
else if (cmd.equals("Clear Breakpoint")) {
w.clearBreakPoint(line + 1);
}
else if (cmd.equals("Run")) {
w.load();
}
}
|
Performs an action.
|
public GetSnapshotsRequest(String repository){
this.repository=repository;
}
|
Constructs a new get snapshots request with given repository name
|
public ConcurrentWeakValueCache(final int queueCapacity,final float loadFactor,final int concurrencyLevel){
this(queueCapacity,loadFactor,concurrencyLevel,true);
}
|
Uses the specified values.
|
public static int decode(String data,OutputStream out) throws IOException {
return encoder.decode(data,out);
}
|
decode the Hex encoded String data writing it to the given output stream, whitespace characters will be ignored.
|
public void yypushback(int number){
if (number > yylength()) zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos-=number;
}
|
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method
|
public T caseVoidType(VoidType object){
return null;
}
|
Returns the result of interpreting the object as an instance of '<em>Void Type</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
|
@Override public String toString(){
if (eIsProxy()) return super.toString();
StringBuffer result=new StringBuffer(super.toString());
result.append(" (autounique_1: ");
result.append(autounique_1);
result.append(", name_1: ");
result.append(name_1);
result.append(')');
return result.toString();
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public static void println(int priority,String tag,String msg){
println(priority,tag,msg,null);
}
|
Instructs the LogNode to print the log data provided. Other LogNodes can be chained to the end of the LogNode as desired.
|
public Timer plus(Timer other){
Timer copy=new Timer();
copy.elapsedTime=millis() + other.millis();
return copy;
}
|
<tt>T = this + other</tt>; Constructs and returns a new timer which is the sum of the receiver and the other timer. The new timer is not started.
|
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case UmplePackage.ASSOCIATION_CLASS_DEFINITION___NAME_1:
return getName_1();
case UmplePackage.ASSOCIATION_CLASS_DEFINITION___ASSOCIATION_CLASS_CONTENT_1:
return getAssociationClassContent_1();
}
return super.eGet(featureID,resolve,coreType);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public static Text createSingleText(Composite parent,int hspan){
Text t=new Text(parent,SWT.SINGLE | SWT.BORDER);
t.setFont(parent.getFont());
GridData gd=new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan=hspan;
t.setLayoutData(gd);
return t;
}
|
Creates a new text widget
|
public void testNextIntBounded(){
for (int bound=2; bound < MAX_INT_BOUND; bound+=524959) {
int f=ThreadLocalRandom.current().nextInt(bound);
assertTrue(0 <= f && f < bound);
int i=0;
int j;
while (i < NCALLS && (j=ThreadLocalRandom.current().nextInt(bound)) == f) {
assertTrue(0 <= j && j < bound);
++i;
}
assertTrue(i < NCALLS);
}
}
|
nextInt(bound) returns 0 <= value < bound; repeated calls produce at least two distinct results
|
public double mutualInformation(int child,int[] parents,int lag){
double M=0.0;
int[] c=new int[ntimes - lag];
for (int i=lag; i < ntimes; i++) {
c[i - lag]=cases[i][child];
}
double hchild=entropy(c);
int[] p1=new int[ntimes - lag];
int[][] pm=new int[parents.length][ntimes - lag];
double hparents=0.0;
for (int i=0; i < ntimes - lag; i++) {
p1[i]=cases[i][parents[0]];
}
hparents=entropy(p1);
if (parents.length > 1) {
for (int i=0; i < ntimes - lag; i++) {
for (int j=1; j < parents.length; j++) {
pm[j - 1][i]=cases[i][parents[j]];
}
}
hparents=jointEntropy(p1,pm);
}
double hjoint=0.0;
if (parents.length == 1) {
hjoint=jointEntropy(c,p1);
}
else {
int[][] p1pm=new int[parents.length][ntimes - lag];
for (int i=0; i < ntimes - lag; i++) {
p1pm[0][i]=p1[i];
for (int j=0; j < parents.length - 1; j++) {
p1pm[j + 1][i]=pm[j][i];
}
}
hjoint=jointEntropy(c,p1pm);
}
M=hchild + hparents - hjoint;
return M;
}
|
This method computes the mutual information between a gene and a set of presumptive causes (other genes). There must be at least one cause but there may be only one. The third argument is the time lag between the cause(s) and the effect. See Fig. 5 in the Liang et al. paper.
|
public void testMixupMultiValued() throws Exception {
Directory dir=newDirectory();
RandomIndexWriter writer=new RandomIndexWriter(random(),dir);
Document doc=new Document();
Field field=new TextField("field","",Field.Store.NO);
TokenStream ts=new MockTokenizer(MockTokenizer.WHITESPACE,true);
((Tokenizer)ts).setReader(new StringReader("here we go"));
field.setTokenStream(ts);
doc.add(field);
Field field2=new TextField("field","",Field.Store.NO);
Token withPayload=new Token("withPayload",0,11);
withPayload.setPayload(new BytesRef("test"));
ts=new CannedTokenStream(withPayload);
assertTrue(ts.hasAttribute(PayloadAttribute.class));
field2.setTokenStream(ts);
doc.add(field2);
Field field3=new TextField("field","",Field.Store.NO);
ts=new MockTokenizer(MockTokenizer.WHITESPACE,true);
((Tokenizer)ts).setReader(new StringReader("nopayload"));
field3.setTokenStream(ts);
doc.add(field3);
writer.addDocument(doc);
DirectoryReader reader=writer.getReader();
LeafReader sr=getOnlyLeafReader(reader);
PostingsEnum de=sr.postings(new Term("field","withPayload"),PostingsEnum.PAYLOADS);
de.nextDoc();
de.nextPosition();
assertEquals(new BytesRef("test"),de.getPayload());
writer.close();
reader.close();
dir.close();
}
|
some field instances have payload att, some not
|
public Instantiation findOwner(final int i){
if (!subroutine.get(i)) {
return null;
}
if (!dualCitizens.get(i)) {
return this;
}
Instantiation own=this;
for (Instantiation p=previous; p != null; p=p.previous) {
if (p.subroutine.get(i)) {
own=p;
}
}
return own;
}
|
Returns the "owner" of a particular instruction relative to this instantiation: the owner referes to the Instantiation which will emit the version of this instruction that we will execute. Typically, the return value is either <code>this</code> or <code>null</code>. <code>this</code> indicates that this instantiation will generate the version of this instruction that we will execute, and <code>null</code> indicates that this instantiation never executes the given instruction. Sometimes, however, an instruction can belong to multiple subroutines; this is called a "dual citizen" instruction (though it may belong to more than 2 subroutines), and occurs when multiple subroutines branch to common points of control. In this case, the owner is the subroutine that appears lowest on the stack, and which also owns the instruction in question.
|
public static void shareEpisode(Context context,Episode episode){
if (TextUtils.isEmpty(episode.getArtworkUrl())) {
shareEpisode(context,episode,null);
}
else {
ImageLoadHelper.saveImage(context,episode.getArtworkUrl(),null);
}
}
|
Shares an episode to the Android app of choice
|
@Override public synchronized void connect(Object device,boolean secure){
log.debug("connect to: " + device);
if (mState == STATE.CONNECTING) {
if (mBtConnectThread != null) {
mBtConnectThread.cancel();
mBtConnectThread=null;
}
}
if (mBtWorkerThread != null) {
mBtWorkerThread.cancel();
mBtWorkerThread=null;
}
setState(STATE.CONNECTING);
mBtConnectThread=new BtConnectThread((BluetoothDevice)device,secure);
mBtConnectThread.start();
}
|
start connection to specified device
|
public void checkCallbacks(){
if (log.isTraceEnabled()) {
log.trace("checkCallbacks current thread is '" + currentThread.name + "' doCallbacks:"+ currentThread.doCallbacks+ " caller:"+ getCallingFunction());
}
boolean handled;
SceKernelThreadInfo checkCurrentThread=currentThread;
do {
handled=false;
for ( SceKernelThreadInfo thread : threadMap.values()) {
if (thread.doCallbacks && checkThreadCallbacks(thread)) {
handled=true;
break;
}
}
}
while (handled && checkCurrentThread == currentThread);
}
|
Iterates waiting threads, making sure doCallbacks is set before checking for pending callbacks. Handles sceKernelCheckCallback when doCallbacks is set on currentThread. Handles redirects to yieldCB (from fake waitCB) on the thread that called waitCB. We currently call checkCallbacks() at the end of each waitCB function since this has less overhead than checking on every step. Some trickery is used in yieldCurrentThreadCB(). By the time we get inside the checkCallbacks() function the thread that called yieldCB is no longer the current thread. Also the thread that called yieldCB is not in the wait state (it's in the ready state). so what we do is check every thread, not just the waiting threads for the doCallbacks flag. Also the waitingThreads list only contains waiting threads that have a finite wait period, so we have to iterate on all threads anyway. It is probably unsafe to call contextSwitch() when insideCallback is true. insideCallback may become true after a call to checkCallbacks().
|
public ExternalDataSystem(ExternalDataSystem other){
}
|
Performs a deep copy on <i>other</i>.
|
public synchronized boolean isKnownPeer(Peer peer){
for ( Peer peerInList : mCurrentPeers) {
if (peer.equals(peerInList)) {
return true;
}
}
return false;
}
|
Check whether a peer is already in the peer list. Peer equality is based on whether their PeerNetworks refer to the same destinations, so two peers might be .equals() even if not ==.
|
public void drawPalette(int[] colors,int selectedColor,String[] colorContentDescriptions){
if (colors == null) {
return;
}
this.removeAllViews();
int tableElements=0;
int rowElements=0;
int rowNumber=0;
TableRow row=createTableRow();
for ( int color : colors) {
View colorSwatch=createColorSwatch(color,selectedColor);
setSwatchDescription(rowNumber,tableElements,rowElements,color == selectedColor,colorSwatch,colorContentDescriptions);
addSwatchToRow(row,colorSwatch,rowNumber);
tableElements++;
rowElements++;
if (rowElements == mNumColumns) {
addView(row);
row=createTableRow();
rowElements=0;
rowNumber++;
}
}
if (rowElements > 0) {
while (rowElements != mNumColumns) {
addSwatchToRow(row,createBlankSpace(),rowNumber);
rowElements++;
}
addView(row);
}
}
|
Adds swatches to table in a serpentine format.
|
public static void addField(WebSessionCtx wsc,tr line,GridField field,Object oData,boolean hasDependents,int recordID,int tableID,boolean tabRO,int fieldNumber,GridTab mTab,MRole role){
String columnName=field.getColumnName();
boolean error=field.isErrorValue();
if (error) oData=field.getErrorValue();
int dt=field.getDisplayType();
boolean hasCallout=field.getCallout().length() > 0;
if (!field.getFieldGroup().equals(sectionNameOld) && !field.getFieldGroup().equals("") && field.getFieldGroup() != null) {
log.fine("Fieldgroup=" + field.getFieldGroup() + ".");
td td1=new td();
td1.setClass("Fieldgroup");
td1.addElement(field.getFieldGroup());
td td2=new td().setColSpan(4);
td2.setClass("Fieldgroup");
td2.addElement(new hr().setWidth("100%"));
line.addElement(new tr().addElement(td1));
line.addElement(new tr().addElement(td2));
sectionNameOld=field.getFieldGroup();
}
boolean fieldRO=true;
if (tabRO == true) fieldRO=true;
else fieldRO=!field.isEditable(true);
WebField wField=new WebField(wsc,columnName,field.getHeader(),field.getDescription(),dt,field.getFieldLength(),field.getDisplayLength(),field.isLongField(),fieldRO,field.isMandatory(false),error,hasDependents,hasCallout,field.getAD_Process_ID(),field.getAD_Window_ID(),recordID,tableID,fieldNumber,field.getDefault(),field.getCallout(),mTab,field,role);
line.addElement(wField.getLabel()).addElement(wField.getField(field.getLookup(),oData));
}
|
Add Field to Line
|
private void writeChallenge(Challenge challenge,List<Answer> answerList){
long oldChallengeId=challenge.getId();
challenge.setId(null);
long challengeId=mChallengeDataSource.create(challenge);
for ( Answer answer : answerList) {
if (answer.getChallengeId() == oldChallengeId) {
answer.setChallengeId(challengeId);
writeAnswer(answer);
answer.setChallengeId(-1);
}
}
}
|
Writes a challenge with their answers to the database
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:39.294 -0500",hash_original_method="911AB9C595BBE3DEF39975B1C146C2FC",hash_generated_method="070660DD5CE59C01FA4AEB53FF32B37A") @Deprecated public static int forkAndSpecialize(int uid,int gid,int[] gids,boolean enableDebugger,int[][] rlimits){
int debugFlags=enableDebugger ? DEBUG_ENABLE_DEBUGGER : 0;
return forkAndSpecialize(uid,gid,gids,debugFlags,rlimits);
}
|
Forks a new VM instance.
|
public void print(int inum){
print(String.valueOf(inum));
}
|
Prints the string representation of the specified integer to the target.
|
public SignatureVisitor visitReturnType(){
return this;
}
|
Visits the return type of the method.
|
protected double decisionFunction(int v){
double sum=0;
for (int i=0; i < vecs.size(); i++) if (alphas[i] > 0) sum+=alphas[i] * label[i] * kEval(v,i);
return sum;
}
|
Returns the local decision function for classification training purposes without the bias term
|
public CInsertOrOperatorAction(final CCriteriumTree tree,final CCriteriumTreeNode parent){
super("Insert OR");
m_tree=tree;
m_parent=parent;
}
|
Creates a new action object.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.