code
stringlengths
10
174k
nl
stringlengths
3
129k
@DSComment("Character encoder/decoder") @DSSafe(DSCat.UTIL_FUNCTION) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:01.586 -0500",hash_original_method="B611C5CE05597AA2840AB6FA98EFB1D0",hash_generated_method="716A62D018BCE4DEC3B5E75C09F90BCC") public boolean isOverflow(){ return ((this.type) == 1); }
Returns true if this result is an overflow condition.
protected Size2D arrangeNF(BlockContainer container,Graphics2D g2,RectangleConstraint constraint){ return arrangeNN(container,g2); }
Arranges the blocks with no width constraint and a fixed height constraint. This puts all blocks into a single row.
public mxPoint drawMarker(Object type,mxPoint p0,mxPoint pe,float size,float strokeWidth){ mxPoint offset=null; double dx=pe.getX() - p0.getX(); double dy=pe.getY() - p0.getY(); double dist=Math.max(1,Math.sqrt(dx * dx + dy * dy)); double absSize=size * scale; double nx=dx * absSize / dist; double ny=dy * absSize / dist; pe=(mxPoint)pe.clone(); pe.setX(pe.getX() - nx * strokeWidth / (2 * size)); pe.setY(pe.getY() - ny * strokeWidth / (2 * size)); nx*=0.5 + strokeWidth / 2; ny*=0.5 + strokeWidth / 2; if (type.equals(mxConstants.ARROW_CLASSIC) || type.equals(mxConstants.ARROW_BLOCK)) { Polygon poly=new Polygon(); poly.addPoint((int)Math.round(pe.getX()),(int)Math.round(pe.getY())); poly.addPoint((int)Math.round(pe.getX() - nx - ny / 2),(int)Math.round(pe.getY() - ny + nx / 2)); if (type.equals(mxConstants.ARROW_CLASSIC)) { poly.addPoint((int)Math.round(pe.getX() - nx * 3 / 4),(int)Math.round(pe.getY() - ny * 3 / 4)); } poly.addPoint((int)Math.round(pe.getX() + ny / 2 - nx),(int)Math.round(pe.getY() - ny - nx / 2)); if (g.getClipBounds() == null || g.getClipBounds().intersects(poly.getBounds())) { g.fillPolygon(poly); g.drawPolygon(poly); } offset=new mxPoint(-nx * 3 / 4,-ny * 3 / 4); } else if (type.equals(mxConstants.ARROW_OPEN)) { nx*=1.2; ny*=1.2; drawLine((int)Math.round(pe.getX() - nx - ny / 2),(int)Math.round(pe.getY() - ny + nx / 2),(int)Math.round(pe.getX() - nx / 6),(int)Math.round(pe.getY() - ny / 6)); drawLine((int)Math.round(pe.getX() - nx / 6),(int)Math.round(pe.getY() - ny / 6),(int)Math.round(pe.getX() + ny / 2 - nx),(int)Math.round(pe.getY() - ny - nx / 2)); offset=new mxPoint(-nx / 4,-ny / 4); } else if (type.equals(mxConstants.ARROW_OVAL)) { nx*=1.2; ny*=1.2; absSize*=1.2; int cx=(int)Math.round(pe.getX() - nx / 2); int cy=(int)Math.round(pe.getY() - ny / 2); int a=(int)Math.round(absSize / 2); int a2=(int)Math.round(absSize); if (g.hitClip(cx - a,cy - a,a2,a2)) { g.fillOval(cx - a,cy - a,a2,a2); g.drawOval(cx - a,cy - a,a2,a2); } offset=new mxPoint(-nx / 2,-ny / 2); } else if (type.equals(mxConstants.ARROW_DIAMOND)) { nx*=1.2; ny*=1.2; Polygon poly=new Polygon(); poly.addPoint((int)Math.round(pe.getX() + nx / 2),(int)Math.round(pe.getY() + ny / 2)); poly.addPoint((int)Math.round(pe.getX() - ny / 2),(int)Math.round(pe.getY() + nx / 2)); poly.addPoint((int)Math.round(pe.getX() - nx / 2),(int)Math.round(pe.getY() - ny / 2)); poly.addPoint((int)Math.round(pe.getX() + ny / 2),(int)Math.round(pe.getY() - nx / 2)); if (g.getClipBounds() == null || g.getClipBounds().intersects(poly.getBounds())) { g.fillPolygon(poly); g.drawPolygon(poly); } } return offset; }
Draws the given type of marker.
public byte[] encodeToBitcoin(){ if (schnorr != null) { try { ByteArrayOutputStream bos=new ByteArrayOutputStream(65); bos.write(schnorr); bos.write(sighashFlags); return bos.toByteArray(); } catch ( IOException e) { throw new RuntimeException(e); } } try { ByteArrayOutputStream bos=derByteStream(); bos.write(sighashFlags); return bos.toByteArray(); } catch ( IOException e) { throw new RuntimeException(e); } }
What we get back from the signer are the two components of a signature, r and s. To get a flat byte stream of the type used by Bitcoin we have to encode them using DER encoding, which is just a way to pack the two components into a structure, and then we append a byte to the end for the sighash flags.
private long runForParallelism(int iterations,int elements,int parallelism){ MergeSort mergeSort=new MergeSort(parallelism); long[] times=new long[iterations]; for (int i=0; i < iterations; i++) { System.gc(); long start=System.currentTimeMillis(); mergeSort.sort(generateArray(elements)); times[i]=System.currentTimeMillis() - start; } return medianValue(times); }
Runs <i>iterations</i> number of test sorts of a random array of <i>element</i> length
public static void fill(boolean[] a,int fromIndex,int toIndex,boolean val){ rangeCheck(a.length,fromIndex,toIndex); for (int i=fromIndex; i < toIndex; i++) a[i]=val; }
Assigns the specified boolean value to each element of the specified range of the specified array of booleans. The range to be filled extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be filled is empty.)
public SabresQuery<T> whereEndsWith(String key,String suffix){ addWhere(key,Where.endsWith(key,suffix)); return this; }
Add a constraint for finding string values that end with a provided string.
Item newFloat(final float value){ key.set(value); Item result=get(key); if (result == null) { pool.putByte(FLOAT).putInt(key.intVal); result=new Item(index++,key); put(result); } return result; }
Adds a float to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item.
private double calcLoad(double deltaUptime,double deltaTime){ if (deltaTime <= 0 || deltaUptime == 0) { return 0.0; } return Math.min(99.0,deltaTime / (deltaUptime * osBean.getAvailableProcessors())); }
calculates a "load", given on two deltas
public JSONArray(){ this.list=new ArrayList<Object>(); }
Construct an empty JSONArray.
public void fallocate(long size){ LibaioContext.fallocate(fd,size); }
It will use fallocate to initialize a file.
public Period normalized(){ long totalMonths=toTotalMonths(); long splitYears=totalMonths / 12; int splitMonths=(int)(totalMonths % 12); if (splitYears == years && splitMonths == months) { return this; } return create(Math.toIntExact(splitYears),splitMonths,days); }
Returns a copy of this period with the years and months normalized. <p> This normalizes the years and months units, leaving the days unit unchanged. The months unit is adjusted to have an absolute value less than 11, with the years unit being adjusted to compensate. For example, a period of "1 Year and 15 months" will be normalized to "2 years and 3 months". <p> The sign of the years and months units will be the same after normalization. For example, a period of "1 year and -25 months" will be normalized to "-1 year and -1 month". <p> This instance is immutable and unaffected by this method call.
public void begin(String namespace,String name,Attributes attributes) throws Exception { assert digester.peek() instanceof MapEntriesBean : "Assertion Error: Expected MapEntriesBean to be at the top of the stack"; if (digester.getLogger().isDebugEnabled()) { digester.getLogger().debug("[MapEntryRule]{" + digester.getMatch() + "} Push "+ CLASS_NAME); } Class clazz=digester.getClassLoader().loadClass(CLASS_NAME); MapEntryBean meb=(MapEntryBean)clazz.newInstance(); digester.push(meb); }
<p>Create an empty instance of <code>MapEntryBean</code> and push it on to the object stack.</p>
private void dispatchMessage(OFMessage m){ this.switchManager.handleMessage(this.sw,m,null); }
Dispatches the message to the controller packet pipeline
public void testLinkSetConsistency1(){ doLoadData(); final ValueFactory vf=om.getValueFactory(); final URI workeruri=vf.createURI("gpo:#123"); IGPO workergpo=om.getGPO(workeruri); final URI worksFor=vf.createURI("attr:/employee#worksFor"); final ILinkSet ls=workergpo.getLinksOut(worksFor); assertTrue(ls.size() > 0); final IGPO employer=ls.iterator().next(); final ILinkSet employees=employer.getLinksIn(worksFor); assertTrue(employees.contains(workergpo)); workergpo.removeValue(worksFor,employer.getId()); assertFalse(employees.contains(workergpo)); }
Checks for reverse linkset referential integrity when property removed
public static InfererBuilder<IString,String> factory(String infererName,String... infererSpecs){ final Map<String,String> paramPairs=FactoryUtil.getParamPairs(infererSpecs); BeamFactory.BeamType beamType=null; String beamTypeStr=paramPairs.get(BEAM_TYPE_OPT); if (beamTypeStr != null) { beamType=Enum.valueOf(BeamFactory.BeamType.class,beamTypeStr); } int beamSize=-1; String beamSizeStr=paramPairs.get(BEAM_SIZE_OPT); if (beamSizeStr != null) { try { beamSize=Integer.parseInt(beamSizeStr); } catch ( NumberFormatException e) { throw new RuntimeException(String.format("Error: given beam size, %s:%s, can not be converted into an integer value",BEAM_SIZE_OPT,beamSizeStr)); } } if (infererName.equals(MULTIBEAM_DECODER)) { MultiBeamDecoder.MultiBeamDecoderBuilder<IString,String> builder=MultiBeamDecoder.builder(); if (beamSize != -1) builder.setBeamSize(beamSize); if (beamType != null) builder.setBeamType(beamType); return builder; } if (infererName.equals(CUBE_PRUNING_DECODER)) { CubePruningDecoder.CubePruningDecoderBuilder<IString,String> builder=CubePruningDecoder.builder(); if (beamSize != -1) builder.setBeamSize(beamSize); if (beamType != null) builder.setBeamType(beamType); return builder; } if (infererName.equals(DTU_DECODER)) { DTUDecoder.DTUDecoderBuilder<IString,String> builder=DTUDecoder.builder(); if (beamSize != -1) builder.setBeamSize(beamSize); if (beamType != null) builder.setBeamType(beamType); return builder; } throw new RuntimeException(String.format("Unrecognized Inferer '%s'",infererName)); }
Get an instance of an inferer.
public void testResourcePrivateMode() throws Exception { processTestGridifyResource(DeploymentMode.PRIVATE); }
Test GridDeploymentMode.ISOLATED mode.
public void publicMethod(){ }
This method should override the same public method in the base class.
private void addTuple(KeyHashValPair<MachineKey,AverageData> tuple){ MachineKey key=tuple.getKey(); dataMap.put(key,tuple.getValue()); }
This adds the given tuple to the dataMap
private void addObjectToBuilder(@NotNull StringBuilder builder,@NotNull String object,@NotNull ObjectTypes type){ builder.append(encapsulateObject(object,type)); }
Method encapsulates object, then adds object to the builder. Note the object cannot be null.
public boolean isAntiAliasedText(){ return impl.isAntiAliasedText(nativeGraphics); }
Indicates whether anti-aliasing for text is active, notice that text anti-aliasing is a separate attribute from standard anti-alisaing.
public void java_lang_Class_getDeclaringClass(SootMethod method,ReferenceVariable thisVar,ReferenceVariable returnVar,ReferenceVariable params[]){ helper.assignObjectTo(returnVar,Environment.v().getClassObject()); }
If the class or interface represented by this Class object is a member of another class, returns the Class object representing the class in which it was declared. This method returns null if this class or interface is not a member of any other class. If this Class object represents an array class, a primitive type, or void,then this method returns null. Returns: the declaring class for this class public native java.lang.Class getDeclaringClass();
public boolean hasPermissionAdministracionTotal(){ Arrays.sort(permissions); if (Arrays.binarySearch(permissions,AppPermissions.ADMINISTRACION_TOTAL_SISTEMA) >= 0) { return true; } return false; }
Indica si el usuario tiene alguno de los permisos especificados.
public static Plane constructNormalizedXPlane(final double y,final double z,final double DValue){ if (Math.abs(y) < MINIMUM_RESOLUTION && Math.abs(z) < MINIMUM_RESOLUTION) return null; final double denom=1.0 / Math.sqrt(y * y + z * z); return new Plane(0.0,z * denom,-y * denom,DValue); }
Construct a normalized plane through a y-z point and parallel to the X axis. If the y-z point is at (0,0), return null.
private String nextClipId(){ clipCounter++; return getClipId(); }
Generates a new id for a clipping path.
public void recordInvalidClassName(String name){ }
Records a class name that never exists. For example, a package name can be recorded by this method. This would improve execution performance since <code>get()</code> quickly throw an exception without searching the class path at all if the given name is an invalid name recorded by this method. Note that searching the class path takes relatively long time. <p>The current implementation of this method performs nothing.
protected void marshalCollection(Collection<T> items,HierarchicalStreamWriter writer,MarshallingContext context){ for ( T item : items) { marshalObject(item,writer,context); } }
Utility method to write a collection of children objects to the output stream.
public static long plus(long tstamp,long microseconds){ long microsmask=(long)UMASK; long newmicros=tstamp & microsmask; if ((newmicros + microseconds) <= MAX_MICROS) { tstamp+=microseconds; } else { int[] pieces=new int[NUMIDX]; ComponentTime.unpackBits(tstamp,pieces); int year=pieces[YIDX]; int month=pieces[MIDX]; int day=pieces[DIDX]; int hour=pieces[HIDX]; int minute=pieces[IIDX]; int second=pieces[SIDX]; newmicros+=microseconds; int overseconds=(int)(newmicros / 1000000L); newmicros=(newmicros % 1000000L); GregorianCalendar cal=new GregorianCalendar(year,month - 1,day,hour,minute,second); cal.add(Calendar.SECOND,overseconds); second=cal.get(Calendar.SECOND); minute=cal.get(Calendar.MINUTE); hour=cal.get(Calendar.HOUR_OF_DAY); day=cal.get(Calendar.DAY_OF_MONTH); month=cal.get(Calendar.MONTH) + 1; year=cal.get(Calendar.YEAR); tstamp=newmicros; tstamp|=((long)year) << YPOS; tstamp|=((long)month) << MPOS; tstamp|=((long)day) << DPOS; tstamp|=((long)hour) << HPOS; tstamp|=((long)minute) << IPOS; tstamp|=((long)second) << SPOS; } return (tstamp); }
Increment a component timestamp by a specifed number of microseconds (must be less than one full second)
void execute(Database db,Session systemSession,DatabaseEventListener listener){ try { Prepared command=systemSession.prepare(sql); command.setObjectId(id); command.update(); } catch ( DbException e) { e=e.addSQL(sql); SQLException s=e.getSQLException(); db.getTrace(Trace.DATABASE).error(s,sql); if (listener != null) { listener.exceptionThrown(s,sql); } else { throw e; } } }
Execute the meta data statement.
public boolean onPreferenceChange(Preference preference,Object newValue){ if (Boolean.parseBoolean(SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) { } else { setAirplaneModeOn((Boolean)newValue); } return true; }
Called when someone clicks on the checkbox preference.
public SimpleFragmentIntent<F> putExtra(String name,double[] value){ if (extras == null) { extras=new Bundle(); } extras.putDoubleArray(name,value); return this; }
Add extended data to the intent.
static boolean pairSum(int ar[],int x,Map<Integer,Integer> map){ for (int i=0; i < ar.length; i++) { if (map.containsKey(x - ar[i])) { return true; } map.put(ar[i],1); } return false; }
Using hashmap in O(n) time
public ExecutionRegion createExecutionRegion(){ ExecutionRegionImpl executionRegion=new ExecutionRegionImpl(); return executionRegion; }
<!-- begin-user-doc --> <!-- end-user-doc -->
private boolean isIOS(){ if (!System.getProperty("os.name","generic").equals("Darwin") || !System.getProperty("java.runtime.name").equals("Android Runtime")) return false; try { Class.forName("com.intel.moe.frameworks.inapppurchase.ios.PlatformIAPHelper"); return true; } catch ( ClassNotFoundException e) { return false; } }
Detect iOS platform
public void dispose(){ if (children != null) { for ( IXMLElement c : children) { c.dispose(); } } this.attributes.clear(); this.attributes=null; this.children=null; this.fullName=null; this.name=null; this.namespace=null; this.content=null; this.systemID=null; this.parent=null; }
Gets rid of the XMLElement and of all its children.
public static double rRSEmaxFitness(GEPIndividual ind){ return 1000.0; }
The max value for this type of fitness is always 1000.
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 void testGetValue2(){ DefaultCategoryDataset d=new DefaultCategoryDataset(); boolean pass=false; try { d.getValue(0,0); } catch ( IndexOutOfBoundsException e) { pass=true; } assertTrue(pass); }
A simple check for the getValue(int, int) method.
protected void sendRemoveStream(){ callbackScheduledTime=-1; if (this.hasViews()) { EventBean[] oldData=null; if (!currentBatch.isEmpty()) { oldData=currentBatch.keySet().toArray(new EventBean[currentBatch.size()]); } if (oldData != null) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qViewIndicate(this,factory.getViewName(),null,oldData); } updateChildren(null,oldData); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aViewIndicate(); } } } currentBatch.clear(); }
This method sends the remove stream for all accumulated events.
public IllegalAccessException(){ }
Constructs an IllegalAccessException without a detail message.
private void displayPopupMenu(final MouseEvent event){ final int selectedIndex=getSelectionIndex(event); if (selectedIndex != -1) { final TargetProcessThread thread=m_table.getModel().getThreads().get(selectedIndex); final IDebugger debugger=m_debugPerspectiveModel.getCurrentSelectedDebugger(); final CThreadInformationTableMenu popupMenu=new CThreadInformationTableMenu(SwingUtilities.getWindowAncestor(CThreadInformationPanel.this),debugger,thread); popupMenu.show(m_table,event.getX(),event.getY()); } }
Displays a popup menu when the user right-clicks on a thread in the table.
@Override public DateTime nowUtc(){ return new DateTime(currentTimeMillis.get(),UTC); }
Returns the current time.
public EMail createEMail(MUser from,MUser to,String subject,String message){ return createEMail(from,to,subject,message,false); }
Create EMail from User
private void doUpdate(HttpServletRequest request,SubjectAreaEditForm frm) throws Exception { Session hibSession=null; Transaction tx=null; if (frm.getUniqueId() == null) sessionContext.checkPermission(Right.SubjectAreaAdd); else sessionContext.checkPermission(frm.getUniqueId(),"SubjectArea",Right.SubjectAreaEdit); try { SubjectAreaDAO sdao=new SubjectAreaDAO(); DepartmentDAO ddao=new DepartmentDAO(); SubjectArea sa=null; Department oldDept=null; hibSession=sdao.getSession(); tx=hibSession.beginTransaction(); if (frm.getUniqueId() != null) sa=sdao.get(frm.getUniqueId()); else sa=new SubjectArea(); Department dept=ddao.get(frm.getDepartment()); HashSet<Class_> updatedClasses=new HashSet<Class_>(); sa.setSession(SessionDAO.getInstance().get(sessionContext.getUser().getCurrentAcademicSessionId(),hibSession)); sa.setSubjectAreaAbbreviation(frm.getAbbv()); if (sa.getDepartment() != null && !dept.equals(sa.getDepartment())) { HashSet availableRooms=new HashSet(); HashSet availableBuildings=new HashSet(); for (Iterator i=dept.getRoomDepts().iterator(); i.hasNext(); ) { RoomDept roomDept=(RoomDept)i.next(); availableRooms.add(roomDept.getRoom()); if (roomDept.getRoom() instanceof Room) availableBuildings.add(((Room)roomDept.getRoom()).getBuilding()); } for (Iterator i=sa.getCourseOfferings().iterator(); i.hasNext(); ) { CourseOffering co=(CourseOffering)i.next(); if (!co.getIsControl() || co.getInstructionalOffering() == null) continue; for (Iterator j=co.getInstructionalOffering().getInstrOfferingConfigs().iterator(); j.hasNext(); ) { InstrOfferingConfig ioc=(InstrOfferingConfig)j.next(); for (Iterator k=ioc.getSchedulingSubparts().iterator(); k.hasNext(); ) { SchedulingSubpart ss=(SchedulingSubpart)k.next(); if (!ss.getManagingDept().isExternalManager()) { for (Iterator l=ss.getPreferences().iterator(); l.hasNext(); ) { Preference p=(Preference)l.next(); if (p instanceof TimePref) continue; if (p instanceof RoomPref) { RoomPref rp=(RoomPref)p; if (!availableRooms.contains(rp.getRoom())) l.remove(); } else if (p instanceof BuildingPref) { BuildingPref bp=(BuildingPref)p; if (!availableBuildings.contains(bp.getBuilding())) l.remove(); } else if (p instanceof RoomFeaturePref) { RoomFeaturePref rfp=(RoomFeaturePref)p; if (rfp.getRoomFeature() instanceof DepartmentRoomFeature) l.remove(); } else if (p instanceof RoomGroupPref) { RoomGroupPref rgp=(RoomGroupPref)p; if (!rgp.getRoomGroup().isGlobal()) l.remove(); } } hibSession.saveOrUpdate(ss); } for (Iterator l=ss.getClasses().iterator(); l.hasNext(); ) { Class_ c=(Class_)l.next(); if (!c.getManagingDept().isExternalManager()) { for (Iterator m=c.getPreferences().iterator(); m.hasNext(); ) { Preference p=(Preference)m.next(); if (p instanceof TimePref) continue; if (p instanceof RoomPref) { RoomPref rp=(RoomPref)p; if (!availableRooms.contains(rp.getRoom())) m.remove(); } else if (p instanceof BuildingPref) { BuildingPref bp=(BuildingPref)p; if (!availableBuildings.contains(bp.getBuilding())) m.remove(); } else if (p instanceof RoomFeaturePref) { RoomFeaturePref rfp=(RoomFeaturePref)p; if (rfp.getRoomFeature() instanceof DepartmentRoomFeature) m.remove(); } else if (p instanceof RoomGroupPref) { RoomGroupPref rgp=(RoomGroupPref)p; if (!rgp.getRoomGroup().isGlobal()) m.remove(); } } c.setManagingDept(dept,sessionContext.getUser(),hibSession); } for (Iterator m=c.getClassInstructors().iterator(); m.hasNext(); ) { ClassInstructor ci=(ClassInstructor)m.next(); DepartmentalInstructor newInstructor=null; if (ci.getInstructor().getExternalUniqueId() != null) { newInstructor=DepartmentalInstructor.findByPuidDepartmentId(ci.getInstructor().getExternalUniqueId(),dept.getUniqueId()); } ci.getInstructor().getClasses().remove(ci); hibSession.saveOrUpdate(ci.getInstructor()); if (newInstructor != null) { ci.setInstructor(newInstructor); newInstructor.getClasses().add(ci); hibSession.saveOrUpdate(newInstructor); } else { m.remove(); hibSession.delete(ci); } } hibSession.saveOrUpdate(c); updatedClasses.add(c); } } } } for (Iterator i=sa.getDepartment().getPreferences().iterator(); i.hasNext(); ) { Preference p=(Preference)i.next(); if (p instanceof DistributionPref) { DistributionPref dp=(DistributionPref)p; boolean change=true; for (Iterator j=dp.getOrderedSetOfDistributionObjects().iterator(); j.hasNext(); ) { DistributionObject dobj=(DistributionObject)j.next(); if (dobj.getPrefGroup() instanceof SchedulingSubpart) { SchedulingSubpart ss=(SchedulingSubpart)dobj.getPrefGroup(); if (!ss.getControllingCourseOffering().getSubjectArea().equals(sa)) change=false; break; } else if (dobj.getPrefGroup() instanceof Class_) { Class_ c=(Class_)dobj.getPrefGroup(); if (!c.getSchedulingSubpart().getControllingCourseOffering().getSubjectArea().equals(sa)) change=false; break; } } if (change) { dp.setOwner(dept); hibSession.saveOrUpdate(dp); } } } oldDept=sa.getDepartment(); sa.setDepartment(dept); } else if (sa.getDepartment() == null) { sa.setDepartment(dept); } sa.setExternalUniqueId(frm.getExternalId()); sa.setTitle(frm.getTitle()); hibSession.saveOrUpdate(sa); ChangeLog.addChange(hibSession,sessionContext,sa,ChangeLog.Source.SUBJECT_AREA_EDIT,(frm.getUniqueId() == null ? ChangeLog.Operation.CREATE : ChangeLog.Operation.UPDATE),sa,dept); tx.commit(); hibSession.refresh(sa); hibSession.flush(); hibSession.refresh(sa.getSession()); if (oldDept != null) { hibSession.refresh(oldDept); hibSession.refresh(sa.getDepartment()); } String className=ApplicationProperty.ExternalActionClassEdit.value(); if (className != null && className.trim().length() > 0) { ExternalClassEditAction editAction=(ExternalClassEditAction)(Class.forName(className).newInstance()); for ( Class_ c : updatedClasses) { editAction.performExternalClassEditAction(c,hibSession); } } } catch ( Exception e) { if (tx != null) tx.rollback(); throw (e); } }
Update Subject Area
public void destroy(Contextual contextual){ String scopeId=(String)request.getAttribute(SCOPE_ID); if (null != scopeId) { HttpSession session=request.getSession(); if (contextual instanceof PassivationCapable == false) { throw new RuntimeException("Unexpected type for contextual"); } PassivationCapable pc=(PassivationCapable)contextual; final String sessionKey=SCOPE_ID + "-" + scopeId; Map<String,Object> scopeMap=(Map<String,Object>)session.getAttribute(sessionKey); if (null != scopeMap) { Object instance=scopeMap.get(INSTANCE + pc.getId()); CreationalContext<?> creational=(CreationalContext<?>)scopeMap.get(CREATIONAL + pc.getId()); if (null != instance && null != creational) { contextual.destroy(instance,creational); creational.release(); } } } }
Destroy the instance.
public UnitChooser(final Collection<Unit> units,final Map<Unit,Collection<Unit>> dependent,final GameData data,final boolean allowTwoHit,final IUIContext uiContext){ this(units,Collections.emptyList(),dependent,data,allowTwoHit,uiContext); }
Creates new UnitChooser
public Hours toStandardHours(){ return Hours.hours(FieldUtils.safeMultiply(getValue(),DateTimeConstants.HOURS_PER_DAY)); }
Converts this period in days to a period in hours assuming a 24 hour day. <p> This method allows you to convert between different types of period. However to achieve this it makes the assumption that all days are 24 hours long. This is not true when daylight savings is considered and may also not be true for some unusual chronologies. However, it is included as it is a useful operation for many applications and business rules.
private void syncDestination(State state){ FileOutputStream downloadedFileStream=null; try { downloadedFileStream=new FileOutputStream(state.mFilename,true); downloadedFileStream.getFD().sync(); } catch ( FileNotFoundException ex) { Log.w(Constants.TAG,"file " + state.mFilename + " not found: "+ ex); } catch ( SyncFailedException ex) { Log.w(Constants.TAG,"file " + state.mFilename + " sync failed: "+ ex); } catch ( IOException ex) { Log.w(Constants.TAG,"IOException trying to sync " + state.mFilename + ": "+ ex); } catch ( RuntimeException ex) { Log.w(Constants.TAG,"exception while syncing file: ",ex); } finally { if (downloadedFileStream != null) { try { downloadedFileStream.close(); } catch ( IOException ex) { Log.w(Constants.TAG,"IOException while closing synced file: ",ex); } catch ( RuntimeException ex) { Log.w(Constants.TAG,"exception while closing file: ",ex); } } } }
Sync the destination file to storage.
private void restoreModules(Snapshot snapshot,Application application,String tag) throws ServiceException { for ( String key : snapshot.getAppConfig().keySet()) { try { hookService.call(snapshot.getAppConfig().get(key).getName(),RemoteExecAction.CLONE_PRE_ACTION); Module module=ModuleFactory.getModule(snapshot.getAppConfig().get(key).getName()); module.setApplication(application); moduleService.checkImageExist(snapshot.getAppConfig().get(key).getName()); module.getImage().setName(snapshot.getAppConfig().get(key).getName()); module.setName(snapshot.getAppConfig().get(key).getName()); Map<String,String> properties=new HashMap<>(); properties.put("username",snapshot.getAppConfig().get(key).getProperties().get("username-" + module.getImage().getName())); properties.put("password",snapshot.getAppConfig().get(key).getProperties().get("password-" + module.getImage().getName())); properties.put("database",snapshot.getAppConfig().get(key).getProperties().get("database-" + module.getImage().getName())); if (tag != null) { restoreDataModule(module); } hookService.call(snapshot.getAppConfig().get(key).getName(),RemoteExecAction.CLONE_POST_ACTION); } catch ( CheckException e) { throw new ServiceException(e.getLocalizedMessage(),e); } } }
Restore all modules
public int segmentCount(){ return segments.length; }
Returns the number of segments in this path. <p> Note that both root and empty paths have 0 segments. </p>
public boolean willViewBeDetachedBecauseOrientationChange(Context context){ OrientationChangeFragment fragment=getFragment(context); return fragment.stopped; }
Determines if the view will be detached from window (destroyed) because of an orientation change
public SimpleProjectDependency createSimpleProjectDependency(){ SimpleProjectDependencyImpl simpleProjectDependency=new SimpleProjectDependencyImpl(); return simpleProjectDependency; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void reset(){ mLastSelectedItem=MenuItem.MENU_ITEM1; }
Initializes the drawer state.
private void updateProgress(int progress){ if (myHost != null) { myHost.updateProgress(progress); } else { System.out.println("Progress: " + progress + "%"); } }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public String addAttribute(String typeUri,boolean required) throws MessageException { String alias=generateAlias(); addAttribute(alias,typeUri,required,1); return alias; }
Adds an attribute to the fetch request, with a default value-count of 1. An alias is generated for the provided type URI.
public boolean isMaximizable(){ return maximizable; }
Gets the value of the <code>maximizable</code> property.
public int size(){ return this.hmap.size(); }
Return the size of the embedded map
public void initializeBlockingSensors(){ List<String> list=getSystemNameList(); for (int i=0; i < list.size(); i++) { Section s=getBySystemName(list.get(i)); try { if (s.getForwardBlockingSensor() != null) { s.getForwardBlockingSensor().setState(Sensor.ACTIVE); } if (s.getReverseBlockingSensor() != null) { s.getReverseBlockingSensor().setState(Sensor.ACTIVE); } } catch ( jmri.JmriException reason) { log.error("Exception when initializing blocking Sensors for Section " + s.getSystemName()); } } }
Initialize all blocking sensors that exist - sets them to 'ACTIVE'
protected void forceSetComponentCount(int count){ mComponentCountActual=count; }
Sets the component count of this tag. Call this function before setValue() if the length of value does not match the component count.
public static int readSingleByte(InputStream in) throws IOException { byte[] buffer=new byte[1]; int result=in.read(buffer,0,1); return (result != -1) ? buffer[0] & 0xff : -1; }
Implements InputStream.read(int) in terms of InputStream.read(byte[], int, int). InputStream assumes that you implement InputStream.read(int) and provides default implementations of the others, but often the opposite is more efficient.
int generateSrc(Mappings map){ try { int len; Object o[]; String outputDir=Main.getOutputDir(); FileWriter fw1, fw2; BufferedWriter out1, out2; Map<String,String> a=map.getAliases(); if (a == null) { Main.panic("Data not exist. (aliases)"); return 1; } timezoneList.putAll(a); if (!outputDir.endsWith(File.separator)) { outputDir+=File.separatorChar; } outputDir+=docDir + File.separatorChar; File outD=new File(outputDir); outD.mkdirs(); fw1=new FileWriter(outputDir + "index.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ "<FRAMESET cols=\"20%,80%\">\n"+ "<FRAMESET rows=\"30%,70%\">\n"+ "<FRAME src=\"overview-frame.html\" name=\"TimeZoneListFrame\">\n"+ "<FRAME src=\"allTimeZone-frame1.html\" name=\"allTimeZoneFrame\">\n"+ "</FRAMESET>"+ "<FRAME src=\"overview-summary.html\" name=\"rightFrame\">\n"+ "</FRAMESET>\n"+ "<NOFRAMES>\n"+ "<H2>\nFrame Alert\n</H2>\n\n"+ "<P>\n\n"+ "This document is designed to be viewed using the frames feature. If you see this\n"+ "message, you are using a non-frame-capable web client.\n"+ "<BR>\n"+ "Link to<A HREF=\"overview-summary.html\">Non-frame version.</A>\n"+ "</NOFRAMES>\n"+ footer); out1.close(); fw1.close(); fw1=new FileWriter(outputDir + "overview-frame.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ body1+ "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n<TR>\n"+ "<TD NOWRAP><FONT size=\"+1\">\n"+ "<B>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed.</B></FONT></TD>\n"+ "</TR>\n</TABLE>\n\n"+ "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n<TR>\n<TD NOWRAP>"+ "<P>\n<FONT size=\"+1\">\nAll Time Zones Sorted By:</FONT>\n<BR>\n"+ "&nbsp;&nbsp;<A HREF=\"allTimeZone-frame1.html\" TARGET=\"allTimeZoneFrame\">GMT offsets</A></FONT>\n<BR>\n"+ "&nbsp;&nbsp;<A HREF=\"allTimeZone-frame2.html\" TARGET=\"allTimeZoneFrame\">Zone names</A></FONT>\n<BR>"+ "&nbsp;&nbsp;<A HREF=\"allTimeZone-frame3.html\" TARGET=\"allTimeZoneFrame\">City names</A></FONT>\n"+ "<P>\n<FONT size=\"+1\">\nContinents and Oceans</FONT>\n<BR>\n"); for ( String regionKey : regionList.keySet()) { out1.write("&nbsp;&nbsp;<A HREF=\"" + regionList.get(regionKey) + "\" TARGET=\"allTimeZoneFrame\">"+ regionKey+ "</A><BR>\n"); fw2=new FileWriter(outputDir + regionList.get(regionKey),false); out2=new BufferedWriter(fw2); out2.write(header1 + new Date() + header3+ regionKey+ header4+ body1+ "<FONT size=\"+1\"><B>"+ regionKey+ "</B></FONT>\n<BR>\n<TABLE>\n<TR>\n<TD>"); boolean found=false; for ( String timezoneKey : timezoneList.keySet()) { int regionIndex=timezoneKey.indexOf('/'); if (regionIndex == -1 || !regionKey.equals(timezoneKey.substring(0,regionIndex))) { if (found) { break; } else { continue; } } found=true; if (a.containsKey(timezoneKey)) { Object realName=a.get(timezoneKey); while (a.containsKey(realName)) { realName=a.get(realName); } out2.write(timezoneKey + " (alias for " + "<A HREF=\""+ timezoneList.get(realName)+ "\" TARGET=\"rightFrame\">"+ realName+ "</A>)"); } else { out2.write("<A HREF=\"" + timezoneList.get(timezoneKey) + "\" TARGET=\"rightFrame\">"+ timezoneKey+ "</A>"); } out2.write("<BR>\n"); } out2.write("</TD>\n</TR>\n</TABLE>\n" + body2 + footer); out2.close(); fw2.close(); } out1.write("</FONT></TD>\n</TR></TABLE>\n" + body2 + footer); out1.close(); fw1.close(); fw1=new FileWriter(outputDir + "allTimeZone-frame1.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ body1+ "<FONT size=\"+1\"><B>Sorted by GMT offsets</B></FONT>\n"+ "<BR>\n\n"+ "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n"+ "<TR>\n<TD NOWRAP>\n"); List<Integer> roi=map.getRawOffsetsIndex(); List<Set<String>> roit=map.getRawOffsetsIndexTable(); int index=0; for ( Integer offset : zonesByOffset.keySet()) { int off=roi.get(index); Set<String> perRO=zonesByOffset.get(offset); if (offset == off) { perRO.addAll(roit.get(index)); } index++; for ( String timezoneKey : perRO) { out1.write("<TR>\n<TD><FONT SIZE=\"-1\">(" + Time.toGMTFormat(offset.toString()) + ")</FONT></TD>\n<TD>"); if (a.containsKey(timezoneKey)) { Object realName=a.get(timezoneKey); while (a.containsKey(realName)) { realName=a.get(realName); } out1.write(timezoneKey + " (alias for " + "<A HREF=\""+ timezoneList.get(realName)+ "\" TARGET=\"rightFrame\">"+ realName+ "</A>)"); } else { out1.write("<A HREF=\"" + timezoneList.get(timezoneKey) + "\" TARGET=\"rightFrame\">"+ timezoneKey+ "</A>"); } out1.write("</TD>\n</TR>\n"); } } out1.write("</FONT></TD>\n</TR>\n</TABLE>\n" + body2 + footer); out1.close(); fw1.close(); fw1=new FileWriter(outputDir + "allTimeZone-frame2.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ body1+ "<FONT size=\"+1\"><B>Sorted by zone names</B></FONT>\n"+ "<BR>\n\n"+ "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n"+ "<TR>\n<TD NOWRAP>\n"); o=timezoneList.keySet().toArray(); len=timezoneList.size(); for (int i=0; i < len; i++) { Object timezoneKey=o[i]; if (a.containsKey(timezoneKey)) { Object realName=a.get(timezoneKey); while (a.containsKey(realName)) { realName=a.get(realName); } out1.write(timezoneKey + " (alias for " + "<A HREF=\""+ timezoneList.get(realName)+ "\" TARGET=\"rightFrame\">"+ realName+ "</A>)"); } else { out1.write("<A HREF=\"" + timezoneList.get(timezoneKey) + "\" TARGET=\"rightFrame\">"+ timezoneKey+ "</A>"); } out1.write("<BR> \n"); } out1.write("</FONT></TD>\n</TR>\n</TABLE>\n" + body2 + footer); out1.close(); fw1.close(); fw1=new FileWriter(outputDir + "allTimeZone-frame3.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ body1+ "<FONT size=\"+1\"><B>Sorted by city names</B></FONT>\n"+ "<BR>\n\n"+ "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n"+ "<TR>\n<TD NOWRAP>\n"); Set<String> aliasSet=a.keySet(); len=aliasSet.size(); String aliasNames[]=aliasSet.toArray(new String[0]); for (int i=0; i < len; i++) { displayNameList.put(transform(aliasNames[i]),aliasNames[i]); } o=displayNameList.keySet().toArray(); len=displayNameList.size(); for (int i=0; i < len; i++) { Object displayName=o[i]; Object timezoneKey=displayNameList.get(o[i]); if (a.containsKey(timezoneKey)) { Object realName=a.get(timezoneKey); while (a.containsKey(realName)) { realName=a.get(realName); } out1.write(displayName + " (alias for " + "<A HREF=\""+ timezoneList.get(realName)+ "\" TARGET=\"rightFrame\">"+ realName+ "</A>)"); } else { out1.write("<A HREF=\"" + timezoneList.get(timezoneKey) + "\" TARGET=\"rightFrame\">"+ displayName+ "</A>"); } out1.write("<BR> \n"); } out1.write("</FONT></TD>\n</TR>\n</TABLE>\n" + body2 + footer); out1.close(); fw1.close(); fw1=new FileWriter(outputDir + "overview-summary.html",false); out1=new BufferedWriter(fw1); out1.write(header1 + new Date() + header2+ Main.getVersionName()+ header4+ body1+ "<p>This is the list of time zones generated from <B>"+ Main.getVersionName()+ "</B> for Java Platform, "+ "Standard Edition. The source code can be obtained "+ "from ftp site <a href=\"ftp://elsie.nci.nih.gov/pub/\">"+ "ftp://elsie.nci.nih.gov/pub/</a>. A total of <B>"+ len+ "</B> time zones and aliases are supported "+ "in this edition. For the "+ "format of rules and zones, refer to the zic "+ "(zoneinfo compiler) man page on "+ "Solaris or Linux.</p>\n"+ "<p>Note that the time zone data is not "+ "a public interface of the Java Platform. No "+ "applications should rely on the time zone data of "+ "this document. Time zone names and data "+ "may change without any prior notice.</p>\n"+ body2+ footer); out1.close(); fw1.close(); } catch ( IOException e) { Main.panic("IO error: " + e.getMessage()); return 1; } return 0; }
Generates index.html and other top-level frame files.
@SuppressWarnings("unchecked") public EnumeratedData(DataSource original,double offset,double steps){ this.original=original; this.offset=offset; this.steps=steps; Class<? extends Comparable<?>>[] typesOrig=original.getColumnTypes(); Class<? extends Comparable<?>>[] types=new Class[typesOrig.length + 1]; System.arraycopy(typesOrig,0,types,1,typesOrig.length); types[0]=Double.class; setColumnTypes(types); original.addDataListener(this); }
Initializes a new data source based on an original data source which will contain an additional column which enumerates all rows. The enumeration will start at a specified offset and will have a specified step size.
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.legendShape=SerialUtilities.readShape(stream); }
Provides serialization support.
public SVGDocument createSVGDocument(String uri,Reader r) throws IOException { return (SVGDocument)createDocument(uri,r); }
Creates a SVG Document instance.
public void startInternalActivity(Intent intent,boolean requireBackStack){ helper.startInternalActivity(intent,requireBackStack); }
Starts an internal activity and keeps password if already present
public void reset(){ }
Reset for fresh reuse.
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:01:11.940 -0500",hash_original_method="2BD2C11E492A0926A3928FBE6062AA1A",hash_generated_method="432462BB27832EACC9C5D0D13F532176") @Override public String toString(){ return "[SSLServerSocketImpl]"; }
Returns the string representation of the object.
public int size(){ return count; }
<p>Returns the number of keys in this hashtable.</p>
public String nextToken(){ if (currentPosition >= maxPosition) { throw new NoSuchElementException(); } int start=currentPosition; while ((currentPosition < maxPosition) && Character.isLetterOrDigit(str.charAt(currentPosition))) { currentPosition++; } if ((start == currentPosition) && (!Character.isLetterOrDigit(str.charAt(currentPosition)))) { currentPosition++; } return str.substring(start,currentPosition); }
Returns the next token from this string tokenizer.
public void clear(int bitIndex){ if (bitIndex < 0) { throw new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex); } int unitIndex=unitIndex(bitIndex); if (unitIndex >= unitsInUse) { return; } bits[unitIndex]&=~bit(bitIndex); if (bits[unitsInUse - 1] == 0) recalculateUnitsInUse(); }
Sets the bit specified by the index to <code>false</code>.
public boolean isGenerated(){ Object oo=get_Value(COLUMNNAME_IsGenerated); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Generated.
public void endNonEscaping() throws org.xml.sax.SAXException { m_disableOutputEscapingStates.pop(); }
Ends an un-escaping section.
@Override public List<ReilInstruction> translate(final ITranslationEnvironment environment,final InstructionType instruction,final List<ITranslationExtension<InstructionType>> extensions) throws InternalTranslationException { Preconditions.checkNotNull(environment,"Error: Argument environment can't be null"); Preconditions.checkNotNull(instruction,"Error: Argument instruction can't be null"); final String mnemonic=instruction.getMnemonic(); if (mnemonic == null) { return new ArrayList<ReilInstruction>(); } final IInstructionTranslator translator=translators.get(mnemonic.toLowerCase()); if (translators.containsKey(mnemonic.toLowerCase())) { final ArrayList<ReilInstruction> instructions=new ArrayList<ReilInstruction>(); translator.translate(environment,instruction,instructions); for ( final ITranslationExtension<InstructionType> extension : extensions) { extension.postProcess(environment,instruction,instructions); } return instructions; } else { return Lists.newArrayList(ReilHelpers.createUnknown(ReilHelpers.toReilAddress(instruction.getAddress()).toLong())); } }
Translates a MIPS instruction to REIL code
public float[] ToArray(){ return points; }
To array.
public void dispose(){ g.dispose(); }
Disposes of this graphics context and releases any system resources that it is using. A <code>Graphics</code> object cannot be used after <code>dispose</code>has been called. <p> When a Java program runs, a large number of <code>Graphics</code> objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time. <p> Graphics objects which are provided as arguments to the <code>paint</code> and <code>update</code> methods of components are automatically released by the system when those methods return. For efficiency, programmers should call <code>dispose</code> when finished using a <code>Graphics</code> object only if it was created directly from a component or another <code>Graphics</code> object.
private static void writeJson() throws IOException { OutputStream outputStream=new ByteArrayOutputStream(); JsonWriter writer=new JsonWriter(new OutputStreamWriter(outputStream,"UTF-8")); writer.beginObject(); writer.name("message"); writer.value("Hi"); writer.name("place"); writer.beginObject(); writer.name("name"); writer.value("World!"); writer.endObject(); writer.endObject(); writer.close(); System.out.println(outputStream.toString()); }
Example to writeJson using StreamingAPI
private static Properties loadProperties(){ Properties properties=new Properties(); File file=new File("DataPartitioner.properties"); FileInputStream fis=null; try { if (file.exists()) { fis=new FileInputStream(file); properties.load(fis); } } catch ( Exception e) { LOGGER.error(e,e.getMessage()); } finally { if (null != fis) { try { fis.close(); } catch ( IOException e) { LOGGER.error(e,e.getMessage()); } } } return properties; }
Read the properties from CSVFilePartitioner.properties
protected void parseMemberName(final String[] args){ for ( String arg : args) { if (!(arg.startsWith(OPTION_PREFIX) || Command.isCommand(arg))) { setMemberName(arg); break; } } }
Iterates the list of arguments in search of the Locator's GemFire member name. If the argument does not start with '-' or is not the name of a Locator launcher command, then the value is presumed to be the member name for the Locator in GemFire.
@Override boolean complete(Object result,Throwable failure,boolean checkArgs){ synchronized (future) { if (!completeCalled) { if (super.complete(result,failure,checkArgs)) future.complete(result,failure,config.fallback,success); completeCalled=true; } return completed; } }
Attempts to complete the parent execution, calls failure handlers, and completes the future if needed.
public ApplicationIdSpeechletRequestVerifier(Set<String> supportedApplicationIds){ this.supportedApplicationIds=Collections.unmodifiableSet(new HashSet<String>(supportedApplicationIds)); }
Constructs a new application ID verifier with the provided set of supported application IDs. If the set is empty, this verifier will support any application ID (including null values).
private void match(int ttype,String token) throws ParserException, IOException { if (lookahead.ttype == ttype && lookahead.sval.compareTo(token) == 0) { nextToken(); } else { throw new SyntaxException(st.lineno(),new Token(ttype,token),lookahead); } }
match a token with TT_TYPE=type, and the token value is a given sequence of characters.
public boolean moveToSlot(@Nonnull IInventory inv,@Nonnull ItemStack filter,int from,int to){ if (!checkSlotAndSize(inv,filter,from)) return false; final ItemStack stack=inv.decrStackSize(from,filter.stackSize); inv.setInventorySlotContents(to,stack); return true; }
Moves item from slot `from` to slot `to`
public final void testSetHintTextColorWithIntegerParameter(){ int color=Color.BLACK; ArrayAdapter<CharSequence> adapter=new ArrayAdapter<CharSequence>(getContext(),android.R.layout.simple_spinner_dropdown_item,new CharSequence[]{"entry1","entry2"}); Spinner spinner=new Spinner(getContext()); spinner.setAdapter(adapter); spinner.setHintTextColor(color); assertEquals(color,spinner.getHintTextColors().getDefaultColor()); }
Tests the functionality of the method, which allows to set the hint text color and expects an integer as a parameter.
public void move(RepositoryLocation source,Folder destination,String newName,boolean overwriteIfExists,ProgressListener listener) throws RepositoryException { Entry entry=source.locateEntry(); if (entry == null) { throw new RepositoryException("No such entry: " + source); } else { String sourceAbsolutePath=source.getAbsoluteLocation(); String destinationAbsolutePath; if (!(entry instanceof Folder)) { destinationAbsolutePath=destination.getLocation().getAbsoluteLocation() + RepositoryLocation.SEPARATOR + source.getName(); } else { destinationAbsolutePath=destination.getLocation().getAbsoluteLocation(); } if (sourceAbsolutePath.equals(destinationAbsolutePath)) { throw new RepositoryException(I18N.getMessage(I18N.getErrorBundle(),"repository.repository_move_same_folder")); } if (RepositoryGuiTools.isSuccessor(sourceAbsolutePath,destinationAbsolutePath)) { throw new RepositoryException(I18N.getMessage(I18N.getErrorBundle(),"repository.repository_move_into_subfolder")); } if (destination.getLocation().getRepository() != source.getRepository()) { copy(source,destination,newName,listener); entry.delete(); } else { String effectiveNewName=newName != null ? newName : entry.getName(); Entry toDeleteEntry=null; if (destination.containsEntry(effectiveNewName)) { if (overwriteIfExists) { for ( DataEntry dataEntry : destination.getDataEntries()) { if (dataEntry.getName().equals(effectiveNewName)) { toDeleteEntry=dataEntry; } } for ( Folder folderEntry : destination.getSubfolders()) { if (folderEntry.getName().equals(effectiveNewName)) { toDeleteEntry=folderEntry; } } if (toDeleteEntry != null) { toDeleteEntry.delete(); } } else { newName=getNewNameForExistingEntry(destination,effectiveNewName); } } if (listener != null) { listener.setTotal(100); listener.setCompleted(10); } if (newName == null) { entry.move(destination); } else { entry.move(destination,newName); } if (listener != null) { listener.setCompleted(100); listener.complete(); } } } }
Moves an entry to a given destination folder with the name newName.
public void printCfMaps(){ Iterator it=_cfMap.entrySet().iterator(); while (it.hasNext()) { Entry entry=(Entry)it.next(); System.out.println(String.format("\t\tColumn family: %s",entry.getKey())); } }
Print column families.
protected boolean canNavigate(){ return true; }
If on ground or swimming and can swim
public void destination(Object buildDir){ this.destination=buildDir; }
Sets the target directory.
public void reset(){ digest.reset(); digest.update(inputPad,0,inputPad.length); }
Reset the mac generator.
private final void addCount(long x,int check){ CounterCell[] as; long b, s; if ((as=counterCells) != null || !U.compareAndSwapLong(this,BASECOUNT,b=baseCount,s=b + x)) { CounterHashCode hc; CounterCell a; long v; int m; boolean uncontended=true; if ((hc=threadCounterHashCode.get()) == null || as == null || (m=as.length - 1) < 0 || (a=as[m & hc.code]) == null || !(uncontended=U.compareAndSwapLong(a,CELLVALUE,v=a.value,v + x))) { fullAddCount(x,hc,uncontended); return; } if (check <= 1) return; s=sumCount(); } if (check >= 0) { Node<V>[] tab, nt; int n, sc; while (s >= (long)(sc=sizeCtl) && (tab=table) != null && (n=tab.length) < MAXIMUM_CAPACITY) { int rs=resizeStamp(n); if (sc < 0) { if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || sc == rs + MAX_RESIZERS || (nt=nextTable) == null || transferIndex <= 0) break; if (U.compareAndSwapInt(this,SIZECTL,sc,sc + 1)) transfer(tab,nt); } else if (U.compareAndSwapInt(this,SIZECTL,sc,(rs << RESIZE_STAMP_SHIFT) + 2)) transfer(tab,null); s=sumCount(); } } }
Adds to count, and if table is too small and not already resizing, initiates transfer. If already resizing, helps perform transfer if work is available. Rechecks occupancy after a transfer to see if another resize is already needed because resizings are lagging additions.
public static boolean isNumber(String s){ if (s.length() == 0) { return false; } for ( char c : s.toCharArray()) { if (!Character.isDigit(c)) { return false; } } return true; }
Check if this string is a decimal number.
public boolean isValidSimpleAssignmentTarget(){ return false; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public final void addStringArray(String[] s){ for ( String line : s) { this.appendLine(line); } }
Adds the Strings in the given Arrary to the XmppMsg One String per line
public void rollback(final Set<String> graphSourceNamesToCloseTxOn){ closeTx(graphSourceNamesToCloseTxOn,Transaction.Status.ROLLBACK); }
Selectively rollback transactions on the specified graphs or the graphs of traversal sources.
private static void validateBodyLoggingOverrideParameters(){ boolean checkEnableOverrides=isSoapBodyLoggingEnabled(); validateBodyLoggingOverrideParamNotUsed(checkEnableOverrides,true); validateBodyLoggingOverrideParamNotUsed(checkEnableOverrides,false); }
Check that "enableBodyLogging..." parameters are not used if body logging is toggled on, and vice versa.
public static boolean isLanguageLiteral(Literal literal){ return Objects.requireNonNull(literal,"Literal cannot be null").getLanguage().isPresent(); }
Helper method to determine whether a literal is a language literal, and not a typed literal.
LookupEnvironment lookupEnvironment(){ return null; }
Returns the compiler lookup environment used by this binding resolver. Returns <code>null</code> if none.
public static List<LicenseInfo> decodeLicenses(String infoStr) throws Exception { _log.info("Retrieving licenses from coordinator service"); List<LicenseInfo> licenseList=new ArrayList<LicenseInfo>(); if (infoStr != null && !infoStr.isEmpty()) { for ( String licenseStr : infoStr.split(LICENSE_SEPARATOR)) { String expireDate=null; LicenseType licenseType=null; for ( String licenseProps : licenseStr.split(ENCODING_SEPARATOR)) { String[] licenseProp=licenseProps.split(ENCODING_EQUAL); if (licenseProp.length < 2) { continue; } if (licenseProp[0].equalsIgnoreCase(LICENSE_TYPE)) { licenseType=LicenseType.findByValue(licenseProp[1]); } if (licenseProp[0].equalsIgnoreCase(EXPIRATION_DATE)) { expireDate=licenseProp[1]; } if (licenseType != null && expireDate != null) { licenseList.add(new LicenseInfo(licenseType,expireDate)); break; } } } } return licenseList; }
Method used for decoding a list of licenses from the string.
public void resetBase(){ init(); }
Resets the axis to its default value. Same as init().
@Override public void finishStage(ResponseBuilder rb){ if (rb.stage != ResponseBuilder.STAGE_GET_FIELDS) { return; } mergeResponses(rb); }
private void handleRegularResponses(ResponseBuilder rb, ShardRequest sreq) { }
public static boolean requiresBidi(char[] text,int start,int limit){ final int RTLMask=(1 << Bidi.DIRECTION_RIGHT_TO_LEFT | 1 << AL | 1 << RLE | 1 << RLO | 1 << AN); if (0 > start || start > limit || limit > text.length) { throw new IllegalArgumentException("Value start " + start + " is out of range 0 to "+ limit); } for (int i=start; i < limit; ++i) { if (Character.isHighSurrogate(text[i]) && i < (limit - 1) && Character.isLowSurrogate(text[i + 1])) { if (((1 << UCharacter.getDirection(Character.codePointAt(text,i))) & RTLMask) != 0) { return true; } } else if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) { return true; } } return false; }
Return true if the specified text requires bidi analysis. If this returns false, the text will display left-to-right. Clients can then avoid constructing a Bidi object. Text in the Arabic Presentation Forms area of Unicode is presumed to already be shaped and ordered for display, and so will not cause this method to return true.