code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public DynamicGVTBuilder(){
}
| Constructs a new builder. |
public void searchRaceWithEntrant(String stream){
entrantToSearch=stream;
raceFinder.setLocationRelativeTo(parent);
raceFinder.open(stream);
if (isDataStale()) {
reload();
}
else {
searchRaceWithEntrant(currentRaces);
}
}
| Search for a race with the given entrant. Opens the race finder as appropriate feedback and either request data if it is old or immediately start searching in the cached data. |
public static <V,V1 extends V,V2 extends V,V3 extends V,V4 extends V>Map<String,V> toMap(String name1,V1 value1,String name2,V2 value2,String name3,V3 value3,String name4,V4 value4){
return populateMap(new HashMap<String,V>(),name1,value1,name2,value2,name3,value3,name4,value4);
}
| Create a map from passed nameX, valueX parameters |
synchronized private boolean scatter(final Value predecessor,final double newDist){
if (newDist < dist) {
dist=newDist;
this.predecessor.set(predecessor);
return true;
}
return false;
}
| Update the vertex state to the new (reduced) distance. |
@Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case ImPackage.SNIPPET__CODE:
setCode((String)newValue);
return;
}
super.eSet(featureID,newValue);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static Instances read(InputStream stream) throws Exception {
DataSource source;
Instances result;
source=new DataSource(stream);
result=source.getDataSet();
return result;
}
| convencience method for loading a dataset in batch mode from a stream. |
private void updateLastKnown(List<AuthnProvider> knownProviders){
_lastKnownConfiguration=new HashMap<URI,Long>();
for ( AuthnProvider provider : knownProviders) {
_lastKnownConfiguration.put(provider.getId(),provider.getLastModified());
}
_lastKnownLdapConnectionTimeout=SystemPropertyUtil.getLdapConnectionTimeout(_coordinator);
}
| update out last known provider config information |
public TestConfigurationBuilder(TestConfiguration initialConfig){
this.diagnosticFiles=new ArrayList<>(initialConfig.getDiagnosticFiles());
this.testSourceFiles=new ArrayList<>(initialConfig.getTestSourceFiles());
this.processors=new LinkedHashSet<>(initialConfig.getProcessors());
this.options=new SimpleOptionMap();
this.addOptions(initialConfig.getOptions());
this.shouldEmitDebugInfo=initialConfig.shouldEmitDebugInfo();
}
| Create a builder that has all of the optoins in initialConfig |
public TDoubleHashSet(int initialCapacity,TDoubleHashingStrategy strategy){
super(initialCapacity,strategy);
}
| Creates a new <code>TDoubleHash</code> instance whose capacity is the next highest prime above <tt>initialCapacity + 1</tt> unless that value is already prime. |
public DistributedLogManager createDistributedLogManager(String nameOfLogStream,ClientSharingOption clientSharingOption,Optional<DistributedLogConfiguration> streamConfiguration,Optional<DynamicDistributedLogConfiguration> dynamicStreamConfiguration) throws InvalidStreamNameException, IOException {
return namespace.createDistributedLogManager(nameOfLogStream,clientSharingOption,streamConfiguration,dynamicStreamConfiguration);
}
| Create a DistributedLogManager for <i>nameOfLogStream</i>, with specified client sharing options. This method allows the caller to override global configuration options by supplying stream configuration overrides. Stream config overrides come in two flavors, static and dynamic. Static config never changes, and DynamicDistributedLogConfiguration is a) reloaded periodically and b) safe to access from any context. |
public static Bitmap createThumbnailBitmap(Bitmap bitmap,Context context){
int sIconWidth=-1;
int sIconHeight=-1;
final Resources resources=context.getResources();
sIconWidth=sIconHeight=(int)resources.getDimension(android.R.dimen.app_icon_size);
final Paint sPaint=new Paint();
final Rect sBounds=new Rect();
final Rect sOldBounds=new Rect();
Canvas sCanvas=new Canvas();
int width=sIconWidth;
int height=sIconHeight;
sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,Paint.FILTER_BITMAP_FLAG));
final int bitmapWidth=bitmap.getWidth();
final int bitmapHeight=bitmap.getHeight();
if (width > 0 && height > 0) {
if (width < bitmapWidth || height < bitmapHeight) {
final float ratio=(float)bitmapWidth / bitmapHeight;
if (bitmapWidth > bitmapHeight) {
height=(int)(width / ratio);
}
else if (bitmapHeight > bitmapWidth) {
width=(int)(height * ratio);
}
final Config c=(width == sIconWidth && height == sIconHeight) ? bitmap.getConfig() : Config.ARGB_8888;
final Bitmap thumb=Bitmap.createBitmap(sIconWidth,sIconHeight,c);
final Canvas canvas=sCanvas;
final Paint paint=sPaint;
canvas.setBitmap(thumb);
paint.setDither(false);
paint.setFilterBitmap(true);
sBounds.set((sIconWidth - width) / 2,(sIconHeight - height) / 2,width,height);
sOldBounds.set(0,0,bitmapWidth,bitmapHeight);
canvas.drawBitmap(bitmap,sOldBounds,sBounds,paint);
return thumb;
}
else if (bitmapWidth < width || bitmapHeight < height) {
final Config c=Config.ARGB_8888;
final Bitmap thumb=Bitmap.createBitmap(sIconWidth,sIconHeight,c);
final Canvas canvas=sCanvas;
final Paint paint=sPaint;
canvas.setBitmap(thumb);
paint.setDither(false);
paint.setFilterBitmap(true);
canvas.drawBitmap(bitmap,(sIconWidth - bitmapWidth) / 2,(sIconHeight - bitmapHeight) / 2,paint);
return thumb;
}
}
return bitmap;
}
| Returns a Bitmap representing the thumbnail of the specified Bitmap. The size of the thumbnail is defined by the dimension android.R.dimen.launcher_application_icon_size. <p/> This method is not thread-safe and should be invoked on the UI thread only. |
public void start(@NonNull Context context,@NonNull android.support.v4.app.Fragment fragment){
if (PermissionsUtils.checkReadStoragePermission(fragment.getActivity())) {
fragment.startActivityForResult(getIntent(context),REQUEST_CODE);
}
}
| Send the Intent with a custom request code |
public ImageException(String message){
super(message);
}
| Constructs a new exception with the specified detail message. The cause is not initialized. |
public void shutdown(boolean waitForJobsToComplete){
synchronized (nextRunnableLock) {
getLog().debug("Shutting down threadpool...");
isShutdown=true;
if (workers == null) return;
Iterator<WorkerThread> workerThreads=workers.iterator();
while (workerThreads.hasNext()) {
WorkerThread wt=workerThreads.next();
wt.shutdown();
availWorkers.remove(wt);
}
nextRunnableLock.notifyAll();
if (waitForJobsToComplete == true) {
boolean interrupted=false;
try {
while (handoffPending) {
try {
nextRunnableLock.wait(100);
}
catch ( InterruptedException _) {
interrupted=true;
}
}
while (busyWorkers.size() > 0) {
WorkerThread wt=(WorkerThread)busyWorkers.getFirst();
try {
getLog().debug("Waiting for thread " + wt.getName() + " to shut down");
nextRunnableLock.wait(2000);
}
catch ( InterruptedException _) {
interrupted=true;
}
}
workerThreads=workers.iterator();
while (workerThreads.hasNext()) {
WorkerThread wt=(WorkerThread)workerThreads.next();
try {
wt.join();
workerThreads.remove();
}
catch ( InterruptedException _) {
interrupted=true;
}
}
}
finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
getLog().debug("No executing jobs remaining, all threads stopped.");
}
getLog().debug("Shutdown of threadpool complete.");
}
}
| <p> Terminate any worker threads in this thread group. </p> <p> Jobs currently in progress will complete. </p> |
@Override public Collection<Object> values(){
checkInitialized();
return Collections.unmodifiableCollection(super.values());
}
| Returns an unmodifiable Collection view of the property values contained in this provider. |
@Override public void onSensorChanged(SensorEvent event){
assert (event.values.length == 3);
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
if (!mIsRunning) {
return;
}
switch (event.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
if (mGravityVector == null) {
mGravityVector=new float[3];
}
mGravityVector[0]=event.values[0];
mGravityVector[1]=event.values[1];
mGravityVector[2]=event.values[2];
getOrientationUsingGetRotationMatrix();
break;
case Sensor.TYPE_MAGNETIC_FIELD:
if (mMagneticFieldVector == null) {
mMagneticFieldVector=new float[3];
}
mMagneticFieldVector[0]=event.values[0];
mMagneticFieldVector[1]=event.values[1];
mMagneticFieldVector[2]=event.values[2];
getOrientationUsingGetRotationMatrix();
break;
default :
assert (false);
}
}
| SensorEventListener implementation. Callbacks happen on the thread on which we registered - the WebCore thread. |
public static BufferedImage createRGBImageFromCMYK(Raster cmykRaster,ICC_Profile cmykProfile){
BufferedImage image;
int w=cmykRaster.getWidth();
int h=cmykRaster.getHeight();
if (cmykProfile != null) {
ColorSpace cmykCS=new ICC_ColorSpace(cmykProfile);
image=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
WritableRaster rgbRaster=image.getRaster();
ColorSpace rgbCS=image.getColorModel().getColorSpace();
ColorConvertOp cmykToRgb=new ColorConvertOp(cmykCS,rgbCS,null);
cmykToRgb.filter(cmykRaster,rgbRaster);
}
else {
int[] rgb=new int[w * h];
int[] C=cmykRaster.getSamples(0,0,w,h,0,(int[])null);
int[] M=cmykRaster.getSamples(0,0,w,h,1,(int[])null);
int[] Y=cmykRaster.getSamples(0,0,w,h,2,(int[])null);
int[] K=cmykRaster.getSamples(0,0,w,h,3,(int[])null);
for (int i=0, imax=C.length; i < imax; i++) {
int k=K[i];
rgb[i]=(255 - Math.min(255,C[i] + k)) << 16 | (255 - Math.min(255,M[i] + k)) << 8 | (255 - Math.min(255,Y[i] + k));
}
Raster rgbRaster=Raster.createPackedRaster(new DataBufferInt(rgb,rgb.length),w,h,w,new int[]{0xff0000,0xff00,0xff},null);
ColorSpace cs=ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel cm=new DirectColorModel(cs,24,0xff0000,0xff00,0xff,0x0,false,DataBuffer.TYPE_INT);
image=new BufferedImage(cm,(WritableRaster)rgbRaster,true,null);
}
return image;
}
| Creates a buffered image from a raster in the CMYK color space, converting the colors to RGB using the provided CMYK ICC_Profile. As seen from a comment made by 'phelps' at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4799903 |
@SuppressWarnings("unchecked") private void processFields(){
List<FieldNode> fields=cn.fields;
for ( FieldNode field : fields) {
if (DescriptorMapping.getInstance().isTransformedField(className,field.name,field.desc)) {
String newDesc=transformFieldDescriptor(className,field.name,field.desc);
logger.info("Transforming field " + field.name + " from "+ field.desc+ " to "+ newDesc);
if (!newDesc.equals(field.desc)) TransformationStatistics.transformBooleanField();
field.desc=newDesc;
}
}
}
| Handle transformation of fields defined in this class |
public AuditEvent convertToAuditEvent(PersistentAuditEvent persistentAuditEvent){
Instant instant=persistentAuditEvent.getAuditEventDate().atZone(ZoneId.systemDefault()).toInstant();
return new AuditEvent(Date.from(instant),persistentAuditEvent.getPrincipal(),persistentAuditEvent.getAuditEventType(),convertDataToObjects(persistentAuditEvent.getData()));
}
| Convert a PersistentAuditEvent to an AuditEvent |
@Override public String toString(){
StringBuffer buf=new StringBuffer();
switch (getType()) {
case Building.LIGHT:
buf.append("Light ");
break;
case Building.MEDIUM:
buf.append("Medium ");
break;
case Building.HEAVY:
buf.append("Heavy ");
break;
case Building.HARDENED:
buf.append("Hardened ");
break;
case Building.WALL:
buf.append("");
break;
}
switch (getBldgClass()) {
case Building.HANGAR:
buf.append("Hangar ");
break;
case Building.FORTRESS:
buf.append("Fortress ");
break;
case Building.GUN_EMPLACEMENT:
buf.append("Gun Emplacement");
break;
default :
buf.append("Standard ");
}
buf.append(name);
return buf.toString();
}
| Get a String for this building. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public static void checkForOutputExistence(String outDir){
try {
FileSystem fs=FileSystem.get(conf);
Path outDirectory=new Path(outDir);
FileStatus[] outFiles=fs.listStatus(outDirectory);
assertEquals("number of files in directory not 1",1,outFiles.length);
FSDataInputStream fsout=fs.open(outFiles[0].getPath());
BufferedReader outIn=new BufferedReader(new InputStreamReader(fsout));
String outLine=outIn.readLine();
outIn.close();
assertNotNull("file is empty",outLine);
assertTrue("file is empty",outLine.length() > 0);
}
catch ( IOException e) {
fail("unable to read " + outDir + ": "+ e.getMessage());
}
}
| <p> Checks for matrix in directory existence. </p> |
public static <T>T decodeFromBase64(Coder<T> coder,String encodedValue) throws CoderException {
return decodeFromSafeStream(coder,new ByteArrayInputStream(Base64.decodeBase64(encodedValue)),Coder.Context.OUTER);
}
| Parses a value from a base64-encoded String using the given coder. |
public String toJava(){
if (isFull()) {
return "Wildcards.FULL";
}
else if (isExact()) {
return "Wildcards.EXACT";
}
StringBuilder b=new StringBuilder();
EnumSet<Flag> myFlags=getWildcardedFlags();
if (myFlags.size() < 3) {
b.append("Wildcards.of(" + commaJoiner.join(prefix("Flag.",myFlags.iterator())) + ")");
}
else {
EnumSet<Flag> invFlags=inverted().getWildcardedFlags();
b.append("Wildcards.ofMatches(" + commaJoiner.join(prefix("Flag.",invFlags.iterator())) + ")");
}
if (Flag.NW_SRC.isPartiallyOn(flags)) {
b.append(".setNwSrcMask(" + getNwSrcMask() + ")");
}
if (Flag.NW_DST.isPartiallyOn(flags)) {
b.append(".setNwDstMask(" + getNwDstMask() + ")");
}
return b.toString();
}
| a Java expression that constructs 'this' wildcards set |
@Override public int perimeter(int size){
int retval=0;
QuadTreeNode neighbor=gtEqualAdjNeighbor(NORTH);
if (neighbor == null || neighbor instanceof WhiteNode) retval+=size;
else if (neighbor instanceof GreyNode) {
retval+=neighbor.sumAdjacent(Quadrant.cSouthEast,Quadrant.cSouthWest,size);
}
neighbor=gtEqualAdjNeighbor(EAST);
if (neighbor == null || neighbor instanceof WhiteNode) retval+=size;
else if (neighbor instanceof GreyNode) {
retval+=neighbor.sumAdjacent(Quadrant.cSouthWest,Quadrant.cNorthWest,size);
}
neighbor=gtEqualAdjNeighbor(SOUTH);
if (neighbor == null || neighbor instanceof WhiteNode) retval+=size;
else if (neighbor instanceof GreyNode) {
retval+=neighbor.sumAdjacent(Quadrant.cNorthWest,Quadrant.cNorthEast,size);
}
neighbor=gtEqualAdjNeighbor(WEST);
if (neighbor == null || neighbor instanceof WhiteNode) retval+=size;
else if (neighbor instanceof GreyNode) {
retval+=neighbor.sumAdjacent(Quadrant.cNorthEast,Quadrant.cSouthEast,size);
}
return retval;
}
| Compute the perimeter for a black node. |
public static void main(final String[] args){
DOMTestCase.doMain(attrnotspecifiedvalue.class,args);
}
| Runs this test from the command line. |
public ScaleIOSnapshotVolumeResponse snapshotVolume(String volId,String snapshotName,String systemId) throws Exception {
String uri=ScaleIOConstants.getSnapshotVolumesURI(systemId);
ScaleIOSnapshotVolumes spVol=new ScaleIOSnapshotVolumes();
spVol.addSnapshot(volId,snapshotName);
ClientResponse response=post(URI.create(uri),getJsonForEntity(spVol));
return getResponseObject(ScaleIOSnapshotVolumeResponse.class,response);
}
| Create a snapshot of the volume |
public AbortException(List<LocalizedText> customerMessages,List<LocalizedText> providerMessages){
super(customerMessages);
this.providerMessages=providerMessages;
}
| Constructs a new exception with the specified localized text messages. |
public void runTest() throws Throwable {
String namespaceURI="http://www.example.com/";
String qualifiedName;
Document doc;
Attr newAttr;
doc=(Document)load("hc_staff",true);
{
boolean success=false;
try {
newAttr=doc.createAttributeNS(namespaceURI,"");
}
catch ( DOMException ex) {
success=(ex.code == DOMException.INVALID_CHARACTER_ERR);
}
assertTrue("throw_INVALID_CHARACTER_ERR",success);
}
}
| Runs the test case. |
public void testBogusArguments() throws Exception {
IllegalArgumentException expected=expectThrows(IllegalArgumentException.class,null);
assertTrue(expected.getMessage().contains("Unknown parameters"));
}
| Test that bogus arguments result in exception |
public static DeactivateInstanceE parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
DeactivateInstanceE object=new DeactivateInstanceE();
int event;
java.lang.String nillableValue=null;
java.lang.String prefix="";
java.lang.String namespaceuri="";
try {
while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
java.util.Vector handledAttributes=new java.util.Vector();
while (!reader.isEndElement()) {
if (reader.isStartElement()) {
if (reader.isStartElement() && new javax.xml.namespace.QName("http://oscm.org/xsd","deactivateInstance").equals(reader.getName())) {
object.setDeactivateInstance(org.oscm.xsd.DeactivateInstance.Factory.parse(reader));
}
else {
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
}
else {
reader.next();
}
}
}
catch ( javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
| static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element |
public TLongIntHashMapDecorator(TLongIntHashMap map){
super();
this._map=map;
}
| Creates a wrapper that decorates the specified primitive map. |
public StringExpr_ createStringExpr_(){
StringExpr_Impl stringExpr_=new StringExpr_Impl();
return stringExpr_;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public double evaluate(double time){
scoreMatrix.setTime(time);
return -scoreMatrix.getScore(sitePatterns);
}
| compute function value |
public void testQueueManagement(){
Message m1=new Message(h1,h3,"dummy",BUFFER_SIZE - 1);
h1.createNewMessage(m1);
assertEquals(1,h1.getNrofMessages());
Message m2=new Message(h1,h3,msgId1,BUFFER_SIZE / 3);
h1.createNewMessage(m2);
assertEquals(1,h1.getNrofMessages());
assertEquals(msgId1,h1.getMessageCollection().iterator().next().getId());
mc.reset();
clock.advance(10);
Message m3=new Message(h1,h3,msgId2,BUFFER_SIZE / 3);
h1.createNewMessage(m3);
clock.advance(10);
Message m4=new Message(h1,h3,"newestMsg",BUFFER_SIZE / 3);
h1.createNewMessage(m4);
clock.advance(10);
Message m5=new Message(h2,h3,"MSG_from_h2",BUFFER_SIZE / 2);
h2.createNewMessage(m5);
checkCreates(3);
h2.connect(h1);
h2.update(true);
assertTrue(mc.next());
assertEquals(mc.TYPE_DELETE,mc.getLastType());
assertEquals(h1,mc.getLastFrom());
assertEquals(msgId1,mc.getLastMsg().getId());
assertTrue(mc.getLastDropped());
assertTrue(mc.next());
assertEquals(mc.TYPE_DELETE,mc.getLastType());
assertEquals(msgId2,mc.getLastMsg().getId());
assertEquals(1,h1.getNrofMessages());
assertTrue(mc.next());
assertEquals(mc.TYPE_START,mc.getLastType());
assertEquals(h2,mc.getLastFrom());
assertFalse(mc.next());
clock.advance(10);
updateAllNodes();
assertTrue(mc.next());
assertEquals(mc.TYPE_RELAY,mc.getLastType());
assertEquals(h1,mc.getLastTo());
assertFalse(mc.next());
}
| Tests if the FIFO queue management works |
private void updateProgress(String progressLabel,int progress){
if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) {
myHost.updateProgress(progressLabel,progress);
}
previousProgress=progress;
previousProgressLabel=progressLabel;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
protected void appendLongInteger(long longInt){
int size;
long temp=longInt;
for (size=0; (temp != 0) && (size < LONG_INTEGER_LENGTH_MAX); size++) {
temp=(temp >>> 8);
}
appendShortLength(size);
int i;
int shift=(size - 1) * 8;
for (i=0; i < size; i++) {
append((int)((longInt >>> shift) & 0xff));
shift=shift - 8;
}
}
| Append long integer into mMessage. it's used for really long integers. This implementation doesn't check the validity of parameter, since it assumes that the values are validated in the GenericPdu setter methods. |
protected boolean eq(Object x,Object y){
return x == y || x.equals(y);
}
| Check for equality of non-null references x and y. |
public static Builder builder(QueryRequest request){
return new Builder(request);
}
| Returns a query request builder for an existing request. |
@Override public void onViewDragStateChanged(int state){
if (state == mDragState) {
return;
}
if ((mDragState == ViewDragHelper.STATE_DRAGGING || mDragState == ViewDragHelper.STATE_SETTLING) && state == ViewDragHelper.STATE_IDLE && (mDragOffset == mConfigView.getVerticalDragRange())) {
mConfigView.hideView();
}
mDragState=state;
}
| Verify if container is dragging or idle and check mDragOffset is bigger than dragRange, if true, set the visible to gone. |
public boolean hasValue(){
return getValue() != null;
}
| Returns whether it has the value. |
public void testDoc2_Query2_All_Slops_Should_match() throws Exception {
for (int slop=0; slop < 30; slop++) {
float freq1=checkPhraseQuery(DOC_2,QUERY_2,slop,1);
float freq2=checkPhraseQuery(DOC_2_B,QUERY_2,slop,1);
assertTrue("slop=" + slop + " freq2="+ freq2+ " should be greater than freq1 "+ freq1,freq2 > freq1);
}
}
| Test DOC_2 and QUERY_2. QUERY_2 has an exact match to DOC_2, so all slop values should succeed. Before LUCENE-1310, 0 succeeds, 1 through 7 fail, and 8 or greater succeeds. |
static RuleDay parse(String day){
RuleDay d=new RuleDay();
if (day.startsWith("last")) {
d.lastOne=true;
d.dayName=day.substring(4);
d.dow=getDOW(d.dayName);
}
else {
int index;
if ((index=day.indexOf(">=")) != -1) {
d.dayName=day.substring(0,index);
d.dow=getDOW(d.dayName);
d.soonerOrLater=1;
d.thanDayOfMonth=Integer.parseInt(day.substring(index + 2));
}
else if ((index=day.indexOf("<=")) != -1) {
d.dayName=day.substring(0,index);
d.dow=getDOW(d.dayName);
d.soonerOrLater=-1;
d.thanDayOfMonth=Integer.parseInt(day.substring(index + 2));
}
else {
d.thanDayOfMonth=Integer.parseInt(day);
}
}
return d;
}
| Parses the "ON" field and constructs a RuleDay. |
private void processDataLinks(List<Draft3DataLink> dataLinks,ApplicationPort port,Draft3Job job,boolean strip){
for ( Draft3DataLink dataLink : dataLinks) {
String source=dataLink.getSource();
String destination=dataLink.getDestination();
String scatter=null;
if (job.getId().contains(DOT_SEPARATOR)) {
String mod=job.getId().substring(job.getId().indexOf(DOT_SEPARATOR) + 1);
if (strip) {
mod=mod.substring(mod.indexOf(DOT_SEPARATOR) + 1);
}
scatter=mod + SLASH_SEPARATOR + Draft3SchemaHelper.normalizeId(port.getId());
}
else {
scatter=port.getId();
}
if ((source.equals(scatter) || destination.equals(scatter)) && (dataLink.getScattered() == null || !dataLink.getScattered())) {
dataLink.setScattered(port.getScatter());
}
}
}
| Process data links |
@Override public void eUnset(int featureID){
switch (featureID) {
case EipPackage.METADATA__KEY:
setKey(KEY_EDEFAULT);
return;
case EipPackage.METADATA__VALUES:
getValues().clear();
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void createOverlay(DrawingView view,TextHolderFigure figure){
view.getComponent().add(textField,0);
textField.setText(figure.getText());
textField.setColumns(figure.getTextColumns());
textField.selectAll();
textField.setVisible(true);
editedFigure=figure;
editedFigure.addFigureListener(figureHandler);
this.view=view;
updateWidget();
}
| Creates the overlay for the given Container using a specific font. |
@Override public boolean onUsed(final RPEntity user){
if (user instanceof Player) {
String extra=" ";
if (((Player)user).isQuestInState("mithril_cloak","twilight_zone")) {
StendhalRPZone zone=SingletonRepository.getRPWorld().getZone("hell");
int x=5;
int y=5;
if (zone == null) {
user.sendPrivateText("Oh oh. For some strange reason the scroll did not teleport me to the right place.");
logger.warn("twilight elixir to unknown zone hell," + " teleported " + user.getName() + " to Semos instead");
zone=SingletonRepository.getRPWorld().getZone("0_semos_city");
}
((Player)user).teleport(zone,x,y,null,(Player)user);
extra=" Now you will go to hell, for thinking of yourself before you think of others.";
}
user.sendPrivateText("Didn't you know, one man's drink is another man's poison? That elixir was meant for Ida in the twilight zone." + extra);
return super.onUsed(user);
}
else {
logger.warn("some non player RPEntity just used a twilight elixir, which shouldn't be possible.");
return false;
}
}
| the overridden method verifies item is near to player. if so splits one single item of and calls consumeItem of the player - so they get poisoned, since that's what twilight elixir does |
protected GridNioFilterAdapter(String name){
assert name != null;
this.name=name;
}
| Assigns filter name to a filter. |
public void bindNull(int index){
mPreparedStatement.bindNull(index);
}
| Bind null to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called. |
public void show(ShareContent content,Mode mode){
isAutomaticMode=(mode == Mode.AUTOMATIC);
showImpl(content,isAutomaticMode ? BASE_AUTOMATIC_MODE : mode);
}
| Call this to show the Share Dialog in a specific mode |
public GridPaneEx(){
setAlignment(Pos.TOP_LEFT);
setHgap(5);
setVgap(10);
}
| Create pane. |
@Override protected void onDestroy(){
RxBus.get().unregister(mouseMam);
ArrayList<Cat> cats=catMam.getCats();
for ( Cat cat : cats) {
RxBus.get().unregister(cat);
}
super.onDestroy();
}
| Unregister the register object. |
private void skipFragmentIgnorables() throws ParseException {
while (!tokens.isEmpty()) {
Token<HtmlTokenType> t=tokens.peek();
switch (t.type) {
case DIRECTIVE:
break;
default :
return;
}
tokens.advance();
}
}
| Skip over top level doctypes, and whitespace only text nodes. Whitespace is significant for XML unless the schema specifies otherwise, but whitespace outside the root element is not. There is one exception for whitespace preceding the prologue. Comments are ignored by the underlying TreeBuilder unless explicitly configured otherwise. |
public int maxProfit(int k,int[] prices){
if (prices == null || prices.length < 2 || k == 0) {
return 0;
}
int n=prices.length;
int res=0;
if (k >= n / 2) {
for (int i=1; i < n; i++) {
if (prices[i] > prices[i - 1]) {
res+=prices[i] - prices[i - 1];
}
}
return res;
}
int[][] dp=new int[k + 1][n + 1];
for (int i=1; i <= k; i++) {
int curMax=Integer.MIN_VALUE;
for (int j=0; j < n; j++) {
dp[i][j + 1]=Math.max(Math.max(dp[i - 1][j + 1],dp[i][j]),prices[j] + curMax);
curMax=Math.max(curMax,dp[i - 1][j] - prices[j]);
}
}
return dp[k][n];
}
| DP, bottom-up, O(kn) Time, O(kn) Space |
public static Location copyLocation(Location source,Location dest){
if (dest == null) {
return null;
}
dest.setWorld(source.getWorld());
dest.setX(source.getX());
dest.setY(source.getY());
dest.setZ(source.getZ());
dest.setPitch(source.getPitch());
dest.setYaw(source.getYaw());
return dest;
}
| Copy the contents of one Location to another. |
@Override public String toString(){
return this.years + ":" + this.months+ ":"+ this.days+ ":"+ this.hours+ ":"+ this.minutes+ ":"+ this.seconds+ ":"+ this.milliseconds;
}
| Returns a <code>String</code> formatted as years:months:days:hours:minutes:seconds:millseconds. |
public ImageReference(ImageDescriptor descriptor,boolean returnMissingImageOnError,Device device){
this.cache=getImageCache(descriptor,returnMissingImageOnError,device);
this.cache.register(this);
}
| Create a new image reference and register it with an image described by an ImageDescriptor. |
public ArrayOfDoublesUpdatableSketch build(){
if (dstMem_ == null) {
return new HeapArrayOfDoublesQuickSelectSketch(nomEntries_,resizeFactor_.lg(),samplingProbability_,numValues_,seed_);
}
return new DirectArrayOfDoublesQuickSelectSketch(nomEntries_,resizeFactor_.lg(),samplingProbability_,numValues_,seed_,dstMem_);
}
| Returns an ArrayOfDoublesUpdatableSketch with the current configuration of this Builder. |
private boolean isInherited(Scope scope,Declaration member){
return inInitializer() && scope.getInheritingDeclaration(member) == typeDeclaration;
}
| Is this a reference to a member inherited by the type declaration from within the initializer section of the type declaration? |
public Volume prepareVolume(Volume volume,Project project,VirtualArray varray,VirtualPool vpool,String size,RPRecommendation recommendation,String label,BlockConsistencyGroup consistencyGroup,URI protectionSystemURI,Volume.PersonalityTypes personality,String rsetName,String internalSiteName,String rpCopyName,Volume sourceVolume,boolean vplex,Volume changeVpoolVolume,boolean isPreCreatedVolume){
volume=(changeVpoolVolume != null) ? changeVpoolVolume : volume;
boolean isNewVolume=(volume == null);
if (isNewVolume || isPreCreatedVolume) {
if (!isPreCreatedVolume) {
volume=new Volume();
volume.setId(URIUtil.createId(Volume.class));
volume.setOpStatus(new OpStatusMap());
}
else {
volume=_dbClient.queryObject(Volume.class,volume.getId());
}
volume.setSyncActive(true);
volume.setLabel(label);
volume.setCapacity(SizeUtil.translateSize(size));
volume.setThinlyProvisioned(VirtualPool.ProvisioningType.Thin.toString().equalsIgnoreCase(vpool.getSupportedProvisioningType()));
volume.setVirtualPool(vpool.getId());
volume.setProject(new NamedURI(project.getId(),volume.getLabel()));
volume.setTenant(new NamedURI(project.getTenantOrg().getURI(),volume.getLabel()));
volume.setVirtualArray(varray.getId());
if (null != recommendation.getSourceStoragePool()) {
StoragePool pool=_dbClient.queryObject(StoragePool.class,recommendation.getSourceStoragePool());
if (null != pool) {
volume.setProtocol(new StringSet());
volume.getProtocol().addAll(VirtualPoolUtil.getMatchingProtocols(vpool.getProtocols(),pool.getProtocols()));
if (!vplex) {
volume.setPool(pool.getId());
volume.setStorageController(pool.getStorageDevice());
StorageSystem storageSystem=_dbClient.queryObject(StorageSystem.class,pool.getStorageDevice());
String systemType=storageSystem.checkIfVmax3() ? DiscoveredDataObject.Type.vmax3.name() : storageSystem.getSystemType();
volume.setSystemType(systemType);
}
}
}
volume.setVirtualArray(varray.getId());
}
if (personality.equals(Volume.PersonalityTypes.METADATA)) {
volume.addInternalFlags(Flag.INTERNAL_OBJECT);
volume.addInternalFlags(Flag.SUPPORTS_FORCE);
volume.setAccessState(Volume.VolumeAccessState.NOT_READY.name());
}
else if (personality.equals(Volume.PersonalityTypes.SOURCE)) {
volume.setAccessState(Volume.VolumeAccessState.READWRITE.name());
volume.setLinkStatus(Volume.LinkStatus.OTHER.name());
}
else if (personality.equals(Volume.PersonalityTypes.TARGET)) {
volume.setAccessState(Volume.VolumeAccessState.NOT_READY.name());
volume.setLinkStatus(Volume.LinkStatus.OTHER.name());
}
if (consistencyGroup != null) {
volume.setConsistencyGroup(consistencyGroup.getId());
if (changeVpoolVolume != null && !changeVpoolVolume.checkForRp() && RPHelper.isVPlexVolume(changeVpoolVolume,_dbClient)) {
if (consistencyGroup.getArrayConsistency()) {
if (null == changeVpoolVolume.getAssociatedVolumes() || changeVpoolVolume.getAssociatedVolumes().isEmpty()) {
_log.error("VPLEX volume {} has no backend volumes.",changeVpoolVolume.forDisplay());
throw InternalServerErrorException.internalServerErrors.noAssociatedVolumesForVPLEXVolume(changeVpoolVolume.forDisplay());
}
for ( String backendVolumeId : changeVpoolVolume.getAssociatedVolumes()) {
Volume backingVolume=_dbClient.queryObject(Volume.class,URI.create(backendVolumeId));
String rgName=consistencyGroup.getCgNameOnStorageSystem(backingVolume.getStorageController());
if (rgName == null) {
rgName=consistencyGroup.getLabel();
}
else {
VolumeGroup volumeGroup=ControllerUtils.getApplicationForCG(_dbClient,consistencyGroup,rgName);
if (volumeGroup != null) {
backingVolume.getVolumeGroupIds().add(volumeGroup.getId().toString());
}
}
_log.info(String.format("Preparing VPLEX volume [%s](%s) for RP Protection, " + "backend end volume [%s](%s) updated with replication group name: %s",volume.getLabel(),volume.getId(),backingVolume.getLabel(),backingVolume.getId(),rgName));
backingVolume.setReplicationGroupInstance(rgName);
_dbClient.updateObject(backingVolume);
}
}
}
}
volume.setPersonality(personality.toString());
volume.setProtectionController(protectionSystemURI);
volume.setRSetName(rsetName);
volume.setInternalSiteName(internalSiteName);
volume.setRpCopyName(rpCopyName);
if (NullColumnValueGetter.isNotNullValue(vpool.getAutoTierPolicyName())) {
URI autoTierPolicyUri=StorageScheduler.getAutoTierPolicy(volume.getPool(),vpool.getAutoTierPolicyName(),_dbClient);
if (null != autoTierPolicyUri) {
volume.setAutoTieringPolicyUri(autoTierPolicyUri);
}
}
if (isNewVolume && !isPreCreatedVolume) {
_dbClient.createObject(volume);
}
else {
_dbClient.updateObject(volume);
}
if (sourceVolume != null) {
if (sourceVolume.getRpTargets() == null) {
sourceVolume.setRpTargets(new StringSet());
}
sourceVolume.getRpTargets().add(volume.getId().toString());
_dbClient.updateObject(sourceVolume);
}
return volume;
}
| Prepare Volume for a RecoverPoint protected volume |
protected void addAnnotationsPropertyDescriptor(Object object){
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),getResourceLocator(),getString("_UI_AnnotatableElement_annotations_feature"),getString("_UI_PropertyDescriptor_description","_UI_AnnotatableElement_annotations_feature","_UI_AnnotatableElement_type"),TypesPackage.Literals.ANNOTATABLE_ELEMENT__ANNOTATIONS,true,false,true,null,null,null));
}
| This adds a property descriptor for the Annotations feature. <!-- begin-user-doc --> <!-- end-user-doc --> |
public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException {
return -(m_right.num(xctxt));
}
| Evaluate this operation directly to a double. |
public GetLatestTask(final Shell shell,final TFSRepository repository,final String localItem){
super(shell,repository);
this.serverItems=null;
this.localItem=localItem;
}
| Create a task to "get latest (recursive)" for the specified local path. |
public TypeRef value(){
return this.getTypeRef();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public GroupCategorySet(GroupCategory[] categories){
Assert.isNotNull(categories);
fContent=new ArrayList(categories.length);
for (int i=0; i < categories.length; i++) {
if (!fContent.contains(categories[i])) fContent.add(categories[i]);
}
}
| Creates a new set of group categories initialized from the given array of group categories |
public void test_ESTCARD() throws Exception {
doInsertbyURL("POST",packagePath + "test_estcard.ttl");
final long rangeCount=m_repo.size();
assertEquals(7,rangeCount);
}
| Test the ESTCARD method (fast range count). |
public RequestHandle patch(Context context,String url,HttpEntity entity,String contentType,ResponseHandlerInterface responseHandler){
return sendRequest(httpClient,httpContext,addEntityToRequestBase(new HttpPatch(getURI(url)),entity),contentType,responseHandler,context);
}
| Perform a HTTP PATCH request and track the Android Context which initiated the request. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:20.375 -0500",hash_original_method="28B9C3C3AF577CC75DD224D050447CF4",hash_generated_method="2519B50D30B20B11517B949E5B02DAC4") public void enableLogging(){
this.getStackLogger().enableLogging();
}
| Globally enable message logging ( for debugging) |
protected Point computeLocation(Rectangle viewport,Rectangle controls){
double x;
double y;
if (this.locationCenter != null) {
x=this.locationCenter.x - controls.width / 2;
y=this.locationCenter.y - controls.height / 2;
}
else if (this.position.equals(AVKey.NORTHEAST)) {
x=viewport.getWidth() - controls.width - this.borderWidth;
y=viewport.getHeight() - controls.height - this.borderWidth;
}
else if (this.position.equals(AVKey.SOUTHEAST)) {
x=viewport.getWidth() - controls.width - this.borderWidth;
y=0d + this.borderWidth;
}
else if (this.position.equals(AVKey.NORTHWEST)) {
x=0d + this.borderWidth;
y=viewport.getHeight() - controls.height - this.borderWidth;
}
else if (this.position.equals(AVKey.SOUTHWEST)) {
x=0d + this.borderWidth;
y=0d + this.borderWidth;
}
else {
x=viewport.getWidth() - controls.width - this.borderWidth;
y=viewport.getHeight() - controls.height - this.borderWidth;
}
if (this.locationOffset != null) {
x+=this.locationOffset.x;
y+=this.locationOffset.y;
}
return new Point((int)x,(int)y);
}
| Compute the screen location of the controls overall rectangle bottom right corner according to either the location center if not null, or the screen position. |
@Override public synchronized void clear(){
File[] files=mRootDirectory.listFiles();
if (files != null) {
for ( File file : files) {
file.delete();
}
}
mEntries.clear();
mTotalSize=0;
VolleyLog.d("Cache cleared.");
}
| Clears the cache. Deletes all cached files from disk. |
public double optDouble(int index,double defaultValue){
try {
return this.getDouble(index);
}
catch ( Exception e) {
return defaultValue;
}
}
| Get the optional double value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. |
public S_Loop createS_Loop(){
S_LoopImpl s_Loop=new S_LoopImpl();
return s_Loop;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Path("remove") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON,MediaType.TEXT_PLAIN}) public CLIOutputResponse remove(final RemoveRequest request) throws ApiException, IOException {
request.setProjectPath(getAbsoluteProjectPath(request.getProjectPath()));
return this.subversionApi.remove(request);
}
| Remove the selected paths to version control. |
@Override public synchronized void remove(String key){
boolean deleted=getFileForKey(key).delete();
removeEntry(key);
if (!deleted) {
VolleyLog.d("Could not delete cache entry for key=%s, filename=%s",key,getFilenameForKey(key));
}
}
| Removes the specified key from the cache if it exists. |
private void writeHeader() throws OpenStegoException {
int channelBits=1;
int noOfPixels=0;
int headerSize=0;
LSBDataHeader header=null;
try {
noOfPixels=this.imgWidth * this.imgHeight;
header=new LSBDataHeader(this.dataLength,channelBits,this.fileName,this.config);
headerSize=header.getHeaderSize();
while (true) {
if ((noOfPixels * 3 * channelBits) / 8.0 < (headerSize + this.dataLength)) {
channelBits++;
if (channelBits > ((LSBConfig)this.config).getMaxBitsUsedPerChannel()) {
throw new OpenStegoException(null,LSBPlugin.NAMESPACE,LSBErrors.IMAGE_SIZE_INSUFFICIENT);
}
}
else {
break;
}
}
header.setChannelBitsUsed(channelBits);
write(header.getHeaderData());
if (this.currBit != 0) {
this.currBit=0;
writeCurrentBitSet();
nextPixel();
}
this.channelBitsUsed=channelBits;
this.bitSet=new byte[3 * channelBits];
}
catch ( OpenStegoException osEx) {
throw osEx;
}
catch ( Exception ex) {
throw new OpenStegoException(ex);
}
}
| Method to write header data to stream |
private EventsEntity(){
}
| This utility class cannot be instantiated |
public boolean isSet(_Fields field){
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case HEADER:
return isSetHeader();
}
throw new IllegalStateException();
}
| Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise |
public AuthPermission(String name,String actions){
super(init(name),actions);
}
| Creates an authentication permission with the specified target name. |
public boolean configurationExists(final String name){
mSingleArg[0]=name;
final Cursor cursor=mDatabase.query(Tables.CONFIGURATIONS,NAME_PROJECTION,NAME_SELECTION + " AND " + NOT_DELETED_SELECTION,mSingleArg,null,null,null);
try {
return cursor.getCount() > 0;
}
finally {
cursor.close();
}
}
| Returns true if a configuration with given name was found in the database. |
public static void sort(int[] a){
int n=a.length;
int[] aux=new int[n];
sort(a,0,n - 1,0,aux);
}
| Rearranges the array of 32-bit integers in ascending order. Currently assumes that the integers are nonnegative. |
public void transitionToIntentReviewLayout(){
mCaptureLayout.setVisibility(View.GONE);
mIntentReviewLayout.setVisibility(View.VISIBLE);
mCancelLayout.setVisibility(View.GONE);
mMode=MODE_INTENT_REVIEW;
}
| Perform a transition to the global intent review layout. The current layout state of the bottom bar is irrelevant. |
private List createListaUsoObjeto(HttpServletRequest request){
List listaUsoObjeto=new ArrayList();
request.setAttribute(Constants.LISTA_USO_OBJETO,listaUsoObjeto);
return listaUsoObjeto;
}
| Crea en la request una lista llamada listaUsoObjeto, para almacenar objetos de tipo UsoObjetoVO |
public ReplyException(String msg){
super(msg);
}
| Constructs an instance of <code>ReplyException</code> with the specified detail message. |
public byte readByte(){
return data[pos++];
}
| Read one single byte. |
public static String matchClusterCode(String clusterName){
if (clusterName == null) {
return null;
}
for ( ClusterInfo cluster : CLUSTER_LIST) {
if (clusterName.contains(cluster.getClusterCode())) {
return cluster.getClusterCode();
}
}
for ( ClusterInfo cluster : CLUSTER_LIST) {
if (clusterName.contains(cluster.getClusterShortName())) {
return cluster.getClusterCode();
}
}
return clusterName;
}
| match the clusterName to the list of cluster info, return the matching clusterCode |
public void testBogusArguments() throws Exception {
IllegalArgumentException expected=expectThrows(IllegalArgumentException.class,null);
assertTrue(expected.getMessage().contains("Unknown parameters"));
}
| Test that bogus arguments result in exception |
private static void closeCache(){
if (cache != null && !cache.isClosed()) {
cache.close();
cache.getDistributedSystem().disconnect();
}
}
| close the cache |
private View findFocusableViewInBoundsV(boolean topFocus,int top,int bottom){
List<View> focusables=getFocusables(View.FOCUS_FORWARD);
View focusCandidate=null;
boolean foundFullyContainedFocusable=false;
int count=focusables.size();
for (int i=0; i < count; i++) {
View view=focusables.get(i);
int viewTop=view.getTop();
int viewBottom=view.getBottom();
if (top < viewBottom && viewTop < bottom) {
final boolean viewIsFullyContained=(top < viewTop) && (viewBottom < bottom);
if (focusCandidate == null) {
focusCandidate=view;
foundFullyContainedFocusable=viewIsFullyContained;
}
else {
final boolean viewIsCloserToBoundary=(topFocus && viewTop < focusCandidate.getTop()) || (!topFocus && viewBottom > focusCandidate.getBottom());
if (foundFullyContainedFocusable) {
if (viewIsFullyContained && viewIsCloserToBoundary) {
focusCandidate=view;
}
}
else {
if (viewIsFullyContained) {
focusCandidate=view;
foundFullyContainedFocusable=true;
}
else if (viewIsCloserToBoundary) {
focusCandidate=view;
}
}
}
}
}
return focusCandidate;
}
| <p> Finds the next focusable component that fits in the specified bounds. </p> |
public Object read(InputNode node,Object result) throws Exception {
Instance type=factory.getInstance(node);
if (type.isReference()) {
return type.getInstance();
}
type.setInstance(result);
if (result != null) {
return populate(node,result);
}
return result;
}
| This <code>read</code> method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its <code>Root</code> annotation must be present and the name of the object element must match that root element name. |
public SVGOMFEOffsetElement(String prefix,AbstractDocument owner){
super(prefix,owner);
initializeLiveAttributes();
}
| Creates a new SVGOMFEOffsetElement object. |
public static TypeReference newExceptionReference(int exceptionIndex){
return new TypeReference((THROWS << 24) | (exceptionIndex << 8));
}
| Returns a reference to the type of an exception, in a 'throws' clause of a method. |
@Override public boolean supportsSavepoints(){
debugCodeCall("supportsSavepoints");
return true;
}
| Does the database support savepoints. |
public void fileFound(String fileFound){
System.out.println("File found :). The following file " + fileFound + " has been successfully loaded");
}
| Print a message to tell that a file has been found |
public TLongObjectHashMap(int initialCapacity,TLongHashingStrategy strategy){
super(initialCapacity);
_hashingStrategy=strategy;
}
| Creates a new <code>TLongObjectHashMap</code> instance whose capacity is the next highest prime above <tt>initialCapacity + 1</tt> unless that value is already prime. |
@Override public String toString(){
if (eIsProxy()) return super.toString();
StringBuffer result=new StringBuffer(super.toString());
result.append(" (greaterOp_1: ");
result.append(greaterOp_1);
result.append(')');
return result.toString();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
void startSourceFileForGeneratedImplementation(String nameOfGeneratedClass,TypeElement sourceClass){
messager.printMessage(Kind.NOTE,"Creating class " + nameOfGeneratedClass);
fileObject=getSourceFile(nameOfGeneratedClass,sourceClass);
if (fileObject == null) {
giveUp();
return;
}
writer=getWriter(fileObject);
if (writer == null) {
giveUp();
return;
}
currentIndentationLevel=0;
}
| Start a source file for a new implementation class. |
public long[] decode(String hash){
long[] ret={};
if (hash.equals("")) return ret;
return this._decode(hash,this.alphabet);
}
| Decrypt string to numbers |
private void updatePositionNeeds(){
needQBs=2 - teamQBs.size();
needRBs=4 - teamRBs.size();
needWRs=6 - teamWRs.size();
needOLs=10 - teamOLs.size();
needKs=2 - teamKs.size();
needSs=2 - teamSs.size();
needCBs=6 - teamCBs.size();
needF7s=14 - teamF7s.size();
if (dataAdapterPosition != null) {
positions=new ArrayList<String>();
positions.add("QB (Need: " + needQBs + ")");
positions.add("RB (Need: " + needRBs + ")");
positions.add("WR (Need: " + needWRs + ")");
positions.add("OL (Need: " + needOLs + ")");
positions.add("K (Need: " + needKs + ")");
positions.add("S (Need: " + needSs + ")");
positions.add("CB (Need: " + needCBs + ")");
positions.add("F7 (Need: " + needF7s + ")");
positions.add("Top 100 Recruits");
dataAdapterPosition.clear();
for ( String p : positions) {
dataAdapterPosition.add(p);
}
dataAdapterPosition.notifyDataSetChanged();
}
}
| Update needs for each position |
private BinarySearch(){
}
| This class should not be instantiated. |
public static String quote(String string){
StringWriter sw=new StringWriter();
synchronized (sw.getBuffer()) {
try {
return quote(string,sw).toString();
}
catch ( IOException ignored) {
return "";
}
}
}
| Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within </, producing <\/, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a control character or an unescaped quote or backslash. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.