code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
@Override public Enumeration<Option> listOptions(){
Vector<Option> result=new Vector<Option>();
result.addElement(new Option("\tFull path to serialized classifier to include.\n" + "\tMay be specified multiple times to include\n" + "\tmultiple serialized classifiers. Note: it does\n"+ "\tnot make sense to use pre-built classifiers in\n"+ "\ta cross-validation.","P",1,"-P <path to serialized " + "classifier>"));
result.addElement(new Option("\tThe combination rule to use\n" + "\t(default: AVG)","R",1,"-R " + Tag.toOptionList(TAGS_RULES)));
result.addElement(new Option("\tSuppress the printing of the individual models in the output","do-not-print",0,"-do-not-print"));
result.addAll(Collections.list(super.listOptions()));
return result.elements();
}
| Returns an enumeration describing the available options. |
protected boolean shouldShowControls(){
MediaControllerCompat mediaController=mMediaController;
if (mediaController == null || mediaController.getMetadata() == null || mediaController.getPlaybackState() == null) {
return false;
}
switch (mediaController.getPlaybackState().getState()) {
case PlaybackState.STATE_ERROR:
case PlaybackState.STATE_NONE:
case PlaybackState.STATE_STOPPED:
return false;
default :
return true;
}
}
| Check if the MediaSession is active and in a "playback-able" state (not NONE and not STOPPED). |
private void addDepartures(TransitSchedule newTransitSchedule,List<FahrtEvent> fahrtEvents,Set<String> rblDates,double timeBinSize){
int nOfDeparture=0;
for ( FahrtEvent fahrtEvent : fahrtEvents) {
if (rblDates.contains(String.valueOf(fahrtEvent.getRblDate()))) {
TransitLine line=newTransitSchedule.getTransitLines().get(fahrtEvent.getLineId());
if (line != null) {
Id<TransitRoute> routeId=Id.create(fahrtEvent.getRouteId().toString() + "-" + ((int)(fahrtEvent.getDepartureTimeIst() / timeBinSize)),TransitRoute.class);
TransitRoute route=line.getRoutes().get(routeId);
if (route != null) {
nOfDeparture++;
Departure departure=newTransitSchedule.getFactory().createDeparture(Id.create(nOfDeparture,Departure.class),fahrtEvent.getDepartureTimeIst());
departure.setVehicleId(fahrtEvent.getVehId());
route.addDeparture(departure);
}
}
}
}
log.info("Added " + nOfDeparture + " departures");
}
| Adds departures to each line and route |
public BigdataOpenRDFBindingSetsResolverator start(final ExecutorService service){
return (BigdataOpenRDFBindingSetsResolverator)super.start(service);
}
| Strengthens the return type. |
private SchedulerFuture<R> snapshot(R res,Throwable err){
return new ScheduleFutureSnapshot<>(this,res,err);
}
| Creates a snapshot of this future with fixed last result. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case FunctionblockPackage.FAULT__PROPERTIES:
return getProperties();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
void appendAttribute(int namespaceIndex,int localNameIndex,int prefixIndex,boolean isID,int m_char_current_start,int contentLength){
int w0=ATTRIBUTE_NODE | namespaceIndex << 16;
int w1=currentParent;
int w2=0;
int w3=localNameIndex | prefixIndex << 16;
System.out.println("set w3=" + w3 + " "+ (w3 >> 16)+ "/"+ (w3 & 0xffff));
int ourslot=appendNode(w0,w1,w2,w3);
previousSibling=ourslot;
w0=TEXT_NODE;
w1=ourslot;
w2=m_char_current_start;
w3=contentLength;
appendNode(w0,w1,w2,w3);
previousSiblingWasParent=true;
return;
}
| Append an Attribute child at the current insertion point. Assumes that the symbols (namespace URI, local name, and prefix) have already been added to the pools, and that the content has already been appended to m_char. Note that the attribute's content has been flattened into a single string; DTM does _NOT_ attempt to model the details of entity references within attribute values. |
public static void dropAllTables(SQLiteDatabase db,boolean ifExists){
HistoryEntityDao.dropTable(db,ifExists);
}
| Drops underlying database table using DAOs. |
public final boolean contains(int s){
for (int i=0; i < m_firstFree; i++) {
if (m_map[i] == s) return true;
}
return false;
}
| Tell if the table contains the given node. |
void checkEndCode(){
if (endCode) {
throw new IllegalStateException("Cannot visit instructions after visitMaxs has been called.");
}
}
| Checks that the visitMaxs method has not been called. |
public void body(String namespace,String name,String text) throws Exception {
}
| <p>No body processing is required.</p> |
public void onEngineComplete(){
mEngineCompleteTime=SystemClock.elapsedRealtime();
}
| Notifies the logger that the engine has finished processing data. Will be called exactly once. |
public Select<Model> whereLike(String column,Object value){
addClause(new DataFilterCriterion(column,DataFilterCriterion.DataFilterOperator.LIKE,value),DataFilterConjunction.AND);
return this;
}
| Convenience method that will add a like criterion with an AND conjunction |
public XTIFFEncodeParam(TIFFEncodeParam param){
initialize();
if (param == null) return;
setCompression(param.getCompression());
setWriteTiled(param.getWriteTiled());
}
| Promotes an XTIFFEncodeParam object from simpler one |
public void sendEmptyTouchAreaFeedbackDelayed(AccessibilityNodeInfoCompat touchedNode){
cancelEmptyTouchAreaFeedback();
mCachedTouchedNode=AccessibilityNodeInfoCompat.obtain(touchedNode);
final Message msg=obtainMessage(EMPTY_TOUCH_AREA);
sendMessageDelayed(msg,EMPTY_TOUCH_AREA_DELAY);
}
| Provides feedback indicating an empty or unfocusable area after a delay. |
protected void drawRangeGridlines(Graphics2D g2,Rectangle2D area,List ticks){
if (getRenderer() == null) {
return;
}
if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
Stroke gridStroke=null;
Paint gridPaint=null;
ValueAxis axis=getRangeAxis();
if (axis != null) {
Iterator iterator=ticks.iterator();
boolean paintLine;
while (iterator.hasNext()) {
paintLine=false;
ValueTick tick=(ValueTick)iterator.next();
if ((tick.getTickType() == TickType.MINOR) && isRangeMinorGridlinesVisible()) {
gridStroke=getRangeMinorGridlineStroke();
gridPaint=getRangeMinorGridlinePaint();
paintLine=true;
}
else if ((tick.getTickType() == TickType.MAJOR) && isRangeGridlinesVisible()) {
gridStroke=getRangeGridlineStroke();
gridPaint=getRangeGridlinePaint();
paintLine=true;
}
if ((tick.getValue() != 0.0 || !isRangeZeroBaselineVisible()) && paintLine) {
getRenderer().drawRangeLine(g2,this,getRangeAxis(),area,tick.getValue(),gridPaint,gridStroke);
}
}
}
}
}
| Draws the gridlines for the plot's primary range axis, if they are visible. |
public boolean hasGenericSuperType(Type superType){
return GenericTypeReflector.isSuperType(superType,type);
}
| Determine if this class is a subclass of superType |
@ToString public String toString(){
return "P" + String.valueOf(getValue()) + "D";
}
| Gets this instance as a String in the ISO8601 duration format. <p> For example, "P4D" represents 4 days. |
public static int listFind(String list,String value){
return listFind(list,value,",");
}
| finds a value inside a list, case sensitive |
public PacProxySelector(String pacUrl){
if (pacUrl == null) {
throw new NullPointerException();
}
this.pacUrl=pacUrl;
}
| Construct PacProxySelector using an Automatic proxy configuration URL. Loads the PAC script from the supplied URL. |
public void flush(){
synchronized (mDiskCacheLock) {
if (mDiskLruCache != null) {
try {
mDiskLruCache.flush();
if (BuildConfig.DEBUG) {
Log.d(TAG,"Disk cache flushed");
}
}
catch ( IOException e) {
Log.e(TAG,"flush - " + e);
}
}
}
}
| Flushes the disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread. |
public String toString(){
return markupDocBuilder.toString();
}
| Returns a string representation of the document. |
public TransactionOutPoint(NetworkParameters params,byte[] payload,int offset,Message parent,MessageSerializer serializer) throws ProtocolException {
super(params,payload,offset,parent,serializer,MESSAGE_LENGTH);
}
| Deserializes the message. This is usually part of a transaction message. |
public Object storedData(){
return stored;
}
| Return the data stored with the node. |
public static void doMain(String[] args){
String job="java:saveWithQueryBuilder";
String keyspaceName="test";
String inputTableName="tweets2";
final String outputTableName="copy_tweets3";
ContextProperties p=new ContextProperties(args);
DeepSparkContext deepContext=new DeepSparkContext(p.getCluster(),job,p.getSparkHome(),p.getJars());
CassandraDeepJobConfig<Cells> inputConfig=CassandraConfigFactory.create().host(p.getCassandraHost()).cqlPort(p.getCassandraCqlPort()).rpcPort(p.getCassandraThriftPort()).keyspace(keyspaceName).table(inputTableName).initialize();
long initTime=System.currentTimeMillis();
JavaRDD<Cells> inputRDD=deepContext.createJavaRDD(inputConfig);
System.out.println("**********************" + inputRDD.count() + System.currentTimeMillis());
long timeCreate=System.currentTimeMillis() - initTime;
initTime=System.currentTimeMillis();
CassandraDeepJobConfig<Cells> outputConfig=CassandraConfigFactory.create().host(p.getCassandraHost()).cqlPort(p.getCassandraCqlPort()).rpcPort(p.getCassandraThriftPort()).keyspace(keyspaceName).table(outputTableName).createTableOnWrite(true).initialize();
deepContext.saveRDD(inputRDD.rdd(),outputConfig);
System.out.println("**********************");
long timeSave=System.currentTimeMillis() - initTime;
initTime=System.currentTimeMillis();
System.out.println("initTime" + timeCreate + "save"+ timeSave);
deepContext.stop();
}
| This is the method called by both main and tests. |
protected static void print(String msg){
System.out.print(msg);
}
| Print a message to stdout without trailing new line character. |
public boolean hasTransparency(){
return super.hasElement(Transparency.KEY);
}
| Returns whether it has the event transparency. |
public SelectorExtractor htmlParser(){
this.parser=Parser.htmlParser();
return this;
}
| change parser to htmlParser. |
public boolean isAssignBuckets(){
return this.assignBuckets;
}
| Determines whether buckets should be assigned to partitioned regions in the cache upon Server start. |
public void show(Animation anim){
show(true,anim);
}
| Make the badge visible in the UI. |
public static IndicatorSeries newInstance(String value){
final IndicatorSeries returnInstance=new IndicatorSeries();
returnInstance.setValue(value);
return returnInstance;
}
| Method newInstance. |
public static BigInteger calculateM2(Digest digest,BigInteger N,BigInteger A,BigInteger M1,BigInteger S){
BigInteger M2=hashPaddedTriplet(digest,N,A,M1,S);
return M2;
}
| Computes the server evidence message (M2) according to the standard routine: M2 = H( A | M1 | S ) |
public boolean isReinitialize(){
return this == REINITIALIZE;
}
| Returns true if this is <code>REINITIALIZE</code>. |
public ObjectFactory(){
super();
}
| Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openwms.core.domain.preferences. |
public static SemSimulationParams serializableInstance(){
return new SemSimulationParams();
}
| Generates a simple exemplar of this class to test serialization. |
@Override public boolean visit(boolean ignoreLastVisited,Visitor v) throws IgniteCheckedException {
if (!state.compareAndSet(State.READING_WRITING,State.VISITING)) {
assert state.get() != State.CLOSING;
return false;
}
AtomicLongArray tbl0=oldTbl;
for (int i=0; i < tbl0.length(); i++) {
long meta=tbl0.get(i);
while (meta != 0) {
long valPtr=value(meta);
long lastVisited=ignoreLastVisited ? 0 : lastVisitedValue(meta);
if (valPtr != lastVisited) {
v.onKey(key(meta),keySize(meta));
lastVisitedValue(meta,valPtr);
do {
v.onValue(valPtr + 12,valueSize(valPtr));
valPtr=nextValue(valPtr);
}
while (valPtr != lastVisited);
}
meta=collision(meta);
}
}
state(State.VISITING,State.READING_WRITING);
return true;
}
| Incrementally visits all the keys and values in the map. |
public int indexOf(final StrMatcher matcher,int startIndex){
startIndex=(startIndex < 0 ? 0 : startIndex);
if (matcher == null || startIndex >= size) {
return -1;
}
final int len=size;
final char[] buf=buffer;
for (int i=startIndex; i < len; i++) {
if (matcher.isMatch(buf,i,startIndex,len) > 0) {
return i;
}
}
return -1;
}
| Searches the string builder using the matcher to find the first match searching from the given index. <p> Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number. |
public NativeDaemonEvent execute(Command cmd) throws NativeDaemonConnectorException {
return execute(cmd.mCmd,cmd.mArguments.toArray());
}
| Issue the given command to the native daemon and return a single expected response. |
@Override public void evaluate(Solution solution) throws JMException {
double[] values=new double[Pnts.length];
switch (SVType) {
case EXPONENTIAL:
for (int i=0; i < Pnts.length; i++) {
if (Pnts[i][0] != 0) {
values[i]=(Nugget ? solution.getDecisionVariables()[2].getValue() : 0) + solution.getDecisionVariables()[1].getValue() * (1 - Math.exp(-Pnts[i][0] / solution.getDecisionVariables()[0].getValue()));
}
else {
values[i]=0;
}
}
break;
case GAUSSIAN:
for (int i=0; i < Pnts.length; i++) {
if (Pnts[i][0] != 0) {
values[i]=(Nugget ? solution.getDecisionVariables()[2].getValue() : 0) + solution.getDecisionVariables()[1].getValue() * (1 - Math.exp(-(Math.pow(Pnts[i][0],2)) / (Math.pow(solution.getDecisionVariables()[0].getValue(),2))));
}
else {
values[i]=0;
}
}
break;
case SPHERICAL:
for (int i=0; i < Pnts.length; i++) {
if (Pnts[0][0] > solution.getDecisionVariables()[0].getValue()) {
values[i]=(Nugget ? solution.getDecisionVariables()[2].getValue() : 0) + solution.getDecisionVariables()[1].getValue();
}
else if (0 < Pnts[0][0] && Pnts[0][0] <= solution.getDecisionVariables()[0].getValue()) {
values[i]=(Nugget ? solution.getDecisionVariables()[2].getValue() : 0) + solution.getDecisionVariables()[1].getValue() * (1.5 * Pnts[i][0] / solution.getDecisionVariables()[0].getValue() - 0.5 * Math.pow((Pnts[i][0] / solution.getDecisionVariables()[0].getValue()),3));
}
else {
values[i]=0;
}
}
break;
}
double mse=0;
for (int i=0; i < Pnts.length; i++) {
mse+=Math.pow((values[i] - Pnts[i][1]),2);
}
if (mse < difMin) {
Kriging k=new Kriging();
var=k.getSemivariogram(SVType,solution.getDecisionVariables()[0].getValue(),solution.getDecisionVariables()[1].getValue(),(Nugget) ? solution.getDecisionVariables()[2].getValue() : 0,false);
var.mse=mse;
difMin=mse;
}
solution.setObjective(0,mse);
solution.setObjective(1,mse);
}
| Evaluates a solution |
public WeightedRandomChoiceWrapper(int weight,T wrapped){
super(weight);
this.wrapped=wrapped;
}
| Construnt new choice with given weight. |
public DoubleMatrix1D like1D(int size){
return new SparseDoubleMatrix1D(size);
}
| Construct and returns a new 1-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. For example, if the receiver is an instance of type <tt>DenseDoubleMatrix2D</tt> the new matrix must be of type <tt>DenseDoubleMatrix1D</tt>, if the receiver is an instance of type <tt>SparseDoubleMatrix2D</tt> the new matrix must be of type <tt>SparseDoubleMatrix1D</tt>, etc. |
public FilteredNavigationRecordImpl(final String name,final String displayName,final String code,final String value,final String displayValue,final int count,final int rank,final String type){
this.name=name;
this.displayName=displayName;
this.code=code;
this.value=value;
this.displayValue=displayValue;
this.count=count;
this.rank=rank;
this.type=type;
}
| Construct filtered navigation record for localisable records. |
public static void copyStreamSynchronously(InputStream in,OutputStream out,boolean closeOutputStream) throws IOException {
byte[] buffer=new byte[1024 * 20];
try {
int length;
while ((length=in.read(buffer)) != -1) {
out.write(buffer,0,length);
}
out.flush();
}
finally {
if (closeOutputStream && out != null) {
try {
out.close();
}
catch ( IOException ex) {
}
}
if (in != null) {
try {
in.close();
}
catch ( IOException ex) {
}
}
}
}
| Copies the contents read from the input stream to the output stream in the current thread. Both streams will be closed, even in case of a failure. |
public void autodetectAnnotations(final boolean mode){
if (annotationMapper != null) {
annotationMapper.autodetectAnnotations(mode);
}
}
| Set the auto-detection mode of the AnnotationMapper. Note that auto-detection implies that the XStream is configured while it is processing the XML steams. This is a potential concurrency problem. Also is it technically not possible to detect all class aliases at deserialization. You have been warned! |
public void write(String str,int off,int len){
buf.append(str.substring(off,off + len));
}
| Write a portion of a string. |
public static ArrayOfDoublesSketch wrapSketch(final Memory mem,final long seed){
SerializerDeserializer.SketchType sketchType=SerializerDeserializer.getSketchType(mem);
if (sketchType == SerializerDeserializer.SketchType.ArrayOfDoublesQuickSelectSketch) {
return new DirectArrayOfDoublesQuickSelectSketch(mem,seed);
}
return new DirectArrayOfDoublesCompactSketch(mem,seed);
}
| Wrap the given Memory and seed as a ArrayOfDoublesSketch |
public ExtentTest warning(String details){
log(Status.WARNING,details);
return this;
}
| Logs an event <code>Status.WARNING</code> with details |
public cite addElement(Element element){
addElementToRegistry(element);
return (this);
}
| Adds an Element to the element. |
@Override public int eDerivedOperationID(int baseOperationID,Class<?> baseClass){
if (baseClass == TypeArgument.class) {
switch (baseOperationID) {
case TypeRefsPackage.TYPE_ARGUMENT___GET_TYPE_REF_AS_STRING:
return TypeRefsPackage.UNKNOWN_TYPE_REF___GET_TYPE_REF_AS_STRING;
default :
return super.eDerivedOperationID(baseOperationID,baseClass);
}
}
if (baseClass == TypeRef.class) {
switch (baseOperationID) {
case TypeRefsPackage.TYPE_REF___GET_TYPE_REF_AS_STRING:
return TypeRefsPackage.UNKNOWN_TYPE_REF___GET_TYPE_REF_AS_STRING;
default :
return super.eDerivedOperationID(baseOperationID,baseClass);
}
}
return super.eDerivedOperationID(baseOperationID,baseClass);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public NetworkResponse(int statusCode,byte[] data,Map<String,String> headers,boolean notModified,long networkTimeMs){
this.statusCode=statusCode;
this.data=data;
this.headers=headers;
this.notModified=notModified;
this.networkTimeMs=networkTimeMs;
}
| Creates a new network response. |
@XmlElement(required=false,name="migration_suspend_before_commit") public boolean isMigrationSuspendBeforeCommit(){
return migrationSuspendBeforeCommit;
}
| Does the user want us to suspend the workflow before migration commit(). |
@POST @Path("/{machineId}/{stateId}/status") @Transactional public Response updateStatus(@PathParam("machineId") Long machineId,@PathParam("stateId") Long stateId,ExecutionUpdateData executionUpdateData) throws Exception {
com.flipkart.flux.domain.Status updateStatus=null;
switch (executionUpdateData.getStatus()) {
case initialized:
updateStatus=com.flipkart.flux.domain.Status.initialized;
break;
case running:
updateStatus=com.flipkart.flux.domain.Status.running;
break;
case completed:
updateStatus=com.flipkart.flux.domain.Status.completed;
break;
case cancelled:
updateStatus=com.flipkart.flux.domain.Status.cancelled;
break;
case errored:
updateStatus=com.flipkart.flux.domain.Status.errored;
break;
case sidelined:
updateStatus=com.flipkart.flux.domain.Status.sidelined;
break;
}
this.workFlowExecutionController.updateExecutionStatus(machineId,stateId,updateStatus,executionUpdateData.getRetrycount(),executionUpdateData.getCurrentRetryCount(),executionUpdateData.getErrorMessage());
return Response.status(Response.Status.ACCEPTED.getStatusCode()).build();
}
| Updates the status of the specified Task under the specified State machine |
@Override public boolean isAuthenticated() throws RemoteException {
return true;
}
| Indicates whether or not this providers has successfully authenticated against the remote providers servers. In case an authentication is not needed, this method should simply return true at all times. No login attempt will be then made by the app. |
public String toString(){
return getClass().getName() + "[id=\"" + getID()+ "\""+ ",offset="+ getLastRawOffset()+ ",dstSavings="+ dstSavings+ ",useDaylight="+ useDaylightTime()+ ",transitions="+ ((transitions != null) ? transitions.length : 0)+ ",lastRule="+ (lastRule == null ? getLastRuleInstance() : lastRule)+ "]";
}
| Returns a string representation of this time zone. |
@Override public int length(){
return str.length();
}
| Returns the string length |
private void addMenuAction(String id,String label,String menuLabel,int mnemonic,Action action){
action.putValue(Action.NAME,menuLabel);
action.putValue(Action.MNEMONIC_KEY,mnemonic);
menu.setAction(id,action);
hotkeyManager.registerAction(id,label,action);
}
| Adds an action that is also represented in the main menu. |
public void addColumn(String header){
WBrowseListItemRenderer renderer=(WBrowseListItemRenderer)getItemRenderer();
renderer.addColumn(Util.cleanAmp(header));
getModel().addColumn();
return;
}
| Add Table Column and specify the column header. |
public BasicWWTexture(Object imageSource,boolean useMipMaps){
initialize(imageSource,useMipMaps);
}
| Constructs a texture object from an image source. <p/> The texture's image source is opened, if a file, only when the texture is displayed. If the texture is not displayed the image source is not read. |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:20.257 -0500",hash_original_method="9CB801DBEAF645326E64FD8725588653",hash_generated_method="ADA6219B535C173D2ADD2608EB80D68B") public void drawRect(Rect r,Paint paint){
drawRect(r.left,r.top,r.right,r.bottom,paint);
}
| Draw the specified Rect using the specified Paint. The rectangle will be filled or framed based on the Style in the paint. |
public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory){
return new ThreadPoolExecutorWithExceptions(0,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new SynchronousQueue<Runnable>(),threadFactory);
}
| Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available, and uses the provided ThreadFactory to create new threads when needed. |
public Boolean isSystemLogging(){
return systemLogging;
}
| Ruft den Wert der systemLogging-Eigenschaft ab. |
private static void bindPreferenceSummaryToValue(Preference preference){
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
final String key=preference.getKey();
if (preference instanceof MultiSelectListPreference) {
Set<String> summary=SharedPreferencesCompat.getStringSet(PreferenceManager.getDefaultSharedPreferences(preference.getContext()),key,new HashSet<String>());
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,summary);
}
else if (preference instanceof ColorPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,((ColorPreference)preference).getColor());
}
else if (preference instanceof SeekBarPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,((SeekBarPreference)preference).getProgress());
}
else {
String value=PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(key,"");
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,value);
}
}
| Binds a preference's summary to its value. More specifically, when the preference's value is changed, its summary (line of text below the preference title) is updated to reflect the value. The summary is also immediately updated upon calling this method. The exact display format is dependent on the type of preference. |
public static Cylinder computeBoundingCylinder(Globe globe,double verticalExaggeration,Sector sector,double minElevation,double maxElevation){
if (globe == null) {
String msg=Logging.getMessage("nullValue.GlobeIsNull");
Logging.logger().severe(msg);
throw new IllegalArgumentException(msg);
}
if (sector == null) {
String msg=Logging.getMessage("nullValue.SectorIsNull");
Logging.logger().severe(msg);
throw new IllegalArgumentException(msg);
}
double minHeight=minElevation * verticalExaggeration;
double maxHeight=maxElevation * verticalExaggeration;
if (minHeight == maxHeight) maxHeight=minHeight + 1;
List<Vec4> points=new ArrayList<Vec4>();
for ( LatLon ll : sector) {
points.add(globe.computePointFromPosition(ll,minHeight));
points.add(globe.computePointFromPosition(ll,maxHeight));
}
points.add(globe.computePointFromPosition(sector.getCentroid(),maxHeight));
if (sector.getDeltaLonDegrees() > 180) {
Angle cLon=sector.getCentroid().getLongitude();
Angle cLat=sector.getCentroid().getLatitude();
Angle lon=Angle.midAngle(sector.getMinLongitude(),cLon);
points.add(globe.computePointFromPosition(cLat,lon,maxHeight));
lon=Angle.midAngle(cLon,sector.getMaxLongitude());
points.add(globe.computePointFromPosition(cLat,lon,maxHeight));
points.add(globe.computePointFromPosition(cLat,sector.getMinLongitude(),maxHeight));
points.add(globe.computePointFromPosition(cLat,sector.getMaxLongitude(),maxHeight));
}
try {
return Cylinder.computeBoundingCylinder(points);
}
catch ( Exception e) {
return new Cylinder(points.get(0),points.get(0).add3(Vec4.UNIT_Y),1);
}
}
| Returns a cylinder that minimally surrounds the specified sector at a specified vertical exaggeration and minimum and maximum elevations for the sector. |
private QueryTask buildImageToImageDatastoreQuery(final State state){
QueryTask.Query.Builder queryBuilder=QueryTask.Query.Builder.create().addKindFieldClause(ImageToImageDatastoreMappingService.State.class);
queryBuilder.addFieldClause(ImageToImageDatastoreMappingService.State.FIELD_NAME_IMAGE_DATASTORE_ID,state.datastoreId);
QueryTask.Query query=queryBuilder.build();
QueryTask.Builder queryTaskBuilder=QueryTask.Builder.createDirectTask().setQuery(query);
QueryTask queryTask=queryTaskBuilder.build();
return queryTask;
}
| Builds the query to retrieve all the ImageToImageDatastoreMappings with the specific datastoreId. |
public boolean canGet(String field,Class type){
Column c=getColumn(field);
return (c == null ? false : c.canGet(type));
}
| Check if the <code>get</code> method for the given data field returns values that are compatible with a given target type. |
public DoubleProperty oscillationsProperty(){
return oscillations;
}
| The oscillations property. Defines number of oscillations. |
public void downloadFromV7WithObb(String url,String url_alt,String md5sum,long fileSize,String name,String packageName,String versionName,String icon,long appId,boolean paid,GetAppMeta.Obb obb,Download downloadOld,List<String> permissions){
UpdatesResponse.UpdateApk apk=createUpdateApkFromV7Params(url,url_alt,md5sum,fileSize,name,packageName,versionName,icon,appId);
Download download=new Download();
download.setId(apk.md5sum.hashCode());
download.setName(apk.name);
download.setPackageName(apk.packageName);
download.setVersion(apk.versionName);
download.setMd5(apk.md5sum);
download.setPaid(paid);
download.setIcon(apk.icon);
download.setSize(fileSize);
download.setCpiUrl(downloadOld.getCpiUrl());
startDownload(download,apk,obb,permissions);
}
| New installer method for v7 This whole class needs major refactoring. |
public static void close() throws SQLException {
if (connection != null) {
connection.close();
}
}
| Closes the database connection. |
public void preVisit(TextEdit edit){
}
| Visits the given text edit prior to the type-specific visit. (before <code>visit</code>). <p> The default implementation does nothing. Subclasses may reimplement. </p> |
@Override public boolean ensureProjectSaved(IGanttProject project){
if (project.isModified()) {
UIFacade.Choice saveChoice=myWorkbenchFacade.showConfirmationDialog(i18n.getText("msg1"),i18n.getText("warning"));
if (UIFacade.Choice.CANCEL == saveChoice) {
return false;
}
if (UIFacade.Choice.YES == saveChoice) {
try {
saveProject(project);
return !project.isModified();
}
catch ( Exception e) {
myWorkbenchFacade.showErrorDialog(e);
return false;
}
}
}
return true;
}
| Check if the project has been modified, before creating or opening another project |
public Enumeration<Option> listOptions(){
Vector<Option> newVector=new Vector<Option>(7);
newVector.addElement(new Option("\tWeight neighbours by the inverse of their distance\n" + "\t(use when k > 1)","I",0,"-I"));
newVector.addElement(new Option("\tWeight neighbours by 1 - their distance\n" + "\t(use when k > 1)","F",0,"-F"));
newVector.addElement(new Option("\tNumber of nearest neighbours (k) used in classification.\n" + "\t(Default = 1)","K",1,"-K <number of neighbors>"));
newVector.addElement(new Option("\tMinimise mean squared error rather than mean absolute\n" + "\terror when using -X option with numeric prediction.","E",0,"-E"));
newVector.addElement(new Option("\tMaximum number of training instances maintained.\n" + "\tTraining instances are dropped FIFO. (Default = no window)","W",1,"-W <window size>"));
newVector.addElement(new Option("\tSelect the number of nearest neighbours between 1\n" + "\tand the k value specified using hold-one-out evaluation\n" + "\ton the training data (use when k > 1)","X",0,"-X"));
newVector.addElement(new Option("\tThe nearest neighbour search algorithm to use " + "(default: weka.core.neighboursearch.LinearNNSearch).\n","A",0,"-A"));
newVector.addAll(Collections.list(super.listOptions()));
return newVector.elements();
}
| Returns an enumeration describing the available options. |
public boolean isCascadedIG(StorageSystem storage,CIMObjectPath path) throws WBEMException {
CloseableIterator<CIMObjectPath> pathItr=null;
try {
if (checkExists(storage,path,false,false) != null) {
pathItr=getReference(storage,path,SE_MEMBER_OF_COLLECTION_IMG_IMG,null);
if (!pathItr.hasNext()) {
return false;
}
while (pathItr.hasNext()) {
CIMObjectPath objPath=pathItr.next();
if (objPath != null) {
CIMProperty prop=objPath.getKey(MEMBER);
if (prop != null) {
CIMObjectPath comparePath=(CIMObjectPath)prop.getValue();
if (comparePath != null && comparePath.toString().endsWith(path.toString())) {
return false;
}
}
}
}
}
else {
_log.info("Instance not found for path {}. Assuming non-cascaded.",path);
return false;
}
}
catch ( Exception e) {
_log.info("Got exception trying to retrieve cascade status of IG. Assuming cascaded: ",e);
}
finally {
closeCIMIterator(pathItr);
}
return true;
}
| Find if IG is cascaded |
@SuppressWarnings("unchecked") public CompositeTransactionAdaptor(Stack<CompositeTransaction> lineage,String tid,boolean serial,RecoveryCoordinator adaptor){
super(tid,(Stack<CompositeTransaction>)lineage.clone(),serial);
adaptorForReplayRequests_=adaptor;
Stack<CompositeTransaction> tmp=(Stack<CompositeTransaction>)lineage.clone();
CompositeTransaction parent=null;
while (!tmp.empty()) {
parent=tmp.pop();
}
root_=parent.getTid();
}
| Create a new instance. |
public static Timestamp convertDateValueToTimestamp(long dateValue,long timeNanos){
long millis=timeNanos / 1000000;
timeNanos-=millis * 1000000;
long s=millis / 1000;
millis-=s * 1000;
long m=s / 60;
s-=m * 60;
long h=m / 60;
m-=h * 60;
long ms=getMillis(null,yearFromDateValue(dateValue),monthFromDateValue(dateValue),dayFromDateValue(dateValue),(int)h,(int)m,(int)s,0);
Timestamp ts=new Timestamp(ms);
ts.setNanos((int)(timeNanos + millis * 1000000));
return ts;
}
| Convert a date value / time value to a timestamp, using the default timezone. |
public AppCardBuilder imageUri(Uri imageUri){
this.imageUri=imageUri;
return this;
}
| Sets the App Card image Uri of an image to show in the Card. |
private boolean checkTrackedBranchesConfigured(){
LOG.info("checking tracked branch configuration...");
for ( GitRepository repository : myRepositories) {
VirtualFile root=repository.getRoot();
final GitLocalBranch branch=repository.getCurrentBranch();
if (branch == null) {
LOG.info("checkTrackedBranchesConfigured: current branch is null in " + repository);
notifyImportantError(myProject,"Can't update: no current branch","You are in 'detached HEAD' state, which means that you're not on any branch" + rootStringIfNeeded(root) + "Checkout a branch to make update possible.");
return false;
}
GitBranchTrackInfo trackInfo=GitBranchUtil.getTrackInfoForBranch(repository,branch);
if (trackInfo == null) {
final String branchName=branch.getName();
LOG.info(String.format("checkTrackedBranchesConfigured: no track info for current branch %s in %s",branch,repository));
notifyImportantError(myProject,"Can't update: no tracked branch","No tracked branch configured for branch " + code(branchName) + rootStringIfNeeded(root)+ "To make your branch track a remote branch call, for example,<br/>"+ "<code>git branch --set-upstream "+ branchName+ " origin/"+ branchName+ "</code>");
return false;
}
myTrackedBranches.put(root,new GitBranchPair(branch,trackInfo.getRemoteBranch()));
}
return true;
}
| For each root check that the repository is on branch, and this branch is tracking a remote branch, and the remote branch exists. If it is not true for at least one of roots, notify and return false. If branch configuration is OK for all roots, return true. |
public static void softmax(Vec x,boolean implicitExtra){
double max=implicitExtra ? 1 : Double.NEGATIVE_INFINITY;
max=max(max,x.max());
double z=implicitExtra ? exp(-max) : 0;
for (int c=0; c < x.length(); c++) {
double newVal=exp(x.get(c) - max);
x.set(c,newVal);
z+=newVal;
}
x.mutableDivide(z);
}
| Applies the softmax function to the given array of values, normalizing them so that each value is equal to<br><br> exp(x<sub>j</sub>) / Σ<sub>∀ i</sub> exp(x<sub>i</sub>)<br> Note: If the input is sparse, this will end up destroying sparsity |
public boolean readLineToBuffer(StringBuilder sb) throws IOException {
sb.delete(0,sb.length());
while (true) {
int c=read();
if (c == -1) return true;
else if (c == '\n') break;
if (c != '\r') sb.append((char)c);
}
return false;
}
| Returns true if end of file reached. Otherwise reads a line in to the provided StringBuffer |
@Override public boolean hasClaw(int location){
return false;
}
| quad mechs can't have claws |
private boolean isAdministrator(StorageOSUser storageOSUser){
for ( String role : storageOSUser.getRoles()) {
if (role.equalsIgnoreCase(Role.SYSTEM_ADMIN.toString())) {
return true;
}
}
Set<String> tenantRoles=_permissionsHelper.getTenantRolesForUser(storageOSUser,URI.create(storageOSUser.getTenantId()),false);
for ( String role : tenantRoles) {
if (role.equalsIgnoreCase(Role.TENANT_ADMIN.toString())) {
return true;
}
}
return false;
}
| check if user has System admin or TenantAdmin role |
public JSONObject(){
this.map=new HashMap();
}
| Construct an empty JSONObject. |
private void fireBreakpointEvent(final Operator operator,final IOContainer ioContainer,final int location){
for ( BreakpointListener l : breakpointListeners) {
l.breakpointReached(this,operator,ioContainer,location);
}
}
| Fires the event that the process was paused. |
public UnchangeableAllowingOnBehalfActingException(String message,ApplicationExceptionBean bean,Throwable cause){
super(message,bean,cause);
}
| Constructs a new exception with the specified detail message, cause, and bean for JAX-WS exception serialization. |
private long next(long qAddr){
return mem.readLong(qAddr + 19);
}
| Reads address of next queue node. |
public LogStream(OutputStream os){
ps=os instanceof PrintStream ? (PrintStream)os : new PrintStream(os);
lineBuffer=new StringBuilder(100);
}
| Creates a new log stream. |
private int calculateNested(@NonNull String text){
if (text.length() < 2) {
return -1;
}
int nested=0;
while (true) {
if ((nested + 1) * KEY_HEADER.length() > text.length()) {
break;
}
String sub=text.substring(nested * KEY_HEADER.length(),(nested + 1) * KEY_HEADER.length());
if (KEY_HEADER.equals(sub)) {
nested++;
}
else if (check(text.substring(nested * KEY_HEADER.length(),text.length()))) {
return nested;
}
else {
return -1;
}
}
return nested;
}
| calculate nested |
public boolean reset(){
boolean wasReset=false;
if (super.reset()) {
resetToStream();
wasReset=true;
}
return wasReset;
}
| Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons). |
public static TestDiscrete[] printAllTestResultsAsOneDataset(Vector<Data> dataCollection,boolean verbose){
TestDiscrete resultsPhraseLevel1=new TestDiscrete();
resultsPhraseLevel1.addNull("O");
TestDiscrete resultsTokenLevel1=new TestDiscrete();
resultsTokenLevel1.addNull("O");
TestDiscrete resultsPhraseLevel2=new TestDiscrete();
resultsPhraseLevel2.addNull("O");
TestDiscrete resultsTokenLevel2=new TestDiscrete();
resultsTokenLevel2.addNull("O");
TestDiscrete resultsByBILOU=new TestDiscrete();
TestDiscrete resultsSegmentation=new TestDiscrete();
resultsByBILOU.addNull("O");
resultsSegmentation.addNull("O");
for (int dataSetId=0; dataSetId < dataCollection.size(); dataSetId++) reportPredictions(dataCollection.elementAt(dataSetId),resultsTokenLevel1,resultsTokenLevel2,resultsPhraseLevel1,resultsPhraseLevel2,resultsByBILOU,resultsSegmentation);
System.out.println("------------------------------------------------------------");
System.out.println("****** Combined performance on all the datasets :");
for (int i=0; i < dataCollection.size(); i++) System.out.println("\t>>> Dataset path : \t" + dataCollection.elementAt(i).datasetPath);
System.out.println("------------------------------------------------------------");
if (verbose) {
if (ParametersForLbjCode.currentParameters.featuresToUse.containsKey("PredictionsLevel1")) {
System.out.println("Phrase-level Acc Level2:");
resultsPhraseLevel2.printPerformance(System.out);
System.out.println("Token-level Acc Level2:");
resultsTokenLevel2.printPerformance(System.out);
System.out.println("Level2 BILOU Accuracy, letter-by-letter:");
resultsByBILOU.printPerformance(System.out);
System.out.println("Level2 BILOU PHRASE/BOUNDARY DETECTION Accuracy");
resultsSegmentation.printPerformance(System.out);
}
System.out.println("Phrase-level Acc Level1:");
resultsPhraseLevel1.printPerformance(System.out);
System.out.println("Token-level Acc Level1:");
resultsTokenLevel1.printPerformance(System.out);
}
else {
System.out.println("\t Level 1: " + resultsPhraseLevel1.getOverallStats()[2]);
if (ParametersForLbjCode.currentParameters.featuresToUse.containsKey("PredictionsLevel1")) System.out.println("\t Level 2: " + resultsPhraseLevel2.getOverallStats()[2]);
}
System.out.println("------------------------------------------------------------");
System.out.println("************************************************************");
System.out.println("------------------------------------------------------------");
return new TestDiscrete[]{resultsPhraseLevel1,resultsPhraseLevel2};
}
| assumes that the data has been annotated by both levels of taggers |
AsyncFuture<Void> doLastFlush(){
return doFlush(null);
}
| Perform the last flush, setting the nextBatch to null, indicating that we are shutting down. |
public boolean isValidSimpleAssignmentTarget(){
return false;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void init(MCMCOptions options,Likelihood likelihood,OperatorSchedule schedule,Logger[] loggers){
init(options,likelihood,Prior.UNIFORM_PRIOR,schedule,loggers,new MarkovChainDelegate[0]);
}
| Must be called before calling chain. |
public boolean contains(double x){
return (min <= x) && (x <= max);
}
| Returns true if this interval contains the specified value. |
public HexEditor(){
ResourceBundle msg=ResourceBundle.getBundle(MSG);
HexTableModel model=new HexTableModel(this,msg);
table=new HexTable(this,model);
setViewportView(table);
setShowRowHeader(true);
setAlternateRowBG(false);
setAlternateColumnBG(false);
setHighlightSelectionInAsciiDump(true);
setHighlightSelectionInAsciiDumpColor(new Color(255,255,192));
setPadLowBytes(true);
setCellEditable(true);
setTransferHandler(DEFAULT_TRANSFER_HANDLER);
}
| Creates a new <code>HexEditor</code> component. |
public void paint(Graphics g,Rectangle bounds){
Color temp=g.getColor();
g.setColor(color);
g.fillRect(bounds.x,bounds.y,bounds.width,bounds.height);
g.setColor(temp);
}
| Paints the background. |
Object processENUM(StylesheetHandler handler,String uri,String name,String rawName,String value,ElemTemplateElement owner) throws org.xml.sax.SAXException {
AVT avt=null;
if (getSupportsAVT()) {
try {
avt=new AVT(handler,uri,name,rawName,value,owner);
if (!avt.isSimple()) return avt;
}
catch ( TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
}
int retVal=this.getEnum(value);
if (retVal == StringToIntTable.INVALID_KEY) {
StringBuffer enumNamesList=getListOfEnums();
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name,value,enumNamesList.toString()},null);
return null;
}
if (getSupportsAVT()) return avt;
else return new Integer(retVal);
}
| Process an attribute string of type T_ENUM into a int value. |
public static Double[] valuesOf(double[] array){
Double[] dest=new Double[array.length];
for (int i=0; i < array.length; i++) {
dest[i]=Double.valueOf(array[i]);
}
return dest;
}
| Converts to object array. |
public void beforeCompletion(int txId){
TXSynchronizationOp.execute(pool,0,txId,TXSynchronizationOp.CompletionType.BEFORE_COMPLETION);
}
| Transaction synchronization notification to the servers |
public DocumentListEntry uploadFile(String filepath,String title) throws IOException, ServiceException, DocumentListException {
if (filepath == null || title == null) {
throw new DocumentListException("null passed in for required parameters");
}
File file=new File(filepath);
String mimeType=DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
DocumentEntry newDocument=new DocumentEntry();
newDocument.setFile(file,mimeType);
newDocument.setTitle(new PlainTextConstruct(title));
return service.insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED),newDocument);
}
| Upload a file. |
public E backward(){
E prevItem=peekBackwards();
if (prevItem == null) {
return null;
}
pos=(pos + size - 1) % size;
return prevItem;
}
| Return the previous element if present, while moving the position in the history as well. |
public void toggle(){
mSlidingMenu.toggle();
}
| Toggle the SlidingMenu. If it is open, it will be closed, and vice versa. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.