code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public void makeAdditionalChecks(ExampleSetMetaData emd){
}
| Can be implemented by subclasses. |
public void createMonthScenario01CustomerPriceModel() throws Exception {
VendorData supplierData=setupNewSupplier("2012-11-01 12:00:00");
setCutOffDay(supplierData.getAdminKey(),1);
CustomerData customerData=registerCustomerWithDiscount(supplierData,new BigDecimal("25.00"),DateTimeHandling.calculateMillis("2012-12-01 00:00:00"),DateTimeHandling.calculateMillis("2013-01-01 01:00:00"));
VOServiceDetails serviceDetails=createPublishService(supplierData,TestPriceModel.EXAMPLE_PERUNIT_MONTH_ROLES,"SCENARIO01_PU_MONTH_CUST_PM_SERVICE");
VOServiceDetails customerServiceDetails=serviceSetup.savePriceModelForCustomer(serviceDetails,TestPriceModel.EXAMPLE_PERUNIT_MONTH_ROLES_2,customerData.getOrganization());
customerServiceDetails=serviceSetup.activateMarketableService(customerServiceDetails);
VOSubscriptionDetails subDetails=subscribe(customerData.getAdminUser(),"SCENARIO01_PU_MONTH_CUST_PM",customerServiceDetails,"2012-11-15 12:00:00","ADMIN");
unsubscribe(customerData.getAdminKey(),subDetails.getSubscriptionId(),"2013-01-16 12:00:00");
resetCutOffDay(supplierData.getAdminKey());
cacheTestData("SCENARIO01_PU_MONTH_CUST_PM",new TestData(supplierData));
}
| Subscribe to a service from November 2012 until January 2013 (cutoff day is 1, so the subscription goes over 3 billing periods). A specific price model is created for the customer, who has a discount. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:39.057 -0500",hash_original_method="33A03FA36AA2C869C23BC2B48A2B01BF",hash_generated_method="756025D690F3417AC1E320794E486242") private VMRuntime(){
}
| Prevents this class from being instantiated. |
public String trimStringToWidth(String string,int newLength,boolean reverse){
StringBuilder stringbuilder=new StringBuilder();
int width=0;
int k=reverse ? string.length() - 1 : 0;
int l=reverse ? -1 : 1;
boolean flag1=false;
boolean flag2=false;
for (int i1=k; i1 >= 0 && i1 < string.length() && width < newLength; i1+=l) {
char thisChar=string.charAt(i1);
int thisWidth=getCharWidth(thisChar);
if (flag1) {
flag1=false;
if (thisChar != 108 && thisChar != 76) {
if (thisChar == 114 || thisChar == 82) {
flag2=false;
}
}
else {
flag2=true;
}
}
else if (thisWidth < 0) {
flag1=true;
}
else {
width+=thisWidth;
if (flag2) {
++width;
}
}
if (width > newLength) {
break;
}
if (reverse) {
stringbuilder.insert(0,thisChar);
}
else {
stringbuilder.append(thisChar);
}
}
return stringbuilder.toString();
}
| Trims a string to a specified width, and will reverse it if par3 is set. |
public RecyclerDivider(String dividerText,int dividerBGcolor){
this.dividerText=dividerText;
this.dividerBGcolor=dividerBGcolor;
}
| Initialize a RecyclerDivider object with text and background color |
public int put(double key,int value){
int previous=0;
int index=insertionIndex(key);
boolean isNewMapping=true;
if (index < 0) {
index=-index - 1;
previous=_values[index];
isNewMapping=false;
}
byte previousState=_states[index];
_set[index]=key;
_states[index]=FULL;
_values[index]=value;
if (isNewMapping) {
postInsertHook(previousState == FREE);
}
return previous;
}
| Inserts a key/value pair into the map. |
public void computeApproxDominators(IR ir){
DominatorSystem system=new DominatorSystem(ir);
if (DEBUG) {
System.out.print("Solving...");
}
if (DEBUG) {
System.out.println(system);
}
system.solve();
if (DEBUG) {
System.out.println("done");
}
DF_Solution solution=system.getSolution();
if (DEBUG) {
System.out.println("Dominator Solution :" + solution);
}
if (DEBUG) {
System.out.print("Updating blocks ...");
}
updateBlocks(solution);
if (DEBUG) {
System.out.println("done.");
}
if (ir.options.PRINT_DOMINATORS) {
printDominators(ir);
}
}
| Calculate the "approximate" dominators for an IR i.e., the dominators in the factored CFG rather than the normal CFG. <p> (No exception is thrown if the input IR has handler blocks.) |
public AllToAll(){
super();
}
| Construct to all to all connector. |
public static LocalizedResource create(DataService dm,long objKey,LocalizedObjectTypes objectType) throws NonUniqueBusinessKeyException {
return create(dm,objKey,objectType,"Some text for " + objectType,"en");
}
| Creates a auto-generated localization for the given domain object key. |
public PowerContainerVmAllocationPolicyMigrationAbstractHostSelection(List<? extends ContainerHost> hostList,PowerContainerVmSelectionPolicy vmSelectionPolicy,HostSelectionPolicy hostSelectionPolicy,double OlThreshold,double UlThreshold){
super(hostList,vmSelectionPolicy);
setHostSelectionPolicy(hostSelectionPolicy);
setUtilizationThreshold(OlThreshold);
setUnderUtilizationThreshold(UlThreshold);
}
| Instantiates a new power vm allocation policy migration abstract. |
public GraphPattern(GraphPattern parent){
contextVar=parent.contextVar;
spScope=parent.spScope;
}
| Creates a new graph pattern that inherits the context and scope from a parent graph pattern. |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.918 -0400",hash_original_method="5F0F76B2AEC559A82852132C77730119",hash_generated_method="761CCC5FECDDA74F16E4367258F3BE74") private void detectEncoding(char[] cbuf,int off,int len) throws IOException {
int size=len;
StringBuffer xmlProlog=xmlPrologWriter.getBuffer();
if (xmlProlog.length() + len > BUFFER_SIZE) {
size=BUFFER_SIZE - xmlProlog.length();
}
xmlPrologWriter.write(cbuf,off,size);
if (xmlProlog.length() >= 5) {
if (xmlProlog.substring(0,5).equals("<?xml")) {
int xmlPrologEnd=xmlProlog.indexOf("?>");
if (xmlPrologEnd > 0) {
Matcher m=ENCODING_PATTERN.matcher(xmlProlog.substring(0,xmlPrologEnd));
if (m.find()) {
encoding=m.group(1).toUpperCase();
encoding=encoding.substring(1,encoding.length() - 1);
}
else {
encoding=defaultEncoding;
}
}
else {
if (xmlProlog.length() >= BUFFER_SIZE) {
encoding=defaultEncoding;
}
}
}
else {
encoding=defaultEncoding;
}
if (encoding != null) {
xmlPrologWriter=null;
writer=new OutputStreamWriter(out,encoding);
writer.write(xmlProlog.toString());
if (len > size) {
writer.write(cbuf,off + size,len - size);
}
}
}
}
| Detect the encoding. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public static void availableStoragePoolsJson(String id){
List<StoragePoolInfo> items=Lists.newArrayList();
CachedResources<StorageSystemRestRep> storageSystems=StorageSystemUtils.createCache();
for ( StoragePoolRestRep storagePool : StoragePoolUtils.getStoragePoolsAssignableToVirtualArray(id)) {
items.add(new StoragePoolInfo(storagePool,storageSystems));
}
renderJSON(DataTablesSupport.createJSON(items,params));
}
| Renders the list of storage pools available for the given virtual array as JSON. |
int[] findNearestArea(int pixelX,int pixelY,int minSpanX,int minSpanY,int spanX,int spanY,View ignoreView,boolean ignoreOccupied,int[] result,int[] resultSpan,boolean[][] occupied){
lazyInitTempRectStack();
markCellsAsUnoccupiedForView(ignoreView,occupied);
pixelX-=(mCellWidth + mWidthGap) * (spanX - 1) / 2f;
pixelY-=(mCellHeight + mHeightGap) * (spanY - 1) / 2f;
final int[] bestXY=result != null ? result : new int[2];
double bestDistance=Double.MAX_VALUE;
final Rect bestRect=new Rect(-1,-1,-1,-1);
final Stack<Rect> validRegions=new Stack<Rect>();
final int countX=mCountX;
final int countY=mCountY;
if (minSpanX <= 0 || minSpanY <= 0 || spanX <= 0 || spanY <= 0 || spanX < minSpanX || spanY < minSpanY) {
return bestXY;
}
for (int y=0; y < countY - (minSpanY - 1); y++) {
inner: for (int x=0; x < countX - (minSpanX - 1); x++) {
int ySize=-1;
int xSize=-1;
if (ignoreOccupied) {
for (int i=0; i < minSpanX; i++) {
for (int j=0; j < minSpanY; j++) {
if (occupied[x + i][y + j]) {
continue inner;
}
}
}
xSize=minSpanX;
ySize=minSpanY;
boolean incX=true;
boolean hitMaxX=xSize >= spanX;
boolean hitMaxY=ySize >= spanY;
while (!(hitMaxX && hitMaxY)) {
if (incX && !hitMaxX) {
for (int j=0; j < ySize; j++) {
if (x + xSize > countX - 1 || occupied[x + xSize][y + j]) {
hitMaxX=true;
}
}
if (!hitMaxX) {
xSize++;
}
}
else if (!hitMaxY) {
for (int i=0; i < xSize; i++) {
if (y + ySize > countY - 1 || occupied[x + i][y + ySize]) {
hitMaxY=true;
}
}
if (!hitMaxY) {
ySize++;
}
}
hitMaxX|=xSize >= spanX;
hitMaxY|=ySize >= spanY;
incX=!incX;
}
incX=true;
hitMaxX=xSize >= spanX;
hitMaxY=ySize >= spanY;
}
final int[] cellXY=mTmpXY;
cellToCenterPoint(x,y,cellXY);
Rect currentRect=mTempRectStack.pop();
currentRect.set(x,y,x + xSize,y + ySize);
boolean contained=false;
for ( Rect r : validRegions) {
if (r.contains(currentRect)) {
contained=true;
break;
}
}
validRegions.push(currentRect);
double distance=Math.sqrt(Math.pow(cellXY[0] - pixelX,2) + Math.pow(cellXY[1] - pixelY,2));
if ((distance <= bestDistance && !contained) || currentRect.contains(bestRect)) {
bestDistance=distance;
bestXY[0]=x;
bestXY[1]=y;
if (resultSpan != null) {
resultSpan[0]=xSize;
resultSpan[1]=ySize;
}
bestRect.set(currentRect);
}
}
}
markCellsAsOccupiedForView(ignoreView,occupied);
if (bestDistance == Double.MAX_VALUE) {
bestXY[0]=-1;
bestXY[1]=-1;
}
recycleTempRects(validRegions);
return bestXY;
}
| Find a vacant area that will fit the given bounds nearest the requested cell location. Uses Euclidean distance to score multiple vacant areas. |
public DockMapPanel(PropertyHandler propertyHandler){
this(propertyHandler,false);
}
| Create a MapPanel that configures itself with the properties contained in the PropertyHandler provided. If the PropertyHandler is null, a new one will be created. |
public static String hex(byte b){
return String.format("%02x",b);
}
| Convert a single byte to a human-readable hex number. The number will always be two characters wide. |
public CFunction(final INaviModule module,final INaviView view,final IAddress address,final String name,final String originalName,final String description,final int indegree,final int outdegree,final int blockCount,final int edgeCount,final FunctionType type,final String forwardedFunctionModuleName,final int forwardedFunctionModuleId,final IAddress forwardedFunctionAddress,final BaseType stackFrame,final BaseType prototype,final SQLProvider provider){
this.module=Preconditions.checkNotNull(module,"IE00069: Module can not be null");
this.view=Preconditions.checkNotNull(view,"IE00268: View argument can not be null");
this.address=Preconditions.checkNotNull(address,"IE00070: Function address can not be null");
this.name=name;
this.originalName=Preconditions.checkNotNull(originalName,"IE00642: OriginalName argument can not be null");
this.description=description;
Preconditions.checkArgument(indegree >= 0,"IE00643: Indegree argument can not be smaller 0");
this.indegree=indegree;
Preconditions.checkArgument(outdegree >= 0,"IE01102: Outdegree argument can not be smaller 0");
this.outdegree=outdegree;
Preconditions.checkArgument(edgeCount >= 0,"IE01103: Edge count argument can not be smaller 0");
this.edgeCount=edgeCount;
Preconditions.checkArgument(blockCount >= 0,"IE02175: Block count argument can not be smaller 0");
this.blockCount=blockCount;
this.type=Preconditions.checkNotNull(type,"IE00073: Function type can not be null");
this.provider=Preconditions.checkNotNull(provider,"IE00074: SQL provider can not be null");
this.forwardedFunctionModuleId=forwardedFunctionModuleId;
this.forwardedFunctionAddress=forwardedFunctionAddress;
this.forwardedFunctionModuleName=forwardedFunctionModuleName;
this.stackFrame=stackFrame;
this.prototype=prototype;
CommentManager.get(provider).addListener(commentListener);
FunctionManager.get(provider).putFunction(this);
}
| Creates a new function object that represents a function from the project. |
public JsonObject merge(JsonObject object){
if (object == null) {
throw new NullPointerException("object is null");
}
for ( Member member : object) {
this.set(member.name,member.value);
}
return this;
}
| Copies all members of the specified object into this object. When the specified object contains members with names that also exist in this object, the existing values in this object will be replaced by the corresponding values in the specified object. |
public ExternalDefinition_ createExternalDefinition_(){
ExternalDefinition_Impl externalDefinition_=new ExternalDefinition_Impl();
return externalDefinition_;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void writeDelay(){
try {
Thread.sleep(10);
}
catch ( InterruptedException e) {
fail("Interrupted sleep.");
}
}
| A very slight delay to ensure that successive groups of queries in the DB cannot have the same timestamp. |
private void writeLog(String cmd){
try {
if (m_writer == null) {
File file=File.createTempFile("create",".log");
m_writer=new PrintWriter(new FileWriter(file));
log.info(file.toString());
}
m_writer.println(cmd);
m_writer.flush();
}
catch ( Exception e) {
log.severe(e.toString());
}
}
| Write to File Log |
protected void sequence_TStructField(ISerializationContext context,TStructField semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: TStructMember returns TStructField TStructField returns TStructField Constraint: (name=IdentifierName typeRef=TypeRef?) |
public static void write(byte[] from,File to) throws IOException {
asByteSink(to).write(from);
}
| Overwrites a file with the contents of a byte array. |
public static void logApplicationProperties(){
LOG.info("Application properties: ");
Preferences preferences=Activator.getDefault().getPluginPreferences();
logPreferences(preferences);
}
| Logs verinice preferences the user set in the verinice preference dialog. |
public void flush() throws IOException {
if (exception != null) throw exception;
if (finished) throw new XZIOException("Stream finished or closed");
try {
if (blockEncoder != null) {
if (filtersSupportFlushing) {
blockEncoder.flush();
}
else {
endBlock();
out.flush();
}
}
else {
out.flush();
}
}
catch ( IOException e) {
exception=e;
throw e;
}
}
| Flushes the encoder and calls <code>out.flush()</code>. All buffered pending data will then be decompressible from the output stream. <p> Calling this function very often may increase the compressed file size a lot. The filter chain options may affect the size increase too. For example, with LZMA2 the HC4 match finder has smaller penalty with flushing than BT4. <p> Some filters don't support flushing. If the filter chain has such a filter, <code>flush()</code> will call <code>endBlock()</code> before flushing. |
GridUriDeploymentSpringDocument(XmlBeanFactory factory){
assert factory != null;
this.factory=factory;
}
| Creates new instance of configuration helper with given configuration. |
public void beforeCalculatingStartingBucketId(){
}
| This callback is called just before calculating starting bucket id on datastore |
public void fireStyleChangeEvent(String property,Style source){
if (listeners == null || listeners.size() == 0) {
return;
}
boolean isEdt=Display.getInstance().isEdt();
if (isEdt && listeners.size() == 1) {
StyleListener a=(StyleListener)listeners.get(0);
a.styleChanged(property,source);
return;
}
StyleListener[] array;
synchronized (this) {
array=new StyleListener[listeners.size()];
for (int iter=0; iter < array.length; iter++) {
array[iter]=(StyleListener)listeners.get(iter);
}
}
if (isEdt) {
fireStyleChangeSync(array,property,source);
}
else if (fireStyleEventsOnNonEDT) {
styleListenerArray=true;
Runnable cl=new CallbackClass(array,new Object[]{property,source});
Display.getInstance().callSerially(cl);
}
}
| Fires the style change even to the listeners |
public static final String nullifyIfEmpty(String s){
return ModelUtil.hasLength(s) ? s : null;
}
| Returns <CODE>null</CODE> if the specified string is empty or <CODE>null</CODE>. Otherwise the string itself is returned. |
public boolean is_subset_of(symbol_set other) throws internal_error {
not_null(other);
for (Enumeration e=all(); e.hasMoreElements(); ) if (!other.contains((symbol)e.nextElement())) return false;
return true;
}
| Determine if this set is an (improper) subset of another. |
public SmartJList(Vector<SmartJListItem> listData){
super(listData);
this.init();
}
| Creates a new instance of SmartJList |
public synchronized void returnBuf(byte[] buf){
if (buf == null || buf.length > mSizeLimit) {
return;
}
mBuffersByLastUse.add(buf);
int pos=Collections.binarySearch(mBuffersBySize,buf,BUF_COMPARATOR);
if (pos < 0) {
pos=-pos - 1;
}
mBuffersBySize.add(pos,buf);
mCurrentSize+=buf.length;
trim();
}
| Returns a buffer to the pool, throwing away old buffers if the pool would exceed its allotted size. |
private void processPostConstructViewMap(SystemEvent se){
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST,"Handling PostConstructViewMapEvent");
}
UIViewRoot viewRoot=(UIViewRoot)se.getSource();
Map<String,Object> viewMap=viewRoot.getViewMap(false);
if (viewMap != null) {
FacesContext facesContext=FacesContext.getCurrentInstance();
if (viewRoot.isTransient() && facesContext.isProjectStage(ProjectStage.Development)) {
FacesMessage message=new FacesMessage(FacesMessage.SEVERITY_WARN,"@ViewScoped beans are not supported on stateless views","@ViewScoped beans are not supported on stateless views");
facesContext.addMessage(viewRoot.getClientId(facesContext),message);
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING,"@ViewScoped beans are not supported on stateless views");
}
}
Object session=facesContext.getExternalContext().getSession(true);
if (session != null) {
Map<String,Object> sessionMap=facesContext.getExternalContext().getSessionMap();
Integer size=(Integer)sessionMap.get(ACTIVE_VIEW_MAPS_SIZE);
if (size == null) {
size=25;
}
if (sessionMap.get(ACTIVE_VIEW_MAPS) == null) {
sessionMap.put(ACTIVE_VIEW_MAPS,(Map<String,Object>)Collections.synchronizedMap(new LRUMap<String,Object>(size)));
}
Map<String,Object> viewMaps=(Map<String,Object>)sessionMap.get(ACTIVE_VIEW_MAPS);
synchronized (viewMaps) {
String viewMapId=UUID.randomUUID().toString();
while (viewMaps.containsKey(viewMapId)) {
viewMapId=UUID.randomUUID().toString();
}
if (viewMaps.size() == size) {
String eldestViewMapId=viewMaps.keySet().iterator().next();
Map<String,Object> eldestViewMap=(Map<String,Object>)viewMaps.remove(eldestViewMapId);
removeEldestViewMap(facesContext,eldestViewMap);
}
viewMaps.put(viewMapId,viewMap);
viewRoot.getTransientStateHelper().putTransient(VIEW_MAP_ID,viewMapId);
viewRoot.getTransientStateHelper().putTransient(VIEW_MAP,viewMap);
if (distributable) {
sessionMap.put(ACTIVE_VIEW_MAPS,viewMaps);
}
}
if (null != contextManager) {
contextManager.fireInitializedEvent(facesContext,viewRoot);
}
}
}
}
| Process the PostConstructViewMap system event. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:07.218 -0500",hash_original_method="2F5DB311D13CB6144CC7B49271775C33",hash_generated_method="41AF39E66C83ED832AC9F229D6F9164F") public OrganizationHeader createOrganizationHeader(String organization) throws ParseException {
if (organization == null) throw new NullPointerException("bad organization arg");
Organization o=new Organization();
o.setOrganization(organization);
return o;
}
| Creates a new OrganizationHeader based on the newly supplied organization value. |
public GF2Vector(int length,int t,SecureRandom sr){
if (t > length) {
throw new ArithmeticException("The hamming weight is greater than the length of vector.");
}
this.length=length;
int size=(length + 31) >> 5;
v=new int[size];
int[] help=new int[length];
for (int i=0; i < length; i++) {
help[i]=i;
}
int m=length;
for (int i=0; i < t; i++) {
int j=RandUtils.nextInt(sr,m);
setBit(help[j]);
m--;
help[j]=help[m];
}
}
| Construct a random GF2Vector of the given length with the specified number of non-zero coefficients. |
public XMLDecoder(InputStream inputStream,Object owner){
this(inputStream,owner,null,null);
}
| Create a decoder to read from specified input stream. |
public static void remove(ByteString namespace,ByteString key){
BaggageImpl impl=Baggage.current.get();
if (impl != null) {
impl.remove(namespace,key);
}
}
| Remove all values for the specified key from the current baggage |
private DLockGrantor(DLockService dlock,long vId){
this.dm=dlock.getDistributionManager();
CancelCriterion stopper=this.dm.getCancelCriterion();
this.whileInitializing=new StoppableCountDownLatch(stopper,1);
this.untilDestroyed=new StoppableCountDownLatch(stopper,1);
this.dlock=dlock;
this.destroyLock=new StoppableReentrantReadWriteLock(stopper);
this.versionId.set(vId);
this.dm.addMembershipListener(this.membershipListener);
this.thread=new DLockGrantorThread(this,stopper);
this.dlock.getStats().incGrantors(1);
}
| Creates instance of grantor for the lock service. |
private SystemUnderDevelopment instantiateSystemUnderDevelopment(){
LOG.debug("Creating SUD " + systemUnderDevelopmentClass);
SystemUnderDevelopment systemUnderDevelopment=ClassUtils.createInstanceFromClassNameWithArguments(classLoader,systemUnderDevelopmentClass,SystemUnderDevelopment.class);
systemUnderDevelopment.setClassLoader(classLoader);
return systemUnderDevelopment;
}
| Instantiate the system under development from a string, to be able to use third party SuDs. |
public RolloutGroupConditionBuilder successCondition(final RolloutGroupSuccessCondition condition,final String expression){
conditions.setSuccessCondition(condition);
conditions.setSuccessConditionExp(expression);
return this;
}
| Sets the finish condition and expression on the builder. |
void addUndoAction(UndoAction action){
int iAction=m_undoStack.size() - 1;
while (iAction > m_nCurrentEditAction) {
m_undoStack.remove(iAction--);
}
if (m_nSavedPointer > m_nCurrentEditAction) {
m_nSavedPointer=-2;
}
m_undoStack.add(action);
m_nCurrentEditAction++;
}
| add undo action to the undo stack. |
private boolean checkMemory(){
ActivityManager.MemoryInfo mi=new ActivityManager.MemoryInfo();
ActivityManager activityManager=(ActivityManager)getSystemService(ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
long availableMegs=mi.totalMem / 1048576L;
return availableMegs >= 1000;
}
else {
long availableMegs=mi.availMem / 1048576L;
return availableMegs >= 1000;
}
}
| Oops, this is a really big layout with lots of images and no optimizations done to it, older or lower end devices might run out of memory! Sorry to those devs with these devices. |
@Override public void refreshMetaData() throws CacheException {
if (_data == null || _metaData == null) throw new CacheException("Cannot refresh meta data because there is no data or meta data. ");
MatrixCharacteristics mc=((MatrixDimensionsMetaData)_metaData).getMatrixCharacteristics();
mc.setDimension(_data.getNumRows(),_data.getNumColumns());
mc.setNonZeros(_data.getNonZeros());
}
| Make the matrix metadata consistent with the in-memory matrix data |
private void importRecords(){
for ( X_I_Forecast ifl : getRecords(false,m_IsImportOnlyNoErrors)) {
isImported=false;
MForecastLine fl=importForecast(ifl);
if (fl != null) isImported=true;
if (isImported) {
ifl.setM_ForecastLine_ID(fl.getM_ForecastLine_ID());
ifl.setI_IsImported(true);
ifl.setProcessed(true);
ifl.setI_ErrorMsg("");
ifl.saveEx();
imported++;
ifl.saveEx();
}
else {
ifl.setI_IsImported(false);
ifl.setProcessed(true);
ifl.saveEx();
notimported++;
}
}
}
| import records using Import Forecast table |
public MSAAccountInfo(final MSAAuthenticator authenticator,final LiveConnectSession liveConnectSession,final ILogger logger){
mAuthenticator=authenticator;
mSession=liveConnectSession;
mLogger=logger;
}
| Creates an MSAAccountInfo object. |
public RectangleConstraint(double w,double h){
this(w,null,LengthConstraintType.FIXED,h,null,LengthConstraintType.FIXED);
}
| Creates a new "fixed width and height" instance. |
public void consolidate(RemoveAttributeTransform preceding){
for (int i=0; i < catIndexMap.length; i++) catIndexMap[i]=preceding.catIndexMap[catIndexMap[i]];
for (int i=0; i < numIndexMap.length; i++) numIndexMap[i]=preceding.numIndexMap[numIndexMap[i]];
}
| A serious of Remove Attribute Transforms may be learned and applied sequentially to a single data set. Instead of keeping all the transforms around indefinitely, a sequential series of Remove Attribute Transforms can be consolidated into a single transform object. <br> This method mutates the this transform by providing it with the transform that would have been applied before this current object. Once complete, this transform can be used two perform both removals in one step.<br><br> Example: <br> An initial set of features <i>A</i> is transformed into <i>A'</i> by transform t<sub>1</sub><br> <i>A'</i> is transformed into <i>A''</i> by transform t<sub>2</sub><br> Instead, you can invoke t<sub>2</sub>.consolidate(t<sub>1</sub>). You can then transform <i>A</i> into <i>A''</i> by using only transform t<sub>2</sub> |
@Override public void updateNString(int columnIndex,String x) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("updateNString(" + columnIndex + ", "+ quote(x)+ ");");
}
update(columnIndex,x == null ? (Value)ValueNull.INSTANCE : ValueString.get(x));
}
catch ( Exception e) {
throw logAndConvert(e);
}
}
| Updates a column in the current or insert row. |
public MultiUnion createMultiUnion(Graph[] graphs){
return new MultiUnion(graphs);
}
| Return a multiunion, initialized with the given graphs. |
public static Element createVector(RenderScript rs,DataType dt,int size){
if (size < 2 || size > 4) {
throw new RSIllegalArgumentException("Vector size out of range 2-4.");
}
switch (dt) {
case FLOAT_32:
case FLOAT_64:
case SIGNED_8:
case SIGNED_16:
case SIGNED_32:
case SIGNED_64:
case UNSIGNED_8:
case UNSIGNED_16:
case UNSIGNED_32:
case UNSIGNED_64:
case BOOLEAN:
{
DataKind dk=DataKind.USER;
boolean norm=false;
int id=rs.nElementCreate(dt.mID,dk.mID,norm,size);
return new Element(id,rs,dt,dk,norm,size);
}
default :
{
throw new RSIllegalArgumentException("Cannot create vector of " + "non-primitive type.");
}
}
}
| Create a custom vector element of the specified DataType and vector size. DataKind will be set to USER. Only primitive types (FLOAT_32, FLOAT_64, SIGNED_8, SIGNED_16, SIGNED_32, SIGNED_64, UNSIGNED_8, UNSIGNED_16, UNSIGNED_32, UNSIGNED_64, BOOLEAN) are supported. |
public WhereBuilder and(WhereBuilder where){
String condition=whereItems.size() == 0 ? " " : "AND ";
return expr(condition + "(" + where.toString()+ ")");
}
| add AND condition |
private void resetNetworkVisited(){
for ( Node node : this.network.getNodes().values()) {
DijkstraNodeData data=getData(node);
data.resetVisited();
}
}
| Resets all nodes in the network as if they have not been visited yet. |
public boolean addToSocialProof(long node,byte edgeType,double nodeWeight){
if (socialProofs[edgeType] == null) {
socialProofs[edgeType]=new SmallArrayBasedLongToDoubleMap();
}
socialProofs[edgeType].put(node,nodeWeight);
return true;
}
| Attempts to add the given node as social proof. Note that the node itself may or may not be added depending on the nodeWeight and the current status of the social proof, with the idea being to maintain the "best" social proof. |
@TruffleBoundary private static int[] incArray(int[] a,int[] dim){
int[] newA=a.clone();
for (int i=0; i < newA.length; i++) {
newA[i]++;
if (newA[i] < dim[i]) {
break;
}
newA[i]=0;
}
return newA;
}
| Increment a stride array. |
public void testSuccessWithSuccessAndFailureThresholds(){
CircuitBreaker breaker=new CircuitBreaker().withSuccessThreshold(3).withFailureThreshold(2);
breaker.halfOpen();
HalfOpenState state=new HalfOpenState(breaker);
state.recordSuccess();
state.recordSuccess();
assertFalse(breaker.isOpen());
assertFalse(breaker.isClosed());
state.recordSuccess();
assertTrue(breaker.isClosed());
}
| Asserts that the circuit is closed after the success threshold is met. The failure threshold is ignored. |
public void scrollToTop(){
mAppsRecyclerView.scrollToTop();
}
| Scrolls this list view to the top. |
public String localName(){
return theLocalName;
}
| Returns the local name of this element type. |
public Schaffer2(){
super(1,2);
}
| Constructs the Schaffer (2) problem. |
public String weightTrimBetaTipText(){
return "Set the beta value used for weight trimming in LogitBoost. " + "Only instances carrying (1 - beta)% of the weight from previous iteration " + "are used in the next iteration. Set to 0 for no weight trimming. "+ "The default value is 0.";
}
| Returns the tip text for this property |
public static Result oldJobHistory(){
return getJobHistory(Version.OLD);
}
| Controls Job History. Displays at max MAX_HISTORY_LIMIT executions. Old version of the job history |
public boolean containedByTreatZeroAsMissing(Instance instance){
if (instance instanceof weka.core.SparseInstance) {
int numInstVals=instance.numValues();
int numItemSetVals=m_items.length;
for (int p1=0, p2=0; p1 < numInstVals || p2 < numItemSetVals; ) {
int instIndex=Integer.MAX_VALUE;
if (p1 < numInstVals) {
instIndex=instance.index(p1);
}
int itemIndex=p2;
if (m_items[itemIndex] > -1) {
if (itemIndex != instIndex) {
return false;
}
else {
if (instance.isMissingSparse(p1)) {
return false;
}
if (m_items[itemIndex] != (int)instance.valueSparse(p1)) {
return false;
}
}
p1++;
p2++;
}
else {
if (itemIndex < instIndex) {
p2++;
}
else if (itemIndex == instIndex) {
p2++;
p1++;
}
}
}
}
else {
for (int i=0; i < instance.numAttributes(); i++) {
if (m_items[i] > -1) {
if (instance.isMissing(i) || (int)instance.value(i) == 0) {
return false;
}
if (m_items[i] != (int)instance.value(i)) {
return false;
}
}
}
}
return true;
}
| Checks if an instance contains an item set. |
protected void send(final ICallback<InputStream> callback){
mBaseRequest.setHttpMethod(HttpMethod.GET);
mBaseRequest.getClient().getHttpProvider().send(this,callback,InputStream.class,null);
}
| Sends this request. |
public LabelEx(String s,Image i){
setText(s);
setIcon(i);
}
| Construct a Label with passed String as text and passed Image as its icon. |
protected int executeCriteriaReturnCountList(Locale locale,StringBuffer query) throws HibernateException {
int result=0;
Session session=null;
try {
session=getSession();
List listado=session.find("SELECT COUNT(*) FROM " + getScrCaLanguage(locale.getLanguage()).getName() + " WHERE "+ query.toString());
if (!listado.isEmpty()) {
result=((Integer)(listado.get(0))).intValue();
}
}
finally {
this.closeSession(session);
}
return result;
}
| Metodo que genera una consulta mediante Criteria de Hibernate y lo ejecuta, obteniendo el numero de registros de la consulta que se pasa como parametro a la tabla que corresponde segun el idioma |
protected SWFActions factorySWFActions(){
return new ActionWriter(this,version);
}
| Description of the Method |
public StrBuilder appendFixedWidthPadRight(Object obj,int width,char padChar){
if (width > 0) {
ensureCapacity(size + width);
String str=(obj == null ? getNullText() : obj.toString());
if (str == null) {
str="";
}
int strLen=str.length();
if (strLen >= width) {
str.getChars(0,width,buffer,size);
}
else {
int padLen=width - strLen;
str.getChars(0,strLen,buffer,size);
for (int i=0; i < padLen; i++) {
buffer[size + strLen + i]=padChar;
}
}
size+=width;
}
return this;
}
| Appends an object to the builder padding on the right to a fixed length. The <code>toString</code> of the object is used. If the object is larger than the length, the right hand side is lost. If the object is null, null text value is used. |
public synchronized static void shutdownInstance(){
refCount--;
if (_instance == null) return;
if (refCount > 0) return;
_instance.shutdown();
boolean interrupted=false;
try {
if (_instance._clientMonitor != null) {
_instance._clientMonitor.join();
}
}
catch ( InterruptedException e) {
interrupted=true;
if (logger.isDebugEnabled()) {
logger.debug(":Interrupted joining with the ClientHealthMonitor Thread",e);
}
}
finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
_instance=null;
refCount=0;
}
| Shuts down the singleton <code>ClientHealthMonitor</code> instance. |
protected static ExifParser parse(InputStream inputStream,int options,ExifInterface iRef) throws IOException, ExifInvalidFormatException {
return new ExifParser(inputStream,options,iRef);
}
| Parses the the given InputStream with the given options |
private void sendToSubscriptionAddedMail(Subscription subscription,List<UsageLicense> usageLicenses){
if (subscription.getStatus() != SubscriptionStatus.ACTIVE) {
return;
}
EmailType emailType=useAccessInfo(subscription) ? EmailType.SUBSCRIPTION_USER_ADDED_ACCESSTYPE_DIRECT : EmailType.SUBSCRIPTION_USER_ADDED;
Long marketplaceKey=null;
if (subscription.getMarketplace() != null) {
marketplaceKey=Long.valueOf(subscription.getMarketplace().getKey());
}
SendMailPayload payload=new SendMailPayload();
for ( UsageLicense usageLicense : usageLicenses) {
String accessInfo=getAccessInfo(subscription,usageLicense.getUser());
if (isUsableAWSAccessInfo(accessInfo)) {
payload.addMailObjectForUser(usageLicense.getUser().getKey(),EmailType.SUBSCRIPTION_USER_ADDED_ACCESSINFO,new Object[]{subscription.getSubscriptionId(),getPublicDNS(accessInfo),getIPAddress(accessInfo),getKeyPairName(accessInfo)},marketplaceKey);
}
else {
payload.addMailObjectForUser(usageLicense.getUser().getKey(),emailType,new Object[]{subscription.getSubscriptionId(),accessInfo},marketplaceKey);
}
}
TaskMessage message=new TaskMessage(SendMailHandler.class,payload);
serviceFacade.getTaskQueueService().sendAllMessages(Arrays.asList(message));
}
| Send the subscription created email to the users assigned to the subscription. The mail also includes the access information. |
private double minDistLevel(DBID id,int level){
final NumberVector obj=relation.get(id);
final double r=1.0 / (1 << (level - 1));
double dist=Double.POSITIVE_INFINITY;
for (int dim=0; dim < d; dim++) {
final double p_m_r=getDimForObject(obj,dim) % r;
dist=Math.min(dist,Math.min(p_m_r,r - p_m_r));
}
return dist * diameter;
}
| minDist function calculate the minimal Distance from Vector p to the border of the corresponding r-region at the given level |
public static NeuronDialog createNeuronDialog(final List<Neuron> neurons){
NeuronDialog nd=new NeuronDialog(neurons);
nd.neuronPropertiesPanel=NeuronPropertiesPanel.createNeuronPropertiesPanel(nd.neuronList,nd);
nd.init();
nd.addListeners();
nd.updateHelp();
return nd;
}
| Create a neuron dialog for a list of logical neurons. |
public SVGStyleSheetProcessingInstruction(String data,AbstractDocument owner,StyleSheetFactory f){
super(data,owner,f);
}
| Creates a new ProcessingInstruction object. |
public static void enableBarColoring(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
disableTranslucentBars(window);
}
}
| Enable system bars coloring |
@Override public String generateStart(){
StringBuffer docu=new StringBuffer();
int sumInst=0;
for (int cNum=0; cNum < getClusters().length; cNum++) {
SubspaceClusterDefinition cl=(SubspaceClusterDefinition)getClusters()[cNum];
docu.append("%\n");
docu.append("% Cluster: c" + cNum + " ");
switch (cl.getClusterType().getSelectedTag().getID()) {
case UNIFORM_RANDOM:
docu.append("Uniform Random");
break;
case TOTAL_UNIFORM:
docu.append("Total Random");
break;
case GAUSSIAN:
docu.append("Gaussian");
break;
}
if (cl.isInteger()) {
docu.append(" / INTEGER");
}
docu.append("\n% ----------------------------------------------\n");
docu.append("%" + cl.attributesToString());
docu.append("\n% Number of Instances: " + cl.getInstNums() + "\n");
docu.append("% Generated Number of Instances: " + cl.getNumInstances() + "\n");
sumInst+=cl.getNumInstances();
}
docu.append("%\n% ----------------------------------------------\n");
docu.append("% Total Number of Instances: " + sumInst + "\n");
docu.append("% in " + getClusters().length + " Cluster(s)\n%");
return docu.toString();
}
| Compiles documentation about the data generation before the generation process |
private void cmd_saveChange(){
MCashBook cashBook=new MCashBook(p_ctx,p_pos.getC_CashBook_ID(),null);
Timestamp today=TimeUtil.getDay(System.currentTimeMillis());
MCash cash=MCash.get(p_ctx,p_pos.getC_CashBook_ID(),today,null);
BigDecimal initialChange=(BigDecimal)v_change.getValue();
if (cash != null && cash.get_ID() != 0 && initialChange.compareTo(cash.getEndingBalance()) != 0) {
MCashLine cl=new MCashLine(cash);
cl.setCashType(MCashLine.CASHTYPE_Difference);
cl.setAmount(initialChange.subtract(cash.getEndingBalance()));
cl.setDescription("Initial Change Before: " + cash.getEndingBalance() + " Now: "+ initialChange);
cl.saveEx();
}
v_PreviousChange.setValue(initialChange);
}
| Save the initial change of the cash |
public LocatorLayouter(){
}
| Creates a new instance. |
@Override protected void visit(final Resource resource){
if (StringUtils.equals(this.nodeType,resource.getValueMap().get("jcr:primaryType",String.class))) {
this.count++;
}
}
| This method is used to perform the work based on the visited resource. If possible exit quickly if no work needs to be done to increase efficiency. |
public void removeNode(Node n){
if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE,null));
this.removeElement(n);
}
| Remove a node. |
IdleManager(Connector<?> connector,ScheduledExecutorService schedExecitor){
this.connector=connector;
this.schedExecutor=schedExecitor;
}
| Create a new idle manager for the connector. <p> By default idle (disconnect) timeouts and subsequent auto-reconnect is disabled. |
private void createComputeDescriptions(AWSComputeEnumerationCreationSubStage next){
AWSComputeDescriptionCreationState cd=new AWSComputeDescriptionCreationState();
cd.instancesToBeCreated=this.aws.instancesToBeCreated;
cd.parentTaskLink=this.aws.computeEnumerationRequest.taskReference;
cd.authCredentiaslLink=this.aws.parentAuth.documentSelfLink;
cd.tenantLinks=this.aws.parentCompute.tenantLinks;
cd.regionId=this.aws.parentCompute.description.regionId;
this.service.sendRequest(Operation.createPatch(this.service,AWSComputeDescriptionCreationAdapterService.SELF_LINK).setBody(cd).setCompletion(null));
}
| Posts a compute description to the compute description service for creation. |
public boolean hasResolvedBindings(){
return (this.bits & RESOLVED_BINDINGS) != 0;
}
| Returns true if the ast tree was created with bindings, false otherwise |
public EaseOut(){
}
| Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. |
public void checkSimpleBuilderArray(boolean registered) throws Exception {
startUp(registered);
BinaryObject binaryOne=node1.binary().buildEnum(EnumType.class.getName(),EnumType.ONE.ordinal());
BinaryObject binaryTwo=node1.binary().buildEnum(EnumType.class.getName(),EnumType.TWO.ordinal());
cacheBinary1.put(1,new BinaryObject[]{binaryOne,binaryTwo});
validateSimpleArray(registered);
}
| Check arrays with builder. |
public Element create(String prefix,Document doc){
return new SVGOMFlowRegionElement(prefix,(AbstractDocument)doc);
}
| Creates an instance of the associated element type. |
public boolean isAssignableFrom(Type rhsType){
return isAssignable(type,rhsType);
}
| <p> isAssignableFrom </p> |
public void provideErrorFeedback(Component component){
super.provideErrorFeedback(component);
}
| Error Feedback. <p> Invoked when the user attempts an invalid operation, such as pasting into an uneditable <code>JTextField</code> that has focus. </p> <p> If the user has enabled visual error indication on the desktop, this method will flash the caption bar of the active window. The user can also set the property awt.visualbell=true to achieve the same results. </p> |
public void drawRangeMarker(Graphics2D g2,ContourPlot plot,ValueAxis rangeAxis,Marker marker,Rectangle2D dataArea){
if (marker instanceof ValueMarker) {
ValueMarker vm=(ValueMarker)marker;
double value=vm.getValue();
Range range=rangeAxis.getRange();
if (!range.contains(value)) {
return;
}
double y=rangeAxis.valueToJava2D(value,dataArea,RectangleEdge.LEFT);
Line2D line=new Line2D.Double(dataArea.getMinX(),y,dataArea.getMaxX(),y);
Paint paint=marker.getOutlinePaint();
Stroke stroke=marker.getOutlineStroke();
g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);
g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);
g2.draw(line);
}
}
| Draws a horizontal line across the chart to represent a 'range marker'. |
@Interruptible public void recordStkMap(int byteindex,byte[] byteMap,int BBLastPtr,boolean replacemap){
int mapNum=0;
if (VM.TraceStkMaps) {
VM.sysWrite(" ReferenceMaps-recordStkMap bytecode offset = ");
VM.sysWrite(byteindex);
VM.sysWrite("\n");
VM.sysWrite(" input byte map = ");
for (int j=0; j <= BBLastPtr; j++) {
VM.sysWrite(byteMap[j]);
}
VM.sysWrite("\n");
if (replacemap) {
VM.sysWrite(" ReferenceMaps-recordStkMap- replacing map at byteindex = ");
VM.sysWrite(byteindex);
VM.sysWrite("\n");
}
}
if (replacemap) {
for (mapNum=0; mapNum < mapCount; mapNum++) {
if (MCSites[mapNum] == byteindex) {
int start=mapNum * bytesPerMap();
for (int i=start; i < start + bytesPerMap(); i++) {
referenceMaps[i]=0;
}
if (VM.TraceStkMaps) {
VM.sysWrite(" ReferenceMaps-recordStkMap replacing map number = ",mapNum);
VM.sysWriteln(" for machinecode index = ",MCSites[mapNum]);
}
break;
}
}
}
else {
mapNum=mapCount++;
MCSites[mapNum]=byteindex;
if (BBLastPtr == -1) return;
}
if (VM.TraceStkMaps) {
VM.sysWrite(" ReferenceMaps-recordStkMap map id = ");
VM.sysWrite(mapNum);
VM.sysWrite("\n");
}
int mapslot=mapNum * bytesPerMap();
int len=(BBLastPtr + 1);
int offset=0;
int convertLength;
int word=mapslot;
if (len < (BITS_PER_MAP_ELEMENT - 1)) {
convertLength=len;
}
else {
convertLength=BITS_PER_MAP_ELEMENT - 1;
}
byte firstByte=convertMapElement(byteMap,offset,convertLength,BuildReferenceMaps.REFERENCE);
referenceMaps[word]=(byte)((0x000000ff & firstByte) >>> 1);
if (VM.TraceStkMaps) {
VM.sysWrite(" ReferenceMaps-recordStkMap convert first map bytes- byte number = ");
VM.sysWrite(word);
VM.sysWrite(" byte value in map = ");
VM.sysWrite(referenceMaps[word]);
VM.sysWrite(" - before shift = ");
VM.sysWrite(firstByte);
VM.sysWrite("\n");
}
word++;
len-=(BITS_PER_MAP_ELEMENT - 1);
offset+=(BITS_PER_MAP_ELEMENT - 1);
while (len > 0) {
if (len <= (BITS_PER_MAP_ELEMENT - 1)) {
convertLength=len;
}
else {
convertLength=BITS_PER_MAP_ELEMENT;
}
referenceMaps[word]=convertMapElement(byteMap,offset,convertLength,BuildReferenceMaps.REFERENCE);
if (VM.TraceStkMaps) {
VM.sysWriteln(" ReferenceMaps-recordStkMap convert another map byte- byte number = ",word," byte value = ",referenceMaps[word]);
}
len-=BITS_PER_MAP_ELEMENT;
offset+=BITS_PER_MAP_ELEMENT;
word++;
}
if (VM.ReferenceMapsStatistics) {
if (!replacemap) {
}
}
}
| Given the information about a GC point, record the information in the proper tables. |
@Override public Enumeration<Option> listOptions(){
Vector<Option> result=new Vector<Option>();
result.addElement(new Option("\tNumber of clusters.\n" + "\t(default 2).","N",1,"-N <num>"));
result.addElement(new Option("\tInitialization method to use.\n\t0 = random, 1 = k-means++, " + "2 = canopy, 3 = farthest first.\n\t(default = 0)","init",1,"-init"));
result.addElement(new Option("\tUse canopies to reduce the number of distance calculations.","C",0,"-C"));
result.addElement(new Option("\tMaximum number of candidate canopies to retain in memory\n\t" + "at any one time when using canopy clustering.\n\t" + "T2 distance plus, data characteristics,\n\t"+ "will determine how many candidate canopies are formed before\n\t"+ "periodic and final pruning are performed, which might result\n\t"+ "in exceess memory consumption. This setting avoids large numbers\n\t"+ "of candidate canopies consuming memory. (default = 100)","-max-candidates",1,"-max-candidates <num>"));
result.addElement(new Option("\tHow often to prune low density canopies when using canopy clustering. \n\t" + "(default = every 10,000 training instances)","periodic-pruning",1,"-periodic-pruning <num>"));
result.addElement(new Option("\tMinimum canopy density, when using canopy clustering, below which\n\t" + " a canopy will be pruned during periodic pruning. (default = 2 instances)","min-density",1,"-min-density"));
result.addElement(new Option("\tThe T2 distance to use when using canopy clustering. Values < 0 indicate that\n\t" + "a heuristic based on attribute std. deviation should be used to set this.\n\t" + "(default = -1.0)","t2",1,"-t2"));
result.addElement(new Option("\tThe T1 distance to use when using canopy clustering. A value < 0 is taken as a\n\t" + "positive multiplier for T2. (default = -1.5)","t1",1,"-t1"));
result.addElement(new Option("\tDisplay std. deviations for centroids.\n","V",0,"-V"));
result.addElement(new Option("\tDon't replace missing values with mean/mode.\n","M",0,"-M"));
result.add(new Option("\tDistance function to use.\n" + "\t(default: weka.core.EuclideanDistance)","A",1,"-A <classname and options>"));
result.add(new Option("\tMaximum number of iterations.\n","I",1,"-I <num>"));
result.addElement(new Option("\tPreserve order of instances.\n","O",0,"-O"));
result.addElement(new Option("\tEnables faster distance calculations, using cut-off values.\n" + "\tDisables the calculation/output of squared errors/distances.\n","fast",0,"-fast"));
result.addElement(new Option("\tNumber of execution slots.\n" + "\t(default 1 - i.e. no parallelism)","num-slots",1,"-num-slots <num>"));
result.addAll(Collections.list(super.listOptions()));
return result.elements();
}
| Returns an enumeration describing the available options. |
@Override public double calculateDistance(double[] x1,double[] x2){
double norm2=norm2(x1,x2);
double exp1=sigma1 == 0.0d ? 0.0d : Math.exp((-1) * norm2 / sigma1);
double exp2=sigma2 == 0.0d ? 0.0d : Math.exp((-1) * norm2 / sigma2);
double exp3=sigma3 == 0.0d ? 0.0d : Math.exp((-1) * norm2 / sigma3);
return exp1 + exp2 - exp3;
}
| Calculates kernel value of vectors x and y. |
protected static void cleanDirectory(File dir){
for ( File file : dir.listFiles()) {
if (file.isDirectory()) {
cleanDirectory(file);
}
else {
file.delete();
}
}
dir.delete();
}
| Deletes given directory |
private SerializerReadBytes(){
}
| Creates a new instance of SerializerReadBytes |
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 ElementCreatorImpl whitelistElements(ElementKey<?,?>... elementKeys){
return whitelistElements(Lists.newArrayList(elementKeys));
}
| Whitelists a set of child elements for this element metadata. This will hide all declared child elements on the metadata instance that will be created from this builder. |
public void redriveTask(Long taskId){
State state=statesDAO.findById(taskId);
if (isTaskRedrivable(state.getStatus()) && state.getAttemptedNoOfRetries() < state.getRetryCount()) {
logger.info("Redriving a task with Id: {} for state machine: {}",state.getId(),state.getStateMachineId());
executeStates(state.getStateMachineId(),Collections.singleton(state));
}
}
| Performs task execution if the task is stalled and no.of retries are not exhausted |
@POST @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @Path("/{id}/protection/full-copies/{fcid}/activate") @CheckPermission(roles={Role.TENANT_ADMIN},acls={ACL.ANY}) public TaskList activateConsistencyGroupFullCopy(@PathParam("id") URI cgURI,@PathParam("fcid") URI fullCopyURI){
List<Volume> cgVolumes=verifyCGForFullCopyRequest(cgURI);
if (isIdEmbeddedInURL(cgURI)) {
validateVolumeNotPartOfApplication(cgVolumes,FULL_COPY);
}
URI fcSourceURI=verifyFullCopyForCopyRequest(fullCopyURI,cgVolumes);
return getFullCopyManager().activateFullCopy(fcSourceURI,fullCopyURI);
}
| Activate the specified consistency group full copy. |
public int convertGlyphToCharacterCode(final String glyph){
final Integer newID=translateToID.get(glyph);
if (newID == null) {
return 0;
}
else {
return newID;
}
}
| lookup glyph in post table (return -1 if no match |
private void initPopupMenus(){
m_PopupHeader=new JPopupMenu();
m_PopupHeader.addMouseListener(this);
m_PopupHeader.add(menuItemMean);
if (!isReadOnly()) {
m_PopupHeader.addSeparator();
m_PopupHeader.add(menuItemSetAllValues);
m_PopupHeader.add(menuItemSetMissingValues);
m_PopupHeader.add(menuItemReplaceValues);
m_PopupHeader.addSeparator();
m_PopupHeader.add(menuItemRenameAttribute);
m_PopupHeader.add(menuItemAttributeAsClass);
m_PopupHeader.add(menuItemDeleteAttribute);
m_PopupHeader.add(menuItemDeleteAttributes);
m_PopupHeader.add(menuItemSortInstances);
}
m_PopupHeader.addSeparator();
m_PopupHeader.add(menuItemOptimalColWidth);
m_PopupHeader.add(menuItemOptimalColWidths);
m_PopupRows=new JPopupMenu();
m_PopupRows.addMouseListener(this);
if (!isReadOnly()) {
m_PopupRows.add(menuItemUndo);
m_PopupRows.addSeparator();
}
m_PopupRows.add(menuItemCopy);
m_PopupRows.addSeparator();
m_PopupRows.add(menuItemSearch);
m_PopupRows.add(menuItemClearSearch);
if (!isReadOnly()) {
m_PopupRows.addSeparator();
m_PopupRows.add(menuItemDeleteSelectedInstance);
m_PopupRows.add(menuItemDeleteAllSelectedInstances);
m_PopupRows.add(menuItemInsertInstance);
}
}
| initializes the popup menus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.