code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public boolean stoplistContains(String x){
if (stopwords == null) return false;
return stopwords.contains(x);
}
|
Returns true if term is in stoplist, false otherwise.
|
public void testSetAttributeNS1() throws Throwable {
String namespaceURI="http://www.nist.gov";
String qualifiedName="emp:qual?name";
Document doc;
NodeList elementList;
Node testAddr;
doc=(Document)load("staffNS",builder);
elementList=doc.getElementsByTagName("employee");
testAddr=elementList.item(0);
{
boolean success=false;
try {
((Element)testAddr).setAttributeNS(namespaceURI,qualifiedName,"newValue");
}
catch ( DOMException ex) {
success=(ex.code == DOMException.INVALID_CHARACTER_ERR);
}
assertTrue("throw_INVALID_CHARACTER_ERR",success);
}
}
|
Runs the test case.
|
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
|
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
|
public boolean isExternalZoomEnabled(){
return mExternalZoomEnabled;
}
|
Returns the enabled state of the external (application implemented) zoom.
|
public static void appendInstruction(OFFlowMod.Builder fmb,OFInstruction inst){
List<OFInstruction> newIl=new ArrayList<OFInstruction>();
List<OFInstruction> oldIl=fmb.getInstructions();
if (oldIl != null) {
newIl.addAll(fmb.getInstructions());
}
for ( OFInstruction i : newIl) {
if (i.getType() == inst.getType()) {
newIl.remove(i);
}
}
newIl.add(inst);
fmb.setInstructions(newIl);
}
|
Adds the instructions to the list of OFInstructions in the OFFlowMod. Any pre-existing instruction of the same type is replaced with OFInstruction inst.
|
public MemoryExampleTable(List<Attribute> attributes){
super(attributes);
this.columns=attributes.size();
}
|
Creates a new instance of MemoryExampleTable.
|
public String validate(){
StringBuffer errors=new StringBuffer();
if (getAD_WF_Node_ID() == 0) errors.append(" - No Start Node");
if (WORKFLOWTYPE_DocumentValue.equals(getWorkflowType()) && (getDocValueLogic() == null || getDocValueLogic().length() == 0)) errors.append(" - No Document Value Logic");
if (getWorkflowType().equals(MWorkflow.WORKFLOWTYPE_Manufacturing)) {
this.setAD_Table_ID(0);
}
boolean valid=errors.length() == 0;
setIsValid(valid);
if (!valid) log.info("validate: " + errors);
return errors.toString();
}
|
Validate workflow. Sets Valid flag
|
public InlineQueryResultCachedGifBuilder inputMessageContent(InputMessageContent inputMessageContent){
this.input_message_content=inputMessageContent;
return this;
}
|
*Optional Sets the content you want to be sent with this result to the provided InputMessageContent object
|
public static String inleinHome(){
String res=System.getenv("INLEIN_HOME");
if (res == null) {
res=new File(System.getProperty("user.home"),".inlein").getAbsolutePath();
}
return res;
}
|
Returns the home directory to inlein.
|
public void add(PlanarGraph graph){
add(graph.getEdgeEnds(),graph.getNodes());
}
|
Add a complete graph. The graph is assumed to contain one or more polygons, possibly with holes.
|
public Program(String name,boolean parallel){
this(name,parallel,false,QueryOptions.NONE);
}
|
An empty program.
|
@Override public boolean isServiceRegistered(){
return ServerApiUtils.isImsConnected();
}
|
Returns true if the service is registered to the platform, else returns false
|
@Override public void insertNormalPrologue(){
PhysicalRegisterSet phys=(PhysicalRegisterSet)ir.regpool.getPhysicalRegisterSet();
Register ESP=phys.getESP();
MemoryOperand fpHome=MemoryOperand.BD(ir.regpool.makeTROp(),ArchEntrypoints.framePointerField.getOffset(),(byte)WORDSIZE,null,null);
Instruction plg=ir.firstInstructionInCodeOrder().nextInstructionInCodeOrder();
Instruction inst=plg.nextInstructionInCodeOrder();
int frameFixedSize=getFrameFixedSize();
ir.compiledMethod.setFrameFixedSize(frameFixedSize);
if (frameFixedSize >= 256) {
insertBigFrameStackOverflowCheck(plg);
inst.insertBefore(MIR_UnaryNoRes.create(IA32_PUSH,fpHome));
inst.insertBefore(MIR_Move.create(IA32_MOV,fpHome.copy(),new RegisterOperand(ESP,PRIMITIVE_TYPE_FOR_WORD)));
int cmid=ir.compiledMethod.getId();
inst.insertBefore(MIR_UnaryNoRes.create(IA32_PUSH,VM.BuildFor32Addr ? IC(cmid) : LC(cmid)));
}
else {
inst.insertBefore(MIR_UnaryNoRes.create(IA32_PUSH,fpHome));
inst.insertBefore(MIR_Move.create(IA32_MOV,fpHome.copy(),new RegisterOperand(ESP,PRIMITIVE_TYPE_FOR_WORD)));
int cmid=ir.compiledMethod.getId();
inst.insertBefore(MIR_UnaryNoRes.create(IA32_PUSH,VM.BuildFor32Addr ? IC(cmid) : LC(cmid)));
insertNormalStackOverflowCheck(plg);
}
if (ir.compiledMethod.isSaveVolatile()) {
saveVolatiles(inst);
saveFloatingPointState(inst);
}
saveNonVolatiles(inst);
}
|
Insert the prologue for a normal method. Assume we are inserting the prologue for method B called from method A. <ul> <li> Perform a stack overflow check. <li> Store a back pointer to A's frame <li> Store B's compiled method id <li> Adjust frame pointer to point to B's frame <li> Save any used non-volatile registers </ul>
|
public BaseCheckBox(SafeHtml label,Direction dir){
this();
setHTML(label,dir);
}
|
Creates a check box with the specified text label.
|
public boolean isAcctSchemaElement(String segmentType){
return getAcctSchemaElement(segmentType) != null;
}
|
Has AcctSchema Element
|
public JSONArray put(Object value){
this.myArrayList.add(value);
return this;
}
|
Append an object value. This increases the array's length by one.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 15:00:47.300 -0400",hash_original_method="E35E96FBBA5328024F5002F5E092C0FA",hash_generated_method="1A0885D5DE908CF5CF99681124D5053A") @Override public Enumeration<URL> findResources(final String name) throws IOException {
if (name == null) {
return null;
}
ArrayList<URL> result=new ArrayList<URL>();
int n=0;
while (true) {
URLHandler handler=getHandler(n++);
if (handler == null) {
break;
}
handler.findResources(name,result);
}
return Collections.enumeration(result);
}
|
Returns all known URLs which point to the specified resource.
|
public void flushBase64() throws java.io.IOException {
if (position > 0) {
if (encode) {
out.write(encode3to4(b4,buffer,position,options));
position=0;
}
else {
throw new java.io.IOException("Base64 input not properly padded.");
}
}
}
|
Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without closing the stream.
|
public static ReferenceElement.ReferenceElementResult parseBuiltInType(PsiBuilder builder){
PsiBuilder.Marker arrMarker=builder.mark();
ParserUtils.eatElement(builder,GroovyElementTypes.BUILT_IN_TYPE);
if (GroovyTokenTypes.mLBRACK.equals(builder.getTokenType())) {
declarationBracketsParse(builder,arrMarker);
}
else {
arrMarker.drop();
}
return ReferenceElement.ReferenceElementResult.REF_WITH_TYPE_PARAMS;
}
|
For built-in types
|
public CreateSessionRequestBuilder(final String requestUrl,final IOneDriveClient client,final List<Option> options,final ChunkedUploadSessionDescriptor item){
super(requestUrl,client,options,item);
}
|
The request builder for this CreateSession
|
private GlowTask schedule(GlowTask task){
tasks.put(task.getTaskId(),task);
return task;
}
|
Schedules the specified task.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:32:24.602 -0500",hash_original_method="004FDF3B00128708010F53C563B52195",hash_generated_method="2FE4F18604C14FE634FC58F7E4689B4F") public void loadHeadersFromResource(int resid,List<Header> target){
XmlResourceParser parser=null;
try {
parser=getResources().getXml(resid);
AttributeSet attrs=Xml.asAttributeSet(parser);
int type;
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
}
String nodeName=parser.getName();
if (!"preference-headers".equals(nodeName)) {
throw new RuntimeException("XML document must start with <preference-headers> tag; found" + nodeName + " at "+ parser.getPositionDescription());
}
Bundle curBundle=null;
final int outerDepth=parser.getDepth();
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
continue;
}
nodeName=parser.getName();
if ("header".equals(nodeName)) {
Header header=new Header();
TypedArray sa=getResources().obtainAttributes(attrs,com.android.internal.R.styleable.PreferenceHeader);
header.id=sa.getResourceId(com.android.internal.R.styleable.PreferenceHeader_id,(int)HEADER_ID_UNDEFINED);
TypedValue tv=sa.peekValue(com.android.internal.R.styleable.PreferenceHeader_title);
if (tv != null && tv.type == TypedValue.TYPE_STRING) {
if (tv.resourceId != 0) {
header.titleRes=tv.resourceId;
}
else {
header.title=tv.string;
}
}
tv=sa.peekValue(com.android.internal.R.styleable.PreferenceHeader_summary);
if (tv != null && tv.type == TypedValue.TYPE_STRING) {
if (tv.resourceId != 0) {
header.summaryRes=tv.resourceId;
}
else {
header.summary=tv.string;
}
}
tv=sa.peekValue(com.android.internal.R.styleable.PreferenceHeader_breadCrumbTitle);
if (tv != null && tv.type == TypedValue.TYPE_STRING) {
if (tv.resourceId != 0) {
header.breadCrumbTitleRes=tv.resourceId;
}
else {
header.breadCrumbTitle=tv.string;
}
}
tv=sa.peekValue(com.android.internal.R.styleable.PreferenceHeader_breadCrumbShortTitle);
if (tv != null && tv.type == TypedValue.TYPE_STRING) {
if (tv.resourceId != 0) {
header.breadCrumbShortTitleRes=tv.resourceId;
}
else {
header.breadCrumbShortTitle=tv.string;
}
}
header.iconRes=sa.getResourceId(com.android.internal.R.styleable.PreferenceHeader_icon,0);
header.fragment=sa.getString(com.android.internal.R.styleable.PreferenceHeader_fragment);
sa.recycle();
if (curBundle == null) {
curBundle=new Bundle();
}
final int innerDepth=parser.getDepth();
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > innerDepth)) {
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
continue;
}
String innerNodeName=parser.getName();
if (innerNodeName.equals("extra")) {
getResources().parseBundleExtra("extra",attrs,curBundle);
XmlUtils.skipCurrentTag(parser);
}
else if (innerNodeName.equals("intent")) {
header.intent=Intent.parseIntent(getResources(),parser,attrs);
}
else {
XmlUtils.skipCurrentTag(parser);
}
}
if (curBundle.size() > 0) {
header.fragmentArguments=curBundle;
curBundle=null;
}
target.add(header);
}
else {
XmlUtils.skipCurrentTag(parser);
}
}
}
catch ( XmlPullParserException e) {
throw new RuntimeException("Error parsing headers",e);
}
catch ( IOException e) {
throw new RuntimeException("Error parsing headers",e);
}
finally {
if (parser != null) parser.close();
}
}
|
Parse the given XML file as a header description, adding each parsed Header into the target list.
|
public StreamingSound(URL url){
this.url=url;
}
|
A runnable to stream in sound and play it This method does not read in an entire large sound file at one time, but instead reads in smaller chunks as needed.
|
public static void main(String[] args){
ProgressBarDemo demo=new ProgressBarDemo(null);
demo.mainImpl();
}
|
main method allows us to run as a standalone demo.
|
public GradlePluginsRuntimeException(String message){
super(message);
}
|
Creates a new instance.
|
protected boolean storeEventData(@NonNull Collection<ActEvent> eventSet,@NonNull Context context){
throw new UnsupportedOperationException();
}
|
Will be called when there is need for data serialization.
|
public String buildVmFolderPath(){
return String.format("[%s] vm_%s",datastoreName,getId());
}
|
Construct the Vm folder path. [datastore1] vms/vm/vmId
|
private void handleStateBootstrap(InetAddress endpoint){
Collection<Token> tokens;
tokens=getTokensFor(endpoint);
if (logger.isDebugEnabled()) logger.debug("Node {} state bootstrapping, token {}",endpoint,tokens);
if (tokenMetadata.isMember(endpoint)) {
if (!tokenMetadata.isLeaving(endpoint)) logger.info("Node {} state jump to bootstrap",endpoint);
tokenMetadata.removeEndpoint(endpoint);
}
tokenMetadata.addBootstrapTokens(tokens,endpoint);
PendingRangeCalculatorService.instance.update();
tokenMetadata.updateHostId(Gossiper.instance.getHostId(endpoint),endpoint);
}
|
Handle node bootstrap
|
public ScanAndMarkSSO(IBurpExtenderCallbacks callbacks){
this.callbacks=callbacks;
this.helpers=callbacks.getHelpers();
}
|
Create a new HttpMarker.
|
protected static boolean parsePartHeaders(ByteArrayInputStream pduDataStream,PduPart part,int length){
assert (null != pduDataStream);
assert (null != part);
assert (length > 0);
int startPos=pduDataStream.available();
int tempPos=0;
int lastLen=length;
while (0 < lastLen) {
int header=pduDataStream.read();
assert (-1 != header);
lastLen--;
if (header > TEXT_MAX) {
switch (header) {
case PduPart.P_CONTENT_LOCATION:
byte[] contentLocation=parseWapString(pduDataStream,TYPE_TEXT_STRING);
if (null != contentLocation) {
part.setContentLocation(contentLocation);
}
tempPos=pduDataStream.available();
lastLen=length - (startPos - tempPos);
break;
case PduPart.P_CONTENT_ID:
byte[] contentId=parseWapString(pduDataStream,TYPE_QUOTED_STRING);
if (null != contentId) {
part.setContentId(contentId);
}
tempPos=pduDataStream.available();
lastLen=length - (startPos - tempPos);
break;
case PduPart.P_DEP_CONTENT_DISPOSITION:
case PduPart.P_CONTENT_DISPOSITION:
Resources resources=Resources.getSystem();
int id=resources.getIdentifier("config_mms_content_disposition_support","boolean","android");
Log.w("PduParser","config_mms_content_disposition_support ID: " + id);
boolean contentDisposition=(id != 0) && (resources.getBoolean(id));
Log.w("PduParser","Content Disposition supported: " + contentDisposition);
if (contentDisposition) {
int len=parseValueLength(pduDataStream);
pduDataStream.mark(1);
int thisStartPos=pduDataStream.available();
int thisEndPos=0;
int value=pduDataStream.read();
if (value == PduPart.P_DISPOSITION_FROM_DATA) {
part.setContentDisposition(PduPart.DISPOSITION_FROM_DATA);
}
else if (value == PduPart.P_DISPOSITION_ATTACHMENT) {
part.setContentDisposition(PduPart.DISPOSITION_ATTACHMENT);
}
else if (value == PduPart.P_DISPOSITION_INLINE) {
part.setContentDisposition(PduPart.DISPOSITION_INLINE);
}
else {
pduDataStream.reset();
part.setContentDisposition(parseWapString(pduDataStream,TYPE_TEXT_STRING));
}
thisEndPos=pduDataStream.available();
if (thisStartPos - thisEndPos < len) {
value=pduDataStream.read();
if (value == PduPart.P_FILENAME) {
part.setFilename(parseWapString(pduDataStream,TYPE_TEXT_STRING));
}
thisEndPos=pduDataStream.available();
if (thisStartPos - thisEndPos < len) {
int last=len - (thisStartPos - thisEndPos);
byte[] temp=new byte[last];
pduDataStream.read(temp,0,last);
}
}
tempPos=pduDataStream.available();
lastLen=length - (startPos - tempPos);
}
break;
default :
if (LOCAL_LOGV) {
Log.v(LOG_TAG,"Not supported Part headers: " + header);
}
if (-1 == skipWapValue(pduDataStream,lastLen)) {
Log.e(LOG_TAG,"Corrupt Part headers");
return false;
}
lastLen=0;
break;
}
}
else if ((header >= TEXT_MIN) && (header <= TEXT_MAX)) {
byte[] tempHeader=parseWapString(pduDataStream,TYPE_TEXT_STRING);
byte[] tempValue=parseWapString(pduDataStream,TYPE_TEXT_STRING);
if (true == PduPart.CONTENT_TRANSFER_ENCODING.equalsIgnoreCase(new String(tempHeader))) {
part.setContentTransferEncoding(tempValue);
}
tempPos=pduDataStream.available();
lastLen=length - (startPos - tempPos);
}
else {
if (LOCAL_LOGV) {
Log.v(LOG_TAG,"Not supported Part headers: " + header);
}
if (-1 == skipWapValue(pduDataStream,lastLen)) {
Log.e(LOG_TAG,"Corrupt Part headers");
return false;
}
lastLen=0;
}
}
if (0 != lastLen) {
Log.e(LOG_TAG,"Corrupt Part headers");
return false;
}
return true;
}
|
Parse part's headers.
|
public void finishActivity(Activity activity){
if (activity != null) {
activityStack.remove(activity);
activity.finish();
activity=null;
}
}
|
finish the Activity
|
public void erasePurchase(String sku){
if (mPurchaseMap.containsKey(sku)) mPurchaseMap.remove(sku);
}
|
Erase a purchase (locally) from the inventory, given its product ID. This just modifies the Inventory object locally and has no effect on the server! This is useful when you have an existing Inventory object which you know to be up to date, and you have just consumed an item successfully, which means that erasing its purchase data from the Inventory you already have is quicker than querying for a new Inventory.
|
@Override @Transient public boolean isFullTextSearchable(){
return true;
}
|
Override the gisFeature value.<br> Default to true;<br> If this field is set to false, then the object won't be synchronized with the fullText search engine
|
private boolean isStreamOpenLocation(Location location){
return streamOpenLocationMap.get(location) != null;
}
|
Determine if given Location is a stream open location point.
|
@Override public boolean eIsSet(int featureID){
switch (featureID) {
case TypesPackage.PACKAGE__MEMBER:
return member != null && !member.isEmpty();
case TypesPackage.PACKAGE__DOMAIN:
return domain != null;
case TypesPackage.PACKAGE__IMPORT:
return import_ != null && !import_.isEmpty();
}
return super.eIsSet(featureID);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
@Deprecated static public DCCppEthernetAdapter instance(){
if (mInstance == null) {
mInstance=new DCCppEthernetAdapter();
}
return mInstance;
}
|
Local method to do specific configuration
|
public static void showToast(Context context,String msg){
Toast.makeText(context,msg,Toast.LENGTH_LONG).show();
}
|
Shows a (long) toast
|
public MonitoredItemNotification clone(){
MonitoredItemNotification result=new MonitoredItemNotification();
result.ClientHandle=ClientHandle;
result.Value=Value;
return result;
}
|
Deep clone
|
public String checkOnHand(Properties ctx,int WindowNo,GridTab mTab,GridField mField,Object value){
I_M_InventoryLine line=GridTabWrapper.create(mTab,I_M_InventoryLine.class);
if (line.getM_Product_ID() == 0) return "";
if (line.getM_Product().isStocked() && line.getQtyInternalUse().signum() > 0) {
BigDecimal qtyInternalUse=line.getQtyInternalUse();
BigDecimal qtyOnHand=DB.getSQLValueBD(null,"SELECT bomQtyOnHand(M_Product_ID,?,?) FROM M_Product WHERE M_Product_ID=?",line.getM_Inventory().getM_Warehouse_ID(),0,line.getM_Product_ID());
if (qtyOnHand == null) qtyOnHand=Env.ZERO;
if (qtyOnHand.signum() == 0) mTab.fireDataStatusEEvent("NoQtyAvailable","0",false);
else if (qtyOnHand.compareTo(qtyInternalUse) < 0) mTab.fireDataStatusEEvent("InsufficientQtyAvailable",qtyOnHand.toString(),false);
}
return "";
}
|
Check if of qty Onhand
|
public String outerClass(int nth){
int i=outerClassIndex(nth);
if (i == 0) return null;
else return constPool.getClassInfo(i);
}
|
Returns the class name indicated by <code>classes[nth].outer_class_info_index</code>.
|
public int timePassed(){
return (int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
}
|
Returns the time elapsed since the beginning of the scrolling.
|
public Task<Void> handleRegistrationIntentAsync(Intent intent){
List<Task<Void>> tasks=new ArrayList<>();
String registrationId=intent.getStringExtra(REGISTRATION_ID_EXTRA);
if (registrationId != null && registrationId.length() > 0) {
PLog.v(TAG,"Received deviceToken <" + registrationId + "> from GCM.");
ParseInstallation installation=ParseInstallation.getCurrentInstallation();
if (!registrationId.equals(installation.getDeviceToken())) {
installation.setPushType(PushType.GCM);
installation.setDeviceToken(registrationId);
tasks.add(installation.saveInBackground());
}
tasks.add(updateLocalDeviceTokenLastModifiedAsync());
}
synchronized (lock) {
if (request != null) {
request.onReceiveResponseIntent(intent);
}
}
return Task.whenAll(tasks);
}
|
Should be called by a broadcast receiver or service to handle the GCM registration response intent (com.google.android.c2dm.intent.REGISTRATION).
|
public DefaultRetryPolicy(int initialTimeoutMs,int maxNumRetries,float backoffMultiplier){
mCurrentTimeoutMs=initialTimeoutMs;
mMaxNumRetries=maxNumRetries;
mBackoffMultiplier=backoffMultiplier;
}
|
Constructs a new retry policy.
|
public static boolean compareSignatures(Method first,Method second){
if (first.getName().equals(second.getName()) == false) {
return false;
}
return compareParameters(first.getParameterTypes(),second.getParameterTypes());
}
|
Compares method signatures: names and parameters.
|
@Override public void declareExtensions(ExtensionProfile extProfile){
extProfile.declare(ContactEntry.class,Email.getDefaultDescription());
extProfile.declare(ContactEntry.class,Im.getDefaultDescription(false,true));
extProfile.declare(ContactEntry.class,PhoneNumber.getDefaultDescription());
extProfile.declare(ContactEntry.class,PostalAddress.getDefaultDescription());
extProfile.declare(ContactEntry.class,Organization.getDefaultDescription(false,false));
extProfile.declare(ContactEntry.class,GeoPt.getDefaultDescription());
extProfile.declare(ContactEntry.class,Deleted.class);
}
|
Initializes an ExtensionProfile based upon the extensions expected by an ContactEntry.
|
public void updateItem(int identifier){
if (mDrawer != null && mDrawerAdapter != null && mDrawerAdapter.getDrawerItems() != null && identifier != -1) {
IDrawerItem drawerItem=DrawerUtils.getDrawerItem(getDrawerItems(),identifier);
for (int i=0; i < mDrawerAdapter.getDrawerItems().size(); i++) {
if (mDrawerAdapter.getDrawerItems().get(i).getIdentifier() == drawerItem.getIdentifier()) {
IDrawerItem miniDrawerItem=generateMiniDrawerItem(drawerItem);
if (miniDrawerItem != null) {
mDrawerAdapter.setDrawerItem(i,miniDrawerItem);
}
}
}
}
}
|
update a MiniDrawerItem (after updating the main Drawer) via its identifier
|
public void putFloat(String key,float value){
map.put(key,value);
}
|
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key.
|
public boolean hasMouseLock(){
return false;
}
|
Returns true if this platform supports mouse locking. The user may still block it when it is requested, or detection may be broken for some browsers.
|
public SoftInputWindow(Context context,int theme,KeyEvent.DispatcherState dispatcherState){
super(context,theme);
mDispatcherState=dispatcherState;
initDockWindow();
}
|
Create a SoftInputWindow that uses a custom style.
|
@SmallTest public void testPreconditions(){
}
|
The name 'test preconditions' is a convention to signal that if this test doesn't pass, the test case was not set up properly and it might explain any and all failures in other tests. This is not guaranteed to run before other tests, as junit uses reflection to find the tests.
|
public static List<Object> mergeLists(final List<Object> col1,final List<Object> col2){
final List<Object> m=new ArrayList<>();
m.addAll(col1);
m.addAll(col2);
return m;
}
|
Merges to lists into one.
|
public static <T>TopResults<T> shortestPaths(FST<T> fst,FST.Arc<T> fromNode,T startOutput,Comparator<T> comparator,int topN,boolean allowEmptyString) throws IOException {
TopNSearcher<T> searcher=new TopNSearcher<>(fst,topN,topN,comparator);
searcher.addStartPaths(fromNode,startOutput,allowEmptyString,new IntsRefBuilder());
return searcher.search();
}
|
Starting from node, find the top N min cost completions to a final node.
|
public HistogramResult run(Database database,Relation<O> relation){
final DistanceQuery<O> distanceQuery=database.getDistanceQuery(relation,getDistanceFunction());
final KNNQuery<O> knnQuery=database.getKNNQuery(distanceQuery,relation.size());
if (LOG.isVerbose()) {
LOG.verbose("Preprocessing clusters...");
}
Collection<Cluster<Model>> split=(new ByLabelOrAllInOneClustering()).run(database).getAllClusters();
DoubleStaticHistogram hist=new DoubleStaticHistogram(numbins,0.0,1.0);
if (LOG.isVerbose()) {
LOG.verbose("Processing points...");
}
FiniteProgress progress=LOG.isVerbose() ? new FiniteProgress("Computing ROC AUC values",relation.size(),LOG) : null;
MeanVariance mv=new MeanVariance();
for ( Cluster<?> clus : split) {
for (DBIDIter iter=clus.getIDs().iter(); iter.valid(); iter.advance()) {
KNNList knn=knnQuery.getKNNForDBID(iter,relation.size());
double result=new ROCEvaluation().evaluate(clus,knn);
mv.put(result);
hist.increment(result,1. / relation.size());
LOG.incrementProcessed(progress);
}
}
LOG.ensureCompleted(progress);
Collection<double[]> res=new ArrayList<>(relation.size());
for (DoubleStaticHistogram.Iter iter=hist.iter(); iter.valid(); iter.advance()) {
res.add(new double[]{iter.getCenter(),iter.getValue()});
}
HistogramResult result=new HistogramResult("Ranking Quality Histogram","ranking-histogram",res);
result.addHeader("Mean: " + mv.getMean() + " Variance: "+ mv.getSampleVariance());
return result;
}
|
Process a database
|
public boolean isHealthy(boolean doExtensiveChecks){
if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) {
return false;
}
if (framedConnection != null) {
return true;
}
if (doExtensiveChecks) {
try {
int readTimeout=socket.getSoTimeout();
try {
socket.setSoTimeout(1);
if (source.exhausted()) {
return false;
}
return true;
}
finally {
socket.setSoTimeout(readTimeout);
}
}
catch ( SocketTimeoutException ignored) {
}
catch ( IOException e) {
return false;
}
}
return true;
}
|
Returns true if this connection is ready to host new streams.
|
public ImmutableArray(final boolean ordered,final Type[] array,final int start,final int count){
super(ordered,array,start,count);
}
|
Creates a new array containing the elements in the specified array. The new array will have the same type of backing array.
|
private boolean isInputValid(){
if (nameBox.getText().isEmpty()) {
return false;
}
if (ipBox.getText().isEmpty()) {
return false;
}
if (portBox.getText().isEmpty()) {
return false;
}
else {
try {
Integer.parseInt(portBox.getText());
}
catch ( NumberFormatException e) {
return false;
}
}
return true;
}
|
Is input in textual boxes valid.
|
public void shear(float x,float y){
impl.shear(nativeGraphics,x,y);
}
|
Shear the graphics coordinate system using the affine transform
|
public JListData(java.awt.Frame parent){
super(parent,true);
initComponents();
getRootPane().setDefaultButton(m_jOK);
}
|
Creates new form JListData
|
public void replaceWithLocal(CustomElementCollection other){
values.clear();
values.putAll(other.values);
}
|
Locally clears all existing values and copies the contents of the other element collection over.
|
@DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:26.624 -0500",hash_original_method="B3310D4E2482FAA9B08EEBCB55A9E59A",hash_generated_method="9B7D670C9DC0EB16FE01142237FB60EC") public Point createFromParcel(Parcel in){
Point r=new Point();
r.readFromParcel(in);
return r;
}
|
Return a new point from the data in the specified parcel.
|
public static int dp2px(Context context,float dp){
float px=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,context.getResources().getDisplayMetrics());
return Math.round(px);
}
|
Convert a dp float value to pixels
|
public void javacError(String message,Throwable t){
messager.printMessage(Diagnostic.Kind.ERROR,message + (t == null ? "" : (": " + t)));
if (t != null) t.printStackTrace();
}
|
Generates an error in the Messager that was used to initialize this HandlerLibrary.
|
public boolean intersects(double x,double y,double w,double h){
return contains(x,y) || contains(x + w,y) || contains(x,y + h)|| contains(x + w,y + h);
}
|
Returns true, if at least one of the points is contained by the shape.
|
public boolean repOK(){
assert topGraphsForTopInvocation();
return true;
}
|
This method checks invariants for this class. Named after shorthand for "internal representation is ok".
|
public void testMultipleDriverPropertiesDelimitedBySemiColon(){
Properties driverProperties=new Properties();
driverProperties.setProperty("user","APP");
driverProperties.setProperty("CreateDatabase","create");
String driverPropertyString="user=APP;CreateDatabase=create";
String propertyString=DatasourcePropertySet.CONNECTION_PROPERTIES + "=" + driverPropertyString;
DataSource ds=dataSourceConverter.fromPropertyString(propertyString);
assertEquals(driverProperties,ds.getConnectionProperties());
}
|
Test the setting of multiple properties delimited by a semicolon.
|
private void $$$setupUI$$$(){
createUIComponents();
contentPanel=new JPanel();
contentPanel.setLayout(new GridLayoutManager(9,4,new Insets(0,0,0,0),-1,-1));
sourceBranchLabel=new JLabel();
this.$$$loadLabelText$$$(sourceBranchLabel,ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CreatePullRequestDialog.SourceBranchLabel"));
contentPanel.add(sourceBranchLabel,new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_NONE,GridConstraints.SIZEPOLICY_FIXED,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
titleLabel=new JLabel();
this.$$$loadLabelText$$$(titleLabel,ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CreatePullRequestDialog.TitleLabel"));
contentPanel.add(titleLabel,new GridConstraints(4,0,1,1,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_NONE,GridConstraints.SIZEPOLICY_FIXED,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
descriptionLabel=new JLabel();
this.$$$loadLabelText$$$(descriptionLabel,ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CreatePullRequestDialog.DescriptionLabel"));
contentPanel.add(descriptionLabel,new GridConstraints(6,0,1,1,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_NONE,GridConstraints.SIZEPOLICY_FIXED,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
titleTextField=new JTextField();
contentPanel.add(titleTextField,new GridConstraints(5,0,1,4,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_HORIZONTAL,GridConstraints.SIZEPOLICY_WANT_GROW,GridConstraints.SIZEPOLICY_FIXED,null,new Dimension(150,-1),null,0,false));
targetBranchLabel=new JLabel();
this.$$$loadLabelText$$$(targetBranchLabel,ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CreatePullRequestDialog.TargetBranchLabel"));
contentPanel.add(targetBranchLabel,new GridConstraints(1,0,1,1,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_NONE,GridConstraints.SIZEPOLICY_FIXED,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
contentPanel.add(targetBranchDropdown,new GridConstraints(2,0,1,4,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_HORIZONTAL,GridConstraints.SIZEPOLICY_CAN_GROW,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
sourceBranch=new JLabel();
sourceBranch.setText("");
contentPanel.add(sourceBranch,new GridConstraints(0,1,1,2,GridConstraints.ANCHOR_WEST,GridConstraints.FILL_NONE,GridConstraints.SIZEPOLICY_WANT_GROW,GridConstraints.SIZEPOLICY_FIXED,null,null,null,0,false));
splitPane=new JSplitPane();
splitPane.setOrientation(0);
contentPanel.add(splitPane,new GridConstraints(7,0,1,4,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH,GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,null,new Dimension(200,200),null,0,false));
descriptionScrollPane=new JScrollPane();
splitPane.setLeftComponent(descriptionScrollPane);
descriptionTextArea=new JTextArea();
descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);
descriptionScrollPane.setViewportView(descriptionTextArea);
final JPanel panel1=new JPanel();
panel1.setLayout(new GridLayoutManager(2,1,new Insets(0,0,0,0),-1,-1));
splitPane.setRightComponent(panel1);
quickDiffPane=new JTabbedPane();
panel1.add(quickDiffPane,new GridConstraints(1,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH,GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,null,new Dimension(200,200),null,0,false));
spinnerPanel=new JPanel();
spinnerPanel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
panel1.add(spinnerPanel,new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH,GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,1,null,null,null,0,false));
spinner=new BusySpinnerPanel();
spinnerPanel.add(spinner);
loadingLabel=new JLabel();
this.$$$loadLabelText$$$(loadingLabel,ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CreatePullRequestDialog.LoadingDiffLabel"));
spinnerPanel.add(loadingLabel);
}
|
Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
|
public boolean hasActionAtTime(long eventTime){
return !((mStartTime == -1) || (mStartTime > eventTime)) && !((mFinishTime >= mStartTime) && (mFinishTime < eventTime));
}
|
Returns whether the specified event time falls between the start and finish times of the last paste action.
|
public static boolean write(Writer writer,Object toSerialize) throws Exception {
Class<?> xstreamClass;
java.lang.reflect.Constructor<?> constructor;
Object xstream;
Class<?>[] serializeArgsClasses=new Class[2];
Object[] serializeArgs=new Object[2];
java.lang.reflect.Method methodSerialize;
boolean result=false;
xstreamClass=Class.forName("com.thoughtworks.xstream.XStream");
constructor=xstreamClass.getConstructor();
xstream=constructor.newInstance();
serializeArgsClasses[0]=Object.class;
serializeArgsClasses[1]=Writer.class;
serializeArgs[0]=toSerialize;
serializeArgs[1]=writer;
methodSerialize=xstreamClass.getMethod("toXML",serializeArgsClasses);
try {
methodSerialize.invoke(xstream,serializeArgs);
result=true;
}
catch ( Exception ex) {
result=false;
}
return result;
}
|
writes the XML-serialized object to the given Writer.
|
public void decided(Decision dec){
dec.setRegency(syncher.getLCManager().getLastReg());
dec.setLeader(execManager.getCurrentLeader());
this.dt.delivery(dec);
}
|
Called by the current consensus instance, to notify the TOM layer that a value was decided
|
protected void fireStartEntity(String name) throws org.xml.sax.SAXException {
if (m_tracer != null) {
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF,name);
}
}
|
To fire off start entity trace event
|
public boolean saveAsKML(File file){
try {
Log.d(BonusPackHelper.LOG_TAG,"Saving " + file.getAbsolutePath());
OutputStreamWriter out=new OutputStreamWriter(new FileOutputStream(file),"UTF-8");
BufferedWriter writer=new BufferedWriter(out,8192);
boolean result=saveAsKML(writer);
writer.close();
Log.d(BonusPackHelper.LOG_TAG,"Saved.");
return result;
}
catch ( IOException e) {
e.printStackTrace();
return false;
}
}
|
Save the document as a KML file
|
public static CompleteMultipartUploadResult parseCompleteMultipartUpload(InputStream responseBody) throws ResponseParseException {
try {
Element root=getXmlRootElement(responseBody);
CompleteMultipartUploadResult result=new CompleteMultipartUploadResult();
result.setBucketName(root.getChildText("Bucket"));
result.setETag(trimQuotes(root.getChildText("ETag")));
result.setKey(root.getChildText("Key"));
result.setLocation(root.getChildText("Location"));
return result;
}
catch ( Exception e) {
throw new ResponseParseException(e.getMessage(),e);
}
}
|
Unmarshall complete multipart upload response body to corresponding result.
|
public boolean nextPage() throws SQLException {
throw new UnsupportedOperationException();
}
|
The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object containing the number of rows specified by page size.
|
public static String deserializeString(byte[] buffer,MutableInt offset){
int length=deserializeInt(buffer,offset);
String val=new String(buffer,offset.intValue(),length);
offset.add(length);
return val;
}
|
This method deserializes a string from the given byte array from the given offset, and increments the offset appropriately.
|
public void prepareMatrixOffset(boolean inverted){
mMatrixOffset.reset();
if (!inverted) mMatrixOffset.postTranslate(mViewPortHandler.offsetLeft(),mViewPortHandler.getChartHeight() - mViewPortHandler.offsetBottom());
else {
mMatrixOffset.setTranslate(mViewPortHandler.offsetLeft(),-mViewPortHandler.offsetTop());
mMatrixOffset.postScale(1.0f,-1.0f);
}
}
|
Prepares the matrix that contains all offsets.
|
public TestChromosome generateNewTest(final TestChromosome test,Set<Integer> statementIndexes,LocalSearchObjective<TestChromosome> objective){
logger.info("APPLYING DSE EEEEEEEEEEEEEEEEEEEEEEE");
logger.info(test.getTestCase().toCode());
logger.info("Starting concolic execution");
test.clone();
DefaultTestCase clone_test_case=(DefaultTestCase)test.getTestCase().clone();
List<BranchCondition> branchConditions=ConcolicExecution.executeConcolic(clone_test_case);
final PathCondition collectedPathCondition=new PathCondition(branchConditions);
logger.info("Done concolic execution");
if (collectedPathCondition.isEmpty()) {
return null;
}
for ( BranchCondition c : collectedPathCondition.getBranchConditions()) {
logger.info(" -> " + c.getConstraint());
}
Set<VariableReference> symbolicVariables=new HashSet<VariableReference>();
for ( Integer position : statementIndexes) {
final VariableReference variableReference=test.getTestCase().getStatement(position).getReturnValue();
symbolicVariables.add(variableReference);
}
logger.info("Checking {} conditions",collectedPathCondition.size());
List<Integer> conditionIndexesNotCoveredTwoWays=computeConditionIndexesNotCoveredTwoWays(test,collectedPathCondition);
for (int conditionIndex=0; conditionIndex < collectedPathCondition.size(); conditionIndex++) {
BranchCondition condition=collectedPathCondition.get(conditionIndex);
if (LocalSearchBudget.getInstance().isFinished()) {
logger.debug("Local search budget used up: " + Properties.LOCAL_SEARCH_BUDGET_TYPE);
break;
}
logger.debug("Local search budget not yet used up");
if (!conditionIndexesNotCoveredTwoWays.contains(conditionIndex)) {
continue;
}
logger.info("Current condition: " + conditionIndex + "/"+ collectedPathCondition.size()+ ": "+ condition.getConstraint());
Constraint<?> currentConstraint=condition.getConstraint();
if (!isRelevant(currentConstraint,symbolicVariables)) {
logger.info("Is not relevant for " + symbolicVariables);
continue;
}
logger.info("Is relevant for " + symbolicVariables);
List<Constraint<?>> query=buildQuery(collectedPathCondition,conditionIndex);
logger.info("Trying to solve: ");
for ( Constraint<?> c : query) {
logger.info(" " + c);
}
DSEStats.getInstance().reportNewConstraints(query);
Solver solver=SolverFactory.getInstance().buildNewSolver();
long startSolvingTime=System.currentTimeMillis();
SolverCache solverCache=SolverCache.getInstance();
SolverResult solverResult=solverCache.solve(solver,query);
long estimatedSolvingTime=System.currentTimeMillis() - startSolvingTime;
DSEStats.getInstance().reportNewSolvingTime(estimatedSolvingTime);
if (solverResult == null) {
logger.info("Found no result");
}
else if (solverResult.isUNSAT()) {
logger.info("Found UNSAT result");
DSEStats.getInstance().reportNewUNSAT();
}
else {
logger.info("Found SAT result");
DSEStats.getInstance().reportNewSAT();
Map<String,Object> model=solverResult.getModel();
TestCase oldTest=test.getTestCase();
ExecutionResult oldResult=test.getLastExecutionResult().clone();
TestCase newTest=updateTest(oldTest,model);
logger.info("New test: " + newTest.toCode());
test.setTestCase(newTest);
test.clearCachedResults();
if (objective.hasImproved(test)) {
DSEStats.getInstance().reportNewTestUseful();
logger.info("Solution improves fitness, finishing DSE");
return test;
}
else {
DSEStats.getInstance().reportNewTestUnuseful();
test.setTestCase(oldTest);
if (oldResult != null) test.setLastExecutionResult(oldResult);
}
}
}
return null;
}
|
Applies DSE to the passed test using as symbolic variables only those that are declared in the set of statement indexes. The objective is used to detect if the DSE has improved the fitness.
|
public void updatePoly(int[] xpoints,int[] ypoints,LinkProperties properties,int graphicUpdateMask) throws IOException {
writeGraphicGestureHeader(graphicUpdateMask);
LinkPoly.write(xpoints,ypoints,properties,link.dos);
}
|
Write a poly in the response.
|
@Override public Adapter createAdapter(Notifier target){
return modelSwitch.doSwitch((EObject)target);
}
|
Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
|
public IMethod findDeclaringMethod(IMethod overriding,boolean testVisibility) throws JavaModelException {
IMethod result=null;
IMethod overridden=findOverriddenMethod(overriding,testVisibility);
while (overridden != null) {
result=overridden;
overridden=findOverriddenMethod(result,testVisibility);
}
return result;
}
|
Finds the method that declares the given method. A declaring method is the 'original' method declaration that does not override nor implement a method. <code>null</code> is returned it the given method does not override a method. When searching, super class are examined before implemented interfaces.
|
public IllegalBinaryStateDialog(final IllegalBinaryStateException cause){
this(cause,cause.getBinary().getLabel() + " Configuration Error",cause.getMessage());
}
|
Creates a new dialog instance with the given illegal binary state exception.
|
public boolean retainAll(long[] array){
Arrays.sort(array);
long[] set=_set;
byte[] states=_states;
boolean changed=false;
for (int i=set.length; i-- > 0; ) {
if (states[i] == FULL && Arrays.binarySearch(array,set[i]) < 0) {
remove(set[i]);
changed=true;
}
}
return changed;
}
|
Removes any values in the set which are not contained in <tt>array</tt>.
|
public SynchronizedProtocolEncoder(ProtocolEncoder encoder){
if (encoder == null) {
throw new IllegalArgumentException("encoder");
}
this.encoder=encoder;
}
|
Creates a new instance which decorates the specified <tt>encoder</tt>.
|
public static ReilInstruction createAdd(final Address address,final ReilOperand firstOperand,final ReilOperand secondOperand,final ReilOperand thirdOperand){
return new ReilInstruction(address,ReilMnemonics.ADD,firstOperand,secondOperand,thirdOperand);
}
|
Creates a new ADD instruction.
|
public T caseBindingProperty(BindingProperty object){
return null;
}
|
Returns the result of interpreting the object as an instance of '<em>Binding Property</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
|
public static <E extends Comparable<E>>void quickSort(InplaceList<E> array){
if (array.isEmpty()) {
return;
}
recursiveQuickSort(array,0,array.size() - 1);
}
|
Sorts given array using QuickSort
|
public boolean canTick(){
return canTick;
}
|
Should the gas run a tick on every player in it? Calls onTick(EntityLiving base)
|
private int encryptColumnContents(String columnName,int tableID) throws Exception {
String tableName=MTable.getTableName(getCtx(),tableID);
return encryptColumnContents(columnName,tableName);
}
|
Encrypt all the contents of a database column.
|
@NotNull public static SqlQuery namedQuery(@NotNull @SQL String sql,@NotNull Object bean){
return namedQuery(sql,VariableResolver.forBean(bean));
}
|
Constructs a query with named arguments, using the properties/fields of given bean for resolving arguments.
|
public FileAttribute(String fileName,int fileSize) throws ParameterException {
if (fileName == null || fileName.length() == 0) {
throw new ParameterException("FileAttribute(): Error - invalid file name.");
}
if (fileSize <= 0) {
throw new ParameterException("FileAttribute(): Error - size <= 0.");
}
size=fileSize;
name=fileName;
Date date=CloudSim.getSimulationCalendar().getTime();
if (date == null) {
creationTime=0;
}
else {
creationTime=date.getTime();
}
ownerName=null;
id=File.NOT_REGISTERED;
checksum=0;
type=File.TYPE_UNKOWN;
lastUpdateTime=0;
cost=0;
resourceId=-1;
masterCopy=true;
readOnly=false;
}
|
Creates a new FileAttribute object.
|
public final void send(byte[] data,boolean useMAC) throws InterruptedException {
if (useSenderThread) {
if (!useMAC) {
Logger.println("(ServerConnection.send) Not sending defaultMAC " + System.identityHashCode(data));
noMACs.add(System.identityHashCode(data));
}
if (!outQueue.offer(data)) {
Logger.println("(ServerConnection.send) out queue for " + remoteId + " full (message discarded).");
}
}
else {
sendLock.lock();
sendBytes(data,useMAC);
sendLock.unlock();
}
}
|
Used to send packets to the remote server.
|
protected void drawXLegend(){
float[] position=new float[]{0f,0f};
for (int i=0; i < mData.getXValCount(); i++) {
if (i % mLegendGridModulus == 0) {
position[0]=i;
if (mCenterXLegendText) position[0]+=0.5f;
transformPointArray(position);
if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight + 10) {
mDrawCanvas.drawText(mData.getXVals().get(i),position[0],mOffsetTop - 5,mXLegendPaint);
}
}
}
}
|
draws the x legend to the screen
|
public WrappingStringBuilder wrapWord(final String s){
if (mWrapWidth - mPrefix.length() < 20) {
append(s);
return this;
}
final int available=mWrapWidth - lineLength();
if (s.length() >= available) {
if (lineLength() != mPrefix.length()) {
wrap();
}
appendTrimmed(s);
}
else {
append(s);
}
return this;
}
|
Append a word without breaking it, wrapping first if necessary
|
public static String encodeObject(final java.io.Serializable serializableObject){
return Base64.encodeObject(serializableObject,Base64.NO_OPTIONS);
}
|
Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized or there is another error, the method will return <tt>null</tt>. The object is not GZip-compressed before being encoded.
|
private RPObject findSpell(KeyEvent e){
RPObject player=StendhalClient.get().getPlayer();
Integer position=keyEventMapping.get(e.getKeyCode());
RPSlot slot=player.getSlot("spells");
Integer counter=Integer.valueOf(1);
for ( RPObject spell : slot) {
if (counter.equals(position)) {
return spell;
}
counter=Integer.valueOf(counter.intValue() + 1);
}
return null;
}
|
Find spell corresponding to a key.
|
public LocalDate withDayOfWeek(int dayOfWeek){
return withLocalMillis(getChronology().dayOfWeek().set(getLocalMillis(),dayOfWeek));
}
|
Returns a copy of this date with the day of week field updated. <p> LocalDate is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of week changed.
|
private Colors(){
throw new Error("Do not need instantiate!");
}
|
Don't let anyone instantiate this class.
|
public div addElement(String hashcode,String element){
addElementToRegistry(hashcode,element);
return (this);
}
|
Adds an Element to the element.
|
public CustomLayoutManager(@Orientation int orientation,int itemLineCount){
setOrientation(orientation);
setItemLineCount(itemLineCount);
}
|
init with orientation and itemLineCount
|
private static Outcome parseOutcomeElement(Element outcomeElement){
boolean depleteWeapon=Boolean.valueOf(outcomeElement.getAttribute(OUTCOME_ATTRIBUTE_DEPLETE_WEAPON));
boolean incrementEnemies=Boolean.valueOf(outcomeElement.getAttribute(OUTCOME_ATTRIBUTE_INCREMENT_ENEMIES));
return new Outcome(depleteWeapon,incrementEnemies);
}
|
Creates an Outcome from a DOM Element representing an Outcome.
|
private void verifyAddReplicaToCG(URI blockURI,BlockConsistencyGroup cg,StorageSystem cgStorageSystem){
BlockObject blockObject=BlockObject.fetch(_dbClient,blockURI);
BlockServiceUtils.validateNotAnInternalBlockObject(blockObject,false);
URI sourceVolumeURI=null;
URI blockProjectURI=null;
if (blockObject instanceof BlockSnapshot) {
BlockSnapshot snapshot=(BlockSnapshot)blockObject;
blockProjectURI=snapshot.getProject().getURI();
sourceVolumeURI=snapshot.getParent().getURI();
}
else if (blockObject instanceof BlockMirror) {
BlockMirror mirror=(BlockMirror)blockObject;
blockProjectURI=mirror.getProject().getURI();
sourceVolumeURI=mirror.getSource().getURI();
}
else if (blockObject instanceof Volume) {
Volume volume=(Volume)blockObject;
blockProjectURI=volume.getProject().getURI();
sourceVolumeURI=volume.getAssociatedSourceVolume();
}
Volume sourceVolume=null;
if (!NullColumnValueGetter.isNullURI(sourceVolumeURI)) {
sourceVolume=_dbClient.queryObject(Volume.class,sourceVolumeURI);
}
if (sourceVolume == null || !cg.getId().equals(sourceVolume.getConsistencyGroup())) {
throw APIException.badRequests.invalidParameterSourceVolumeNotInGivenConsistencyGroup(sourceVolumeURI,cg.getId());
}
if (!NullColumnValueGetter.isNullURI(blockObject.getConsistencyGroup()) && !cg.getId().equals(blockObject.getConsistencyGroup())) {
throw APIException.badRequests.invalidParameterVolumeAlreadyInAConsistencyGroup(cg.getId(),blockObject.getConsistencyGroup());
}
URI cgProjectURI=cg.getProject().getURI();
if (!blockProjectURI.equals(cgProjectURI)) {
List<Project> projects=_dbClient.queryObjectField(Project.class,"label",Arrays.asList(cgProjectURI,blockProjectURI));
throw APIException.badRequests.consistencyGroupAddVolumeThatIsInDifferentProject(blockObject.getLabel(),projects.get(0).getLabel(),projects.get(1).getLabel());
}
}
|
Validates the replicas to be added to Consistency group. - verifies that the replicas are not internal objects, - checks if the given CG is its source volume's CG, - validates that the replica is not in any other CG, - verifies the project for the replicas to be added is same as the project for the consistency group.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.