code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
@Deprecated public void templateType(ScriptService.ScriptType templateType){
updateOrCreateScript(null,templateType,null,null);
}
| The type of the stored template |
public static boolean hasNextKeyTyped(){
synchronized (keyLock) {
return !keysTyped.isEmpty();
}
}
| Has the user typed a key? |
public boolean isEagerLock(){
return eagerLock;
}
| Eager locking effectively locks the right/left images as well as the main image, as a result more heap is taken |
static boolean isPostgreSQL(){
if (s_type == null) getServerType();
if (s_type != null) return TYPE_POSTGRESQL.equals(s_type);
return false;
}
| Is this PostgreSQL ? |
private static boolean isViewRecycled(PaletteTarget target){
if (target != null && target.getPath() != null && target.getView() != null && target.getView().getTag() != null) {
if (target.getView().getTag() instanceof PaletteTag) {
return !target.getPath().equals(((PaletteTag)target.getView().getTag()).getPath());
}
else {
throw new NoPaletteTagFoundException("PaletteLoader couldn't determine whether" + " a View has been reused or not. PaletteLoader uses View.setTag() and " + "View.getTag() for keeping check if a View has been reused and it's "+ "recommended to refrain from setting tags to Views PaletteLoader is using.");
}
}
else {
return false;
}
}
| Is it null? Is that null? What about that one? Is that null too? What about this one? And this one? Is this null? Is null even null? How can null be real if our eyes aren't real? <p>Checks whether the view has been recycled or not.</p> |
public final void incrementIdCounterTo(int id){
int diff=id - mIdCounter.get();
if (diff < 0) return;
mIdCounter.addAndGet(diff);
updateSharedPreference();
}
| Ensures the counter is at least as high as the specified value. The counter should always point to an unused ID (which will be handed out next time a request comes in). Exposed so that anything externally loading tabs and ids can set enforce new tabs start at the correct id. TODO(dfalcantara): Reduce the visibility of this method once all TabModels are united in how the IDs are assigned (crbug.com/502384). |
public void remove(String userId) throws ServerException {
requireNonNull(userId,"Required non-null user id");
profileDao.remove(userId);
}
| Removes the user's profile. <p>Note that this method won't throw any exception when user doesn't have the corresponding profile. |
public Topology buildAppTopology(){
Topology t=tp.newTopology("kafkaClientSubscriber");
Map<String,Object> config=newConfig(t);
KafkaConsumer kafka=new KafkaConsumer(t,null);
System.out.println("Using Kafka consumer group.id " + config.get(OPT_GROUP_ID));
TStream<String> msgs=kafka.subscribe(null,(String)options.get(OPT_TOPIC));
msgs.sink(null);
return t;
}
| Create a topology for the subscriber application. |
public SVGPath ellipticalArc(double rx,double ry,double ar,double la,double sp,double[] xy){
append(SVGConstants.PATH_ARC,rx,ry,ar,la,sp,xy[0],xy[1]);
return this;
}
| Elliptical arc curve to the given coordinates. |
public void testParsingDotAsHostname() throws Exception {
assertEquals(null,new URI("http://./").getHost());
}
| Regression test for http://b/issue?id=2604061 |
public void endElement() throws Exception {
}
| Description of the Method |
void addBridgeIfNeeded(DiagnosticPosition pos,Symbol sym,ClassSymbol origin,ListBuffer<JCTree> bridges){
if (sym.kind == MTH && sym.name != names.init && (sym.flags() & (PRIVATE | STATIC)) == 0 && (sym.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) != SYNTHETIC && sym.isMemberOf(origin,types)) {
MethodSymbol meth=(MethodSymbol)sym;
MethodSymbol bridge=meth.binaryImplementation(origin,types);
MethodSymbol impl=meth.implementation(origin,types,true,overrideBridgeFilter);
if (bridge == null || bridge == meth || (impl != null && !bridge.owner.isSubClass(impl.owner,types))) {
if (impl != null && isBridgeNeeded(meth,impl,origin.type)) {
addBridge(pos,meth,impl,origin,bridge == impl,bridges);
}
else if (impl == meth && impl.owner != origin && (impl.flags() & FINAL) == 0 && (meth.flags() & (ABSTRACT | PUBLIC)) == PUBLIC && (origin.flags() & PUBLIC) > (impl.owner.flags() & PUBLIC)) {
addBridge(pos,meth,impl,origin,false,bridges);
}
}
else if ((bridge.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) == SYNTHETIC) {
MethodSymbol other=overridden.get(bridge);
if (other != null && other != meth) {
if (impl == null || !impl.overrides(other,origin,types,true)) {
log.error(pos,"name.clash.same.erasure.no.override",other,other.location(origin.type,types),meth,meth.location(origin.type,types));
}
}
}
else if (!bridge.overrides(meth,origin,types,true)) {
if (bridge.owner == origin || types.asSuper(bridge.owner.type,meth.owner) == null) log.error(pos,"name.clash.same.erasure.no.override",bridge,bridge.location(origin.type,types),meth,meth.location(origin.type,types));
}
}
}
| Add bridge if given symbol is a non-private, non-static member of the given class, which is either defined in the class or non-final inherited, and one of the two following conditions holds: 1. The method's type changes in the given class, as compared to the class where the symbol was defined, (in this case we have extended a parameterized class with non-trivial parameters). 2. The method has an implementation with a different erased return type. (in this case we have used co-variant returns). If a bridge already exists in some other class, no new bridge is added. Instead, it is checked that the bridge symbol overrides the method symbol. (Spec ???). todo: what about bridges for privates??? |
public PathMatchingResourcePatternResolver(ResourceLoader resourceLoader){
Assert.notNull(resourceLoader,"ResourceLoader must not be null");
this.resourceLoader=resourceLoader;
}
| Create a new PathMatchingResourcePatternResolver. <p>ClassLoader access will happen via the thread context class loader. |
protected final static byte composeMessagingMode(byte esmClass,byte messagingModeValue){
return (byte)(cleanMessagingMode(esmClass) | messagingModeValue);
}
| Compose the Messaging Mode. Messaging Mode encoded on ESM Class at bits 1 - 0. |
public static void checkArgument(boolean expression){
if (!expression) {
throw new IllegalArgumentException();
}
}
| Ensures the truth of an expression involving one or more parameters to the calling method. |
public EntityView(){
}
| Constructs a view with no content. |
public void writeProperties(Path path) throws IOException {
logger.info("Writing properties to path: " + path.toAbsolutePath());
FileOutputStream stream=new FileOutputStream(path.toFile());
try {
toProperties().store(stream,"DCOS got yo Cassandra!");
}
finally {
stream.close();
}
}
| Writes the Location as a Properties file. |
public void cloneMethodClassifications(SootMethod original,SootMethod clone){
if (API.v().isBannedMethod(original.getSignature())) API.v().addBanMethod(clone);
else if (API.v().isSpecMethod(original)) API.v().addSpecMethod(clone);
else if (API.v().isSafeMethod(original)) API.v().addSafeMethod(clone);
else if (API.v().isSystemClass(original.getDeclaringClass())) {
API.v().addBanMethod(clone);
}
if (classificationCat.containsKey(original)) {
classificationCat.put(clone,classificationCat.get(original));
}
if (srcsMapping.containsKey(original)) {
Set<InfoKind> ifs=new HashSet<InfoKind>();
ifs.addAll(srcsMapping.get(original));
srcsMapping.put(clone,ifs);
}
if (sinksMapping.containsKey(original)) {
Set<InfoKind> ifs=new HashSet<InfoKind>();
ifs.addAll(sinksMapping.get(original));
sinksMapping.put(clone,ifs);
}
if (sourcesThatTaintArgs.contains(original)) sourcesThatTaintArgs.add(clone);
}
| When adding a method clone, make sure the cloned method has all same designations as original. |
public Integer remove(Integer key){
return wrapValue(_map.remove(unwrapKey(key)));
}
| Deletes a key/value pair from the map. |
public void testCheckFoundWithResultAsFailed(){
LOGGER.debug("check found with result as failed");
initCheckerAndLaunch("src/test/resources/css/test3.css",null,TestSolution.FAILED,".selector");
}
| Test of check method, of class CssPropertyPresenceChecker. |
private void jbInit() throws Exception {
CompiereColor.setBackground(this);
mainPanel.setLayout(mainLayout);
parameterLayout=new MigLayout("fillx, wrap 4, hidemode 0"," [150:150][250:250][100:100][200:200]");
parameterPanel.setLayout(parameterLayout);
bRefresh.addActionListener(this);
bReset.addActionListener(this);
bZoom.addActionListener(this);
bGenerate.setEnabled(false);
bReset.setEnabled(false);
bGenerate.setText(Msg.getMsg(Env.getCtx(),"Process"));
bReset.setText(Msg.getMsg(Env.getCtx(),"Reset"));
bZoom.setText(Msg.translate(Env.getCtx(),"Fact_Acct_ID"));
bSelectAll.addActionListener(this);
bSelectAll.setText(Msg.getMsg(Env.getCtx(),"SelectAll"));
labelAcctSchema.setText(Msg.translate(Env.getCtx(),"C_AcctSchema_ID"));
labelAccount.setText(Msg.translate(Env.getCtx(),"Account_ID"));
labelBPartner.setText(Msg.translate(Env.getCtx(),"C_BPartner_ID"));
labelDateAcct.setText(Msg.translate(Env.getCtx(),"DateAcct"));
labelDateAcct2.setText("-");
labelProduct.setText(Msg.translate(Env.getCtx(),"M_Product_ID"));
labelOrg.setText(Msg.translate(Env.getCtx(),"AD_Org_ID"));
isReconciled.setText(Msg.translate(Env.getCtx(),"IsReconciled"));
dataStatus.setText(" ");
differenceLabel.setText(Msg.getMsg(Env.getCtx(),"Difference"));
differenceField.setBackground(AdempierePLAF.getFieldBackground_Inactive());
differenceField.setEditable(false);
differenceField.setText("0");
differenceField.setColumns(8);
differenceField.setHorizontalAlignment(SwingConstants.RIGHT);
bGenerate.addActionListener(this);
bCancel.addActionListener(this);
mainPanel.add(parameterPanel,BorderLayout.NORTH);
parameterPanel.add(labelAcctSchema,"");
parameterPanel.add(fieldAcctSchema,"growx");
parameterPanel.add(labelOrg,"");
parameterPanel.add(fieldOrg,"growx");
parameterPanel.add(labelAccount,"");
parameterPanel.add(fieldAccount,"wmax 250");
parameterPanel.add(isReconciled,"skip 1");
parameterPanel.add(labelBPartner,"");
parameterPanel.add(fieldBPartner,"growx");
parameterPanel.add(labelProduct,"");
parameterPanel.add(fieldProduct,"growx");
parameterPanel.add(labelDateAcct,"");
parameterPanel.add(fieldDateAcct,"growx");
parameterPanel.add(labelDateAcct2,"");
parameterPanel.add(fieldDateAcct2,"growx");
parameterPanel.add(bRefresh,"growx");
mainPanel.add(dataStatus,BorderLayout.SOUTH);
mainPanel.add(dataPane,BorderLayout.CENTER);
dataPane.getViewport().add(miniTable,null);
commandPanel.setLayout(commandLayout);
commandLayout.setAlignment(FlowLayout.RIGHT);
commandLayout.setHgap(10);
commandPanel.add(bSelectAll);
commandPanel.add(bZoom,null);
commandPanel.add(differenceLabel,null);
commandPanel.add(differenceField,null);
commandPanel.add(bGenerate,null);
commandPanel.add(bReset,null);
commandPanel.add(bCancel,null);
}
| Static Init |
public void calcMinMax(int start,int end){
if (mDataSets == null || mDataSets.size() < 1) {
mYMax=0f;
mYMin=0f;
}
else {
mLastStart=start;
mLastEnd=end;
mYMin=Float.MAX_VALUE;
mYMax=-Float.MAX_VALUE;
for (int i=0; i < mDataSets.size(); i++) {
mDataSets.get(i).calcMinMax(start,end);
if (mDataSets.get(i).getYMin() < mYMin) mYMin=mDataSets.get(i).getYMin();
if (mDataSets.get(i).getYMax() > mYMax) mYMax=mDataSets.get(i).getYMax();
}
if (mYMin == Float.MAX_VALUE) {
mYMin=0.f;
mYMax=0.f;
}
T firstLeft=getFirstLeft();
if (firstLeft != null) {
mLeftAxisMax=firstLeft.getYMax();
mLeftAxisMin=firstLeft.getYMin();
for ( DataSet<?> dataSet : mDataSets) {
if (dataSet.getAxisDependency() == AxisDependency.LEFT) {
if (dataSet.getYMin() < mLeftAxisMin) mLeftAxisMin=dataSet.getYMin();
if (dataSet.getYMax() > mLeftAxisMax) mLeftAxisMax=dataSet.getYMax();
}
}
}
T firstRight=getFirstRight();
if (firstRight != null) {
mRightAxisMax=firstRight.getYMax();
mRightAxisMin=firstRight.getYMin();
for ( DataSet<?> dataSet : mDataSets) {
if (dataSet.getAxisDependency() == AxisDependency.RIGHT) {
if (dataSet.getYMin() < mRightAxisMin) mRightAxisMin=dataSet.getYMin();
if (dataSet.getYMax() > mRightAxisMax) mRightAxisMax=dataSet.getYMax();
}
}
}
handleEmptyAxis(firstLeft,firstRight);
}
}
| calc minimum and maximum y value over all datasets |
public PipeConnectionEvent(Object source){
super(source);
}
| Construct an object with the specific pipe as the <tt>source</tt> |
@SuppressWarnings("unchecked") static final <K,V>Segment<K,V> segmentAt(Segment<K,V>[] ss,int j){
long u=(j << SSHIFT) + SBASE;
return ss == null ? null : (Segment<K,V>)UNSAFE.getObjectVolatile(ss,u);
}
| Gets the jth element of given segment array (if nonnull) with volatile element access semantics via Unsafe. (The null check can trigger harmlessly only during deserialization.) Note: because each element of segments array is set only once (using fully ordered writes), some performance-sensitive methods rely on this method only as a recheck upon null reads. |
public void createMissingCaches() throws IgniteCheckedException {
for ( Map.Entry<String,DynamicCacheDescriptor> e : registeredCaches.entrySet()) {
CacheConfiguration ccfg=e.getValue().cacheConfiguration();
if (!caches.containsKey(maskNull(ccfg.getName())) && GridQueryProcessor.isEnabled(ccfg)) dynamicStartCache(null,ccfg.getName(),null,false,true,true).get();
}
}
| Starts client caches that do not exist yet. |
public GSSResult authenticate(String tenantName,String contextId,byte[] gssTicket) throws Exception {
return getService().authenticate(tenantName,contextId,gssTicket,this.getServiceContext());
}
| Authenticates using a ticket obtained through GSSAPI. |
public void testSetF25(){
boolean f25=false;
AbstractThrottle instance=new AbstractThrottleImpl();
instance.setF25(f25);
jmri.util.JUnitAppender.assertErrorMessage("Can't send F21-F28 since no command station defined");
}
| Test of setF25 method, of class AbstractThrottle. |
public ByteBuffer(){
this(64);
}
| Create a new byte buffer. |
static PotionType fromName(String name){
for ( PotionTypeTable table : values()) {
if (name.equalsIgnoreCase(table.name)) return table.type;
}
return PotionType.valueOf(name.toUpperCase());
}
| Converts a Vanilla Potion ID to an equivalent Bukkit PotionType |
private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
init(getName());
}
| readObject is called to restore the state of the DelegationPermission from a stream. |
private void createSampler(){
this.sampler=glGenSamplers();
glSamplerParameteri(this.sampler,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glSamplerParameteri(this.sampler,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
}
| Create the sampler to sample the framebuffer texture within the shader. |
public static ContactList blockingGetByUris(Parcelable[] uris){
ContactList list=new ContactList();
if (uris != null && uris.length > 0) {
for ( Parcelable p : uris) {
Uri uri=(Uri)p;
if ("tel".equals(uri.getScheme())) {
Contact contact=Contact.get(uri.getSchemeSpecificPart(),true);
list.add(contact);
}
}
final List<Contact> contacts=Contact.getByPhoneUris(uris);
if (contacts != null) {
list.addAll(contacts);
}
}
return list;
}
| Returns a ContactList for the corresponding recipient URIs passed in. This method will always block to query provider. The given URIs could be the phone data URIs or tel URI for the numbers don't belong to any contact. |
public static String toString(URL url,Charset encoding) throws IOException {
InputStream inputStream=url.openStream();
try {
return toString(inputStream,encoding);
}
finally {
inputStream.close();
}
}
| Gets the contents at the given URL. |
public int addEdge(int s,int t){
throw new UnsupportedOperationException("Changes to graph structure not allowed for spanning trees.");
}
| Unsupported operation. Spanning trees should not be edited. |
LocalVarState(Method m,Block b,Typeref[] initial_frame_state){
this.conservative_verifier_rules=b.is_backwards_branch_target;
this.fs_in=new Typeref[initial_frame_state.length];
if (!this.conservative_verifier_rules) {
System.arraycopy(initial_frame_state,0,this.fs_in,0,initial_frame_state.length);
}
else {
for (int i=0; i < m.local_count; i++) {
this.fs_in[i]=initial_frame_state[i].nullable();
}
for (int i=m.local_count + m.max_scope; i < this.fs_in.length; i++) {
this.fs_in[i]=initial_frame_state[i].nullable();
}
}
this.fs_out=new Typeref[initial_frame_state.length];
System.arraycopy(this.fs_in,0,this.fs_out,0,this.fs_in.length);
this.hard_coercions=new Typeref[initial_frame_state.length];
this.m=m;
this.b=b;
Typeref[] saved_fs=null;
if (verbose_mode) {
verboseStatus(b);
StringBuffer verbose_succ=new StringBuffer();
verbose_succ.append("\tsucc: ");
for ( Edge p : b.succ()) {
verbose_succ.append(p);
verbose_succ.append(" ");
}
verboseStatus(verbose_succ);
dumpFrameState(fs_out);
saved_fs=new Typeref[initial_frame_state.length];
System.arraycopy(fs_out,0,saved_fs,0,fs_out.length);
}
for ( Expr e : b.exprs) {
if (verbose_mode) verboseStatus(formatExprAsAbc(e));
switch (e.op) {
case OP_getlocal0:
case OP_getlocal1:
case OP_getlocal2:
case OP_getlocal3:
{
uses(e.op - OP_getlocal0);
break;
}
case OP_getlocal:
{
uses(e.imm[0]);
break;
}
case OP_setlocal0:
case OP_setlocal1:
case OP_setlocal2:
case OP_setlocal3:
{
defines(e.op - OP_setlocal0,e);
break;
}
case OP_setlocal:
{
defines(e.imm[0],e);
break;
}
case OP_hasnext2:
{
uses(e.imm[0]);
uses(e.imm[1]);
expectsType(e.imm[0],ANY().ref);
expectsType(e.imm[1],INT().ref);
hard_coercions[e.imm[0]]=ANY().ref;
defines(e.imm[0],e);
break;
}
case OP_kill:
{
setKilled(e.imm[0]);
break;
}
case OP_inclocal:
case OP_inclocal_i:
case OP_declocal:
case OP_declocal_i:
{
uses(e.imm[0]);
break;
}
case OP_getslot:
case OP_setslot:
{
Expr stem=e.args[0];
if (stem.inLocal()) {
expectsType(stem.imm[0],m.verifier_types.get(stem));
}
break;
}
case OP_nextvalue:
case OP_nextname:
{
break;
}
default :
assert (!e.inLocal());
}
if (verbose_mode) {
for (int i=0; i < fs_out.length; i++) {
if (saved_fs[i] != fs_out[i]) {
dumpFrameState(fs_out);
System.arraycopy(fs_out,0,saved_fs,0,fs_out.length);
break;
}
}
}
}
}
| Construct a LocalVariableState; compute its def, kill, and upwardly-exposed sets; and compute its frame state. |
public void sort(){
Map<String,PsiMethod> methods=getMethodsMap();
Map<String,PsiMethod> sortedMethods=null;
LifecycleFactory lifecycleFactory=new LifecycleFactory();
Lifecycle lifecycle=lifecycleFactory.createLifecycle(mPsiClass,methods);
if (lifecycle != null && !methods.isEmpty()) {
sortedMethods=lifecycle.sort();
appendSortedMethods(sortedMethods);
deleteUnsortedLifecycleMethods(sortedMethods.values());
}
}
| Formats the activity/fragment lifecycle methods |
public _ScheduleDays(final String[] flagStrings){
super(flagStrings);
}
| Constructs a _ScheduleDays with the given flags initially set. |
public static ApexStream<String> fromKafka08(String zookeepers,String topic,Option... opts){
KafkaSinglePortStringInputOperator kafkaSinglePortStringInputOperator=new KafkaSinglePortStringInputOperator();
kafkaSinglePortStringInputOperator.getConsumer().setTopic(topic);
kafkaSinglePortStringInputOperator.getConsumer().setZookeeper(zookeepers);
ApexStreamImpl<String> newStream=new ApexStreamImpl<>();
return newStream.addOperator(kafkaSinglePortStringInputOperator,null,kafkaSinglePortStringInputOperator.outputPort);
}
| Create a stream of string reading input from kafka 0.8 |
private static Object unwrap(Object object){
if (object instanceof Reflect) {
return ((Reflect)object).get();
}
return object;
}
| Unwrap an object |
protected final void LONG_DIVIDES(Instruction s,RegisterOperand result,Operand val1,Operand val2,boolean isDiv,boolean signed){
EMIT(CPOS(s,MIR_Move.create(IA32_MOV,new RegisterOperand(getEDX(),TypeReference.Long),val1)));
EMIT(CPOS(s,MIR_Move.create(IA32_MOV,new RegisterOperand(getEAX(),TypeReference.Long),val1.copy())));
EMIT(CPOS(s,MIR_BinaryAcc.create(IA32_SAR,new RegisterOperand(getEDX(),TypeReference.Long),LC(0x3f))));
if (val2.isLongConstant() || val2.isIntConstant()) {
RegisterOperand temp=regpool.makeTempLong();
EMIT(CPOS(s,MIR_Move.create(IA32_MOV,temp,val2)));
val2=temp.copyRO();
}
EMIT(MIR_Divide.mutate(s,signed ? IA32_IDIV : IA32_DIV,new RegisterOperand(getEDX(),TypeReference.Long),new RegisterOperand(getEAX(),TypeReference.Long),val2,GuardedBinary.getGuard(s)));
if (isDiv) {
EMIT(CPOS(s,MIR_Move.create(IA32_MOV,result.copyD2D(),new RegisterOperand(getEAX(),TypeReference.Long))));
}
else {
EMIT(CPOS(s,MIR_Move.create(IA32_MOV,result.copyD2D(),new RegisterOperand(getEDX(),TypeReference.Long))));
}
}
| Expansion of LONG_DIV and LONG_REM |
private void updateSelection(Projection proj,SVGPoint p1,SVGPoint p2){
DBIDSelection selContext=context.getSelection();
ModifiableDBIDs selection;
if (selContext != null) {
selection=DBIDUtil.newHashSet(selContext.getSelectedIds());
}
else {
selection=DBIDUtil.newHashSet();
}
ModifiableHyperBoundingBox ranges;
if (p1 == null || p2 == null) {
LOG.warning("no rect selected: p1: " + p1 + " p2: "+ p2);
}
else {
double x1=Math.min(p1.getX(),p2.getX());
double x2=Math.max(p1.getX(),p2.getX());
double y1=Math.max(p1.getY(),p2.getY());
double y2=Math.min(p1.getY(),p2.getY());
int dim=proj.getInputDimensionality();
if (selContext instanceof RangeSelection) {
ranges=((RangeSelection)selContext).getRanges();
}
else {
ranges=new ModifiableHyperBoundingBox(dim,Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY);
}
updateSelectionRectKoordinates(x1,x2,y1,y2,ranges);
selection.clear();
candidates: for (DBIDIter iditer=relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
NumberVector dbTupel=relation.get(iditer);
for (int d=0; d < dim; d++) {
final double min=ranges.getMin(d), max=ranges.getMax(d);
if (max < Double.POSITIVE_INFINITY && min > Double.NEGATIVE_INFINITY) {
if (dbTupel.doubleValue(d) < min || dbTupel.doubleValue(d) > max) {
continue candidates;
}
}
}
selection.add(iditer);
}
context.setSelection(new RangeSelection(selection,ranges));
}
}
| Update the selection in the context. |
public OMScalingIcon(double centerLat,double centerLon,int offsetX,int offsetY,Image ii,float baseScale){
super();
setRenderType(OMGraphic.RENDERTYPE_LATLON);
setColorModel(COLORMODEL_IMAGEICON);
lat=centerLat;
lon=centerLon;
setImage(ii);
setX(offsetX);
setY(offsetY);
this.baseScale=baseScale;
}
| Create an OMRaster, Lat/Lon placement with an Image. |
@Override public void actionPerformed(ActionEvent event){
if (verifyMessagePanel == null) {
return;
}
String addressText=null;
if (verifyMessagePanel.getAddressTextArea() != null) {
addressText=verifyMessagePanel.getAddressTextArea().getText();
if (addressText != null) {
addressText=WhitespaceTrimmer.trim(addressText);
}
}
String messageText=null;
if (verifyMessagePanel.getMessageTextArea() != null) {
messageText=verifyMessagePanel.getMessageTextArea().getText();
}
String signatureText=null;
if (verifyMessagePanel.getSignatureTextArea() != null) {
signatureText=verifyMessagePanel.getSignatureTextArea().getText();
}
log.debug("addressText = '" + addressText + "'");
log.debug("messageText = '" + messageText + "'");
log.debug("signatureText = '" + signatureText + "'");
if (addressText == null || "".equals(addressText)) {
verifyMessagePanel.setMessageText1(controller.getLocaliser().getString("verifyMessageAction.noAddress"));
verifyMessagePanel.setMessageText2(" ");
return;
}
if (messageText == null || "".equals(messageText.trim())) {
verifyMessagePanel.setMessageText1(controller.getLocaliser().getString("verifyMessageAction.noMessage"));
verifyMessagePanel.setMessageText2(" ");
return;
}
if (signatureText == null || "".equals(signatureText.trim())) {
verifyMessagePanel.setMessageText1(controller.getLocaliser().getString("verifyMessageAction.noSignature"));
verifyMessagePanel.setMessageText2(" ");
return;
}
try {
Address expectedAddress=new Address(bitcoinController.getModel().getNetworkParameters(),addressText);
ECKey key=ECKey.signedMessageToKey(messageText,signatureText);
Address gotAddress=key.toAddress(bitcoinController.getModel().getNetworkParameters());
if (expectedAddress != null && expectedAddress.equals(gotAddress)) {
log.debug("The message was signed by the specified address");
verifyMessagePanel.setMessageText1(controller.getLocaliser().getString("verifyMessageAction.success"));
verifyMessagePanel.setMessageText2(" ");
}
else {
log.debug("The message was NOT signed by the specified address");
verifyMessagePanel.setMessageText1(controller.getLocaliser().getString("verifyMessageAction.failure"));
verifyMessagePanel.setMessageText2(" ");
}
}
catch ( WrongNetworkException e) {
logError(e);
}
catch ( AddressFormatException e) {
logError(e);
}
catch ( SignatureException e) {
logError(e);
}
}
| Verify the message. |
protected void registerValidatableTextFieldAttributes(){
addAttributeProcessor(new RestoreLastValidLmlAttribute(),"restore","restoreLastValid");
addAttributeProcessor(new ValidationEnabledLmlAttribute(),"enabled","validate","validationEnabled");
}
| VisValidatableTextField attributes. |
private ResultPoint correctTopRight(ResultPoint bottomLeft,ResultPoint bottomRight,ResultPoint topLeft,ResultPoint topRight,int dimension){
float corr=distance(bottomLeft,bottomRight) / (float)dimension;
int norm=distance(topLeft,topRight);
float cos=(topRight.getX() - topLeft.getX()) / norm;
float sin=(topRight.getY() - topLeft.getY()) / norm;
ResultPoint c1=new ResultPoint(topRight.getX() + corr * cos,topRight.getY() + corr * sin);
corr=distance(bottomLeft,topLeft) / (float)dimension;
norm=distance(bottomRight,topRight);
cos=(topRight.getX() - bottomRight.getX()) / norm;
sin=(topRight.getY() - bottomRight.getY()) / norm;
ResultPoint c2=new ResultPoint(topRight.getX() + corr * cos,topRight.getY() + corr * sin);
if (!isValid(c1)) {
if (isValid(c2)) {
return c2;
}
return null;
}
if (!isValid(c2)) {
return c1;
}
int l1=Math.abs(transitionsBetween(topLeft,c1).getTransitions() - transitionsBetween(bottomRight,c1).getTransitions());
int l2=Math.abs(transitionsBetween(topLeft,c2).getTransitions() - transitionsBetween(bottomRight,c2).getTransitions());
return l1 <= l2 ? c1 : c2;
}
| Calculates the position of the white top right module using the output of the rectangle detector for a square matrix |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public static void showOnMap(Activity activity,double[] latLong){
try {
String uri=String.format(Locale.ENGLISH,"http://maps.google.com/maps?f=q&q=(%f,%f)",latLong[0],latLong[1]);
ComponentName compName=new ComponentName(MAPS_PACKAGE_NAME,MAPS_CLASS_NAME);
Intent mapsIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(uri)).setComponent(compName);
activity.startActivityForResult(mapsIntent,CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW);
}
catch ( ActivityNotFoundException e) {
Log.e(TAG,"GMM activity not found!",e);
String url=String.format(Locale.ENGLISH,"geo:%f,%f",latLong[0],latLong[1]);
try {
Intent mapsIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
activity.startActivity(mapsIntent);
}
catch ( ActivityNotFoundException ex) {
Log.e(TAG,"Map view activity not found!",ex);
RotateTextToast.makeText(activity,activity.getString(R.string.map_activity_not_found_err),Toast.LENGTH_SHORT).show();
}
}
}
| Starts GMM with the given location shown. If this fails, and GMM could not be found, we use a geo intent as a fallback. |
public Constituent(String label,double score,String viewName,TextAnnotation text,int start,int end){
if (label == null) label="";
int labelId=text.symtab.getId(label);
if (labelId == -1) labelId=text.symtab.add(label);
this.label=labelId;
this.constituentScore=score;
this.viewName=viewName;
textAnnotation=text;
this.span=new IntPair(start,end);
int startSpan=this.getStartSpan();
int endSpan=this.getEndSpan();
if (start >= 0) {
assert startSpan >= 0;
assert endSpan >= 0;
}
this.outgoingRelations=new ArrayList<>();
this.incomingRelations=new ArrayList<>();
if (startSpan >= 0) {
startCharOffset=text.getTokenCharacterOffset(startSpan).getFirst();
}
else startCharOffset=-1;
if (endSpan > 0 && endSpan <= text.size()) {
if (endSpan > startSpan) endCharOffset=text.getTokenCharacterOffset(endSpan - 1).getSecond();
else endCharOffset=text.getTokenCharacterOffset(endSpan).getSecond();
}
else endCharOffset=0;
assert endCharOffset >= startCharOffset : "End character offset of constituent less than start!\n" + text.getTokenizedText() + "("+ start+ ", "+ end+ "), -> ("+ startCharOffset+ ", "+ endCharOffset+ ")";
}
| start, end offsets are token indexes, and use one-past-the-end indexing -- so a one-token constituent right at the beginning of a text has start/end (0,1) offsets are relative to the entire text span (i.e. NOT sentence-relative) |
public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav){
if (alav.getNamespaceURI() == null) {
String ln=alav.getLocalName();
if (ln.equals(SVG_CX_ATTRIBUTE) || ln.equals(SVG_CY_ATTRIBUTE) || ln.equals(SVG_RX_ATTRIBUTE)|| ln.equals(SVG_RY_ATTRIBUTE)) {
buildShape(ctx,e,(ShapeNode)node);
handleGeometryChanged();
return;
}
}
super.handleAnimatedAttributeChanged(alav);
}
| Invoked when the animated value of an animatable attribute has changed. |
public static _Fields findByThriftIdOrThrow(int fieldId){
_Fields fields=findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
| Find the _Fields constant that matches fieldId, throwing an exception if it is not found. |
boolean createSnapshot(String snapshotName,boolean async){
NaElement elem=new NaElement("snapshot-create");
elem.addNewChild("volume",name);
elem.addNewChild("snapshot",snapshotName);
elem.addNewChild("async",Boolean.toString(async));
try {
server.invokeElem(elem);
}
catch ( Exception e) {
String msg="Failed to create snapshot on volume: " + name;
log.error(msg,e);
throw new NetAppCException(msg,e);
}
return true;
}
| Creates a new snapshot of the volume. |
private static void center(Box box,float axis){
float h=box.getHeight(), total=h + box.getDepth();
box.setShift(-(total / 2 - h) - axis);
}
| Centers the given box with resprect to the given axis, by setting an appropriate shift value. |
public XlsxSheetContentParser(File xlsxFile,String workbookZipEntryPath,String[] sharedStrings,XlsxNumberFormats numberFormats,XlsxSheetMetaData sheetMetaData,XMLInputFactory factory,Charset encoding) throws XMLStreamException, IOException {
this.xlsxFile=xlsxFile;
this.workbookZipEntryPath=workbookZipEntryPath;
this.sharedStrings=sharedStrings;
this.numberFormats=numberFormats;
this.sheetMetaData=sheetMetaData;
this.encoding=encoding;
this.emptyColumn=new boolean[sheetMetaData.getNumberOfColumns()];
Arrays.fill(emptyColumn,true);
reset(factory);
}
| Constructs object by saving the shared strings and instantiating a XML reader. |
@Override public void activateGroupClones(StorageSystem storage,List<URI> clones,TaskCompleter completer){
log.info("activateGroupClones operation START");
try {
modifyGroupClones(storage,clones,SmisConstants.SPLIT_VALUE);
List<Volume> cloneVols=_dbClient.queryObject(Volume.class,clones);
for ( Volume clone : cloneVols) {
clone.setSyncActive(true);
clone.setReplicaState(ReplicationState.SYNCHRONIZED.name());
}
_dbClient.persistObject(cloneVols);
if (completer != null) {
completer.ready(_dbClient);
}
}
catch ( Exception e) {
log.error(MODIFY_GROUP_ERROR,e);
completer.error(_dbClient,DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
}
log.info("activateGroupClones operation END");
}
| This interface is for the clone activate in CG, for vnx, it is to Split (Consistent Fracture) the mirror. |
public static void logTradeOrder(TradeOrder order){
_log.debug("OrderKey: " + +order.getOrderKey() + " ClientId: "+ order.getClientId()+ " PermId: "+ order.getPermId()+ " Action: "+ order.getAction()+ " TotalQuantity: "+ order.getQuantity()+ " OrderType: "+ order.getOrderType()+ " LmtPrice: "+ order.getLimitPrice()+ " AuxPrice: "+ order.getAuxPrice()+ " Tif: "+ order.getTimeInForce()+ " OcaGroup: "+ order.getOcaGroupName()+ " OcaType: "+ order.getOcaType()+ " OrderRef: "+ order.getOrderReference()+ " Transmit: "+ order.getTransmit()+ " DisplaySize: "+ order.getDisplayQuantity()+ " TriggerMethod: "+ order.getTriggerMethod()+ " Hidden: "+ order.getHidden()+ " ParentId: "+ order.getParentId()+ " GoodAfterTime: "+ order.getGoodAfterTime()+ " GoodTillDate: "+ order.getGoodTillTime()+ " OverridePercentageConstraints: "+ order.getOverrideConstraints()+ " AllOrNone: "+ order.getAllOrNothing());
}
| Method logTradeOrder. |
public void testCase17(){
byte aBytes[]={-127,100,56,7,98,-1,39,-128,127,75};
byte bBytes[]={27,-15,65,39,100};
int aSign=1;
int bSign=1;
byte rBytes[]={12,-21,73,56,27};
BigInteger aNumber=new BigInteger(aSign,aBytes);
BigInteger bNumber=new BigInteger(bSign,bBytes);
BigInteger result=aNumber.remainder(bNumber);
byte resBytes[]=new byte[rBytes.length];
resBytes=result.toByteArray();
for (int i=0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign",1,result.signum());
}
| Remainder of division of two positive numbers |
public static void doMain(File modelFile,Properties properties,IssueAcceptor issueAcceptor) throws N4JSCompileException {
N4HeadlessCompiler hlc=injectAndSetup(properties);
hlc.compileSingleFile(modelFile,issueAcceptor);
}
| Compiles a single n4js/js file |
private VariableReference addPrimitive(TestCase test,PrimitiveStatement<?> old,int position) throws ConstructionFailedException {
logger.debug("Adding primitive");
Statement st=old.clone(test);
return test.addStatement(st,position);
}
| Add primitive statement at position |
@GET @Path("/{id}/refresh-matched-pools") @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @CheckPermission(roles={Role.SYSTEM_ADMIN,Role.RESTRICTED_SYSTEM_ADMIN}) public StoragePoolList refreshMatchedStoragePools(@PathParam("id") URI id){
return refreshMatchedPools(VirtualPool.Type.file,id);
}
| This method re-computes the matched pools for this VirtualPool and returns this information. Where as getStoragePools {id}/storage-pools returns whatever is already computed, for matched pools. |
public void applyPattern(String pattern){
this.pattern=pattern;
if (patternTokens != null) {
patternTokens.clear();
patternTokens=null;
}
}
| Apply a new pattern. |
public ClassifierReference(String classifierModuleSpecifier,String classifierName){
this.classifierModuleSpecifier=classifierModuleSpecifier;
this.classifierName=classifierName;
this.uri=null;
}
| Creates a unresolved classifier reference. |
public void writeAsSerializedByteArray(Object v) throws IOException {
if (this.ignoreWrites) return;
checkIfWritable();
ensureCapacity(5);
if (v instanceof HeapDataOutputStream) {
HeapDataOutputStream other=(HeapDataOutputStream)v;
other.finishWriting();
InternalDataSerializer.writeArrayLength(other.size(),this);
if (this.doNotCopy) {
if (other.chunks != null) {
for ( ByteBuffer bb : other.chunks) {
write(bb);
}
}
write(other.buffer);
}
else {
other.sendTo((ByteBufferWriter)this);
other.rewind();
}
}
else {
ByteBuffer sizeBuf=this.buffer;
int sizePos=sizeBuf.position();
sizeBuf.position(sizePos + 5);
final int preArraySize=size();
DataSerializer.writeObject(v,this);
int arraySize=size() - preArraySize;
sizeBuf.put(sizePos,InternalDataSerializer.INT_ARRAY_LEN);
sizeBuf.putInt(sizePos + 1,arraySize);
}
}
| Writes the given object to this stream as a byte array. The byte array is produced by serializing v. The serialization is done by calling DataSerializer.writeObject. |
public final String executeStringQuery(String sql,boolean mandatory) throws AdeException {
return SpecialSqlQueries.executeStringQuery(sql,m_connection,mandatory);
}
| Executes a given query, that is expected to return a String result. If the query returns more than one result, an exception is thrown. If it returns no result, and mandatory flag is true an exception is thrown. Otherwise null is returned. To distinguish between no result and null in the database use the StringQueryExecuter inner class. |
@SuppressWarnings("unchecked") public static <T>ManyAssociationFunction<T> manyAssociation(ManyAssociation<T> association){
return ((ManyAssociationReferenceHandler<T>)Proxy.getInvocationHandler(association)).manyAssociation();
}
| Create a new Query Template ManyAssociationFunction. |
public void rechazarExecuteLogic(ActionMapping mappings,ActionForm form,HttpServletRequest request,HttpServletResponse response){
DocumentoVitalForm frm=(DocumentoVitalForm)form;
getGestionDocumentosVitalesBI(request).rechazarDocumentoVital(frm.getId());
goBackExecuteLogic(mappings,form,request,response);
}
| Rechaza un documento vital. |
public void putValue(String name,Object value){
if (name == null || value == null) {
throw new IllegalArgumentException("name == null || value == null");
}
Object old=values.put(name,value);
if (value instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener)value).valueBound(new SSLSessionBindingEvent(this,name));
}
if (old instanceof SSLSessionBindingListener) {
((SSLSessionBindingListener)old).valueUnbound(new SSLSessionBindingEvent(this,name));
}
}
| A link (name) with the specified value object of the SSL session's application layer data is created or replaced. If the new (or existing) value object implements the <code>SSLSessionBindingListener</code> interface, that object will be notified in due course. |
public static void main(final String[] args){
DOMTestCase.doMain(setAttributeNodeNS03.class,args);
}
| Runs this test from the command line. |
public void print(Object o) throws IOException {
if (_startLine) printIndent();
_os.print(o);
_lastCr=false;
}
| Prints an object. |
public Status stop(boolean failover){
LOGGER.info("Stopping driver");
Status status=driver.stop(failover);
LOGGER.info("Driver stopped with status: {}",status);
return status;
}
| Stops the underlying Mesos SchedulerDriver. If the failover flag is set to false, Myriad will not reconnect to Mesos. Consequently, Mesos will unregister the Myriad framework and shutdown all the Myriad tasks and executors. If failover is set to true, all Myriad executors and tasks will remain running for a defined period of time, allowing the MyriadScheduler to reconnect to Mesos. |
private Map<Id<TransitRoute>,List<Id<Link>>> createRoutesNetworkLinksMap(TransitSchedule transitSchedule){
log.info("Start generating transitRouteNetworkLinksMap -- thread = " + threadName);
Map<Id<TransitRoute>,List<Id<Link>>> transitRouteNetworkLinksMap=new HashMap<Id<TransitRoute>,List<Id<Link>>>();
for ( TransitLine transitLine : transitSchedule.getTransitLines().values()) {
for ( TransitRoute transitRoute : transitLine.getRoutes().values()) {
List<Id<Link>> fullLinkIdList=new LinkedList<Id<Link>>();
fullLinkIdList.add(transitRoute.getRoute().getStartLinkId());
fullLinkIdList.addAll(transitRoute.getRoute().getLinkIds());
fullLinkIdList.add(transitRoute.getRoute().getEndLinkId());
transitRouteNetworkLinksMap.put(transitRoute.getId(),fullLinkIdList);
}
}
log.info("Finish generating transitRouteNetworkLinksMap -- thread = " + threadName);
return transitRouteNetworkLinksMap;
}
| Creates a map with all transit routes and a list holding the network links belonging to each route |
boolean merge(final ClassWriter cw,final Frame frame,final int edge){
boolean changed=false;
int i, s, dim, kind, t;
int nLocal=inputLocals.length;
int nStack=inputStack.length;
if (frame.inputLocals == null) {
frame.inputLocals=new int[nLocal];
changed=true;
}
for (i=0; i < nLocal; ++i) {
if (outputLocals != null && i < outputLocals.length) {
s=outputLocals[i];
if (s == 0) {
t=inputLocals[i];
}
else {
dim=s & DIM;
kind=s & KIND;
if (kind == BASE) {
t=s;
}
else {
if (kind == LOCAL) {
t=dim + inputLocals[s & VALUE];
}
else {
t=dim + inputStack[nStack - (s & VALUE)];
}
if ((s & TOP_IF_LONG_OR_DOUBLE) != 0 && (t == LONG || t == DOUBLE)) {
t=TOP;
}
}
}
}
else {
t=inputLocals[i];
}
if (initializations != null) {
t=init(cw,t);
}
changed|=merge(cw,t,frame.inputLocals,i);
}
if (edge > 0) {
for (i=0; i < nLocal; ++i) {
t=inputLocals[i];
changed|=merge(cw,t,frame.inputLocals,i);
}
if (frame.inputStack == null) {
frame.inputStack=new int[1];
changed=true;
}
changed|=merge(cw,edge,frame.inputStack,0);
return changed;
}
int nInputStack=inputStack.length + owner.inputStackTop;
if (frame.inputStack == null) {
frame.inputStack=new int[nInputStack + outputStackTop];
changed=true;
}
for (i=0; i < nInputStack; ++i) {
t=inputStack[i];
if (initializations != null) {
t=init(cw,t);
}
changed|=merge(cw,t,frame.inputStack,i);
}
for (i=0; i < outputStackTop; ++i) {
s=outputStack[i];
dim=s & DIM;
kind=s & KIND;
if (kind == BASE) {
t=s;
}
else {
if (kind == LOCAL) {
t=dim + inputLocals[s & VALUE];
}
else {
t=dim + inputStack[nStack - (s & VALUE)];
}
if ((s & TOP_IF_LONG_OR_DOUBLE) != 0 && (t == LONG || t == DOUBLE)) {
t=TOP;
}
}
if (initializations != null) {
t=init(cw,t);
}
changed|=merge(cw,t,frame.inputStack,nInputStack + i);
}
return changed;
}
| Merges the input frame of the given basic block with the input and output frames of this basic block. Returns <tt>true</tt> if the input frame of the given label has been changed by this operation. |
public static <K,V>ImmutableListMultimap<K,V> of(K k1,V v1,K k2,V v2,K k3,V v3,K k4,V v4,K k5,V v5){
ImmutableListMultimap.Builder<K,V> builder=ImmutableListMultimap.builder();
builder.put(k1,v1);
builder.put(k2,v2);
builder.put(k3,v3);
builder.put(k4,v4);
builder.put(k5,v5);
return builder.build();
}
| Returns an immutable multimap containing the given entries, in order. |
protected void trimStackFrames(List stacks){
for (int size=stacks.size(), i=size - 1; i > 0; i--) {
String[] curr=(String[])stacks.get(i);
String[] next=(String[])stacks.get(i - 1);
List currList=new ArrayList(Arrays.asList(curr));
List nextList=new ArrayList(Arrays.asList(next));
ExceptionUtils.removeCommonFrames(currList,nextList);
int trimmed=curr.length - currList.size();
if (trimmed > 0) {
currList.add("\t... " + trimmed + " more");
stacks.set(i,currList.toArray(new String[currList.size()]));
}
}
}
| Trims the stack frames. The first set is left untouched. The rest of the frames are truncated from the bottom by comparing with one just on top. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:31.644 -0500",hash_original_method="8ECE0FD94D831C743ACA34A8ACB9471A",hash_generated_method="E27A767163647451E623E9852DB7A221") public javax.sip.address.Address createAddress(String displayName,javax.sip.address.URI uri){
if (uri == null) throw new NullPointerException("null URI");
AddressImpl addressImpl=new AddressImpl();
if (displayName != null) addressImpl.setDisplayName(displayName);
addressImpl.setURI(uri);
return addressImpl;
}
| Creates an Address with the new display name and URI attribute values. |
@Override public final boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.menu_stoptracking:
stopTracking();
break;
default :
break;
}
return super.onOptionsItemSelected(item);
}
| Context menu, while in "tracking" mode |
public void printPC(DMLProgramCounter pc){
if (pc != null) System.out.println(" Current program counter at " + pc.toString());
else System.out.println("DML runtime is currently inactive.");
}
| Print current program counter |
public void clearSounds(){
mSoundMap.clear();
}
| Clears all of the previously set sounds and events. |
@Override protected void invalidated(){
getTableView().refresh();
if (!getValue()) expandedNodeCache.remove(getBean());
}
| When the expanded state change we refresh the tableview. If the expanded state changes to false we remove the cached expanded node. |
public Engine newEngine(String engineRoad,String engineNumber){
Engine engine=getByRoadAndNumber(engineRoad,engineNumber);
if (engine == null) {
engine=new Engine(engineRoad,engineNumber);
register(engine);
}
return engine;
}
| Finds an existing engine or creates a new engine if needed requires engine's road and number |
static MyDialogFragment newInstance(int num){
MyDialogFragment f=new MyDialogFragment();
Bundle args=new Bundle();
args.putInt("num",num);
f.setArguments(args);
return f;
}
| Create a new instance of MyDialogFragment, providing "num" as an argument. |
public synchronized void flush() throws IOException {
checkNotClosed();
trimToSize();
journalWriter.flush();
}
| Force buffered operations to the filesystem. |
public static void moveFile(String srcFilePath,String destFilePath) throws FileNotFoundException {
if (StringUtils.isEmpty(srcFilePath) || StringUtils.isEmpty(destFilePath)) {
throw new RuntimeException("Both srcFilePath and destFilePath cannot be null.");
}
moveFile(new File(srcFilePath),new File(destFilePath));
}
| Move file |
public void test_dataTypeLiterals(){
final Literal a=new LiteralImpl("bigdata",XMLSchema.INT);
assertEquals(a,roundTrip_tuned(a));
}
| Test round trip of some datatype literals. |
public static StringSet extractValuesFromStringSet(String key,StringSetMap volumeInformation){
try {
StringSet returnSet=new StringSet();
StringSet availableValueSet=volumeInformation.get(key);
if (null != availableValueSet) {
for ( String value : availableValueSet) {
returnSet.add(value);
}
}
return returnSet;
}
catch ( Exception e) {
_logger.error(e.getMessage(),e);
}
return null;
}
| Copied from PropertySetterUtil, which is in apisvc and can't be accessed from controllersvc. |
private void sendFeaturesRequest() throws IOException {
OFFeaturesRequest m=factory.buildFeaturesRequest().setXid(handshakeTransactionIds--).build();
write(m);
}
| Send a features request message to the switch using the handshake transactions ids. |
@Override public Query newFuzzyQuery(String text,int fuzziness){
if (settings.lowercaseExpandedTerms()) {
text=text.toLowerCase(settings.locale());
}
BooleanQuery.Builder bq=new BooleanQuery.Builder();
bq.setDisableCoord(true);
for ( Map.Entry<String,Float> entry : weights.entrySet()) {
try {
Query q=new FuzzyQuery(new Term(entry.getKey(),text),fuzziness);
q.setBoost(entry.getValue());
bq.add(q,BooleanClause.Occur.SHOULD);
}
catch ( RuntimeException e) {
rethrowUnlessLenient(e);
}
}
return super.simplify(bq.build());
}
| Dispatches to Lucene's SimpleQueryParser's newFuzzyQuery, optionally lowercasing the term first |
public TransformerConfigurationException(Throwable e){
super(e);
}
| Create a new <code>TransformerConfigurationException</code> with a given <code>Exception</code> base cause of the error. |
public boolean canTab(){
List constraints=dockPanel.getConstraints(getChildren());
return DockConstraint.canTab(constraints);
}
| Determine if this can tab |
public static GenericValue create(GenericPK primaryKey){
GenericValue newValue=new GenericValue();
newValue.init(primaryKey);
return newValue;
}
| Creates new GenericValue from existing GenericValue |
public static String readFirstLine(File file,Charset charset) throws IOException {
return asCharSource(file,charset).readFirstLine();
}
| Reads the first line from a file. The line does not include line-termination characters, but does include other leading and trailing whitespace. |
public HttpsURL(final String userinfo,final String host,final int port,final String path,final String query,final String fragment) throws URIException {
final StringBuffer buff=new StringBuffer();
if (userinfo != null || host != null || port != -1) {
_scheme=DEFAULT_SCHEME;
buff.append(_default_scheme);
buff.append("://");
if (userinfo != null) {
buff.append(userinfo);
buff.append('@');
}
if (host != null) {
buff.append(URIUtil.encode(host,URI.allowed_host));
if (port != -1 || port != DEFAULT_PORT) {
buff.append(':');
buff.append(port);
}
}
}
if (path != null) {
if (scheme != null && !path.startsWith("/")) {
throw new URIException(URIException.PARSING,"abs_path requested");
}
buff.append(URIUtil.encode(path,URI.allowed_abs_path));
}
if (query != null) {
buff.append('?');
buff.append(URIUtil.encode(query,URI.allowed_query));
}
if (fragment != null) {
buff.append('#');
buff.append(URIUtil.encode(fragment,URI.allowed_fragment));
}
parseUriReference(buff.toString(),true);
checkValid();
}
| Construct a HTTPS URL from given components. Note: The <code>userinfo</code> format is normally <code><username>:<password></code> where username and password must both be URL escaped. |
private void handleArgumentField(int begin,int end,int argIndex,FieldPosition position,List<FieldContainer> fields){
if (fields != null) {
fields.add(new FieldContainer(begin,end,Field.ARGUMENT,Integer.valueOf(argIndex)));
}
else {
if (position != null && position.getFieldAttribute() == Field.ARGUMENT && position.getEndIndex() == 0) {
position.setBeginIndex(begin);
position.setEndIndex(end);
}
}
}
| Adds a new FieldContainer with MessageFormat.Field.ARGUMENT field, argIndex, begin and end index to the fields list, or sets the position's begin and end index if it has MessageFormat.Field.ARGUMENT as its field attribute. |
@SuppressWarnings("unchecked") private void insertion(int low,int high){
if (high <= low) {
return;
}
for (int t=low; t < high; t++) {
for (int i=t + 1; i <= high; i++) {
if (ar[i].compareTo((E)ar[t]) < 0) {
Comparable<E> c=ar[t];
ar[t]=ar[i];
ar[i]=c;
}
}
}
}
| Private code to use InsertionSort on the range ar[low,high]. |
public void clearData(){
if (disposed) {
throw new IllegalStateException("disposed profiler");
}
for ( Counter counter : counters.values()) {
counter.clear();
}
}
| Resets all collected data to zero. |
@Override public String toString(){
return (getClass().getName() + "[" + getKeyValue()+ "]");
}
| return String representation |
public long readLongSkewedGolomb(final long b) throws IOException {
if (b < 0) throw new IllegalArgumentException("The modulus " + b + " is negative");
if (b == 0) return 0;
final long M=((1 << readUnary() + 1) - 1) * b;
final long m=(M / (2 * b)) * b;
return m + readLongMinimalBinary(M - m);
}
| Reads a long natural number in skewed Golomb coding. <P>This method implements also the case in which <code>b</code> is 0: in this case, nothing will be read, and 0 will be returned. |
@SkipValidation @Action(value="/modifyProperty-view") public String view(){
LOGGER.debug("Entered into view, BasicProperty: " + basicProp + ", ModelId: "+ getModelId());
if (getModelId() != null) {
propertyModel=(PropertyImpl)getPersistenceService().findByNamedQuery(QUERY_PROPERTYIMPL_BYID,Long.valueOf(getModelId()));
setModifyRsn(propertyModel.getPropertyDetail().getPropertyMutationMaster().getCode());
LOGGER.debug("view: PropertyModel by model id: " + propertyModel);
}
final String currWfState=propertyModel.getState().getValue();
populateFormData(Boolean.TRUE);
corrsAddress=PropertyTaxUtil.getOwnerAddress(propertyModel.getBasicProperty().getPropertyOwnerInfo());
amalgPropIds=new String[10];
if (propertyModel.getPropertyDetail().getFloorDetails().size() > 0) setFloorDetails(propertyModel);
if (!currWfState.endsWith(WF_STATE_COMMISSIONER_APPROVED)) {
int i=0;
for ( final PropertyStatusValues propstatval : basicProp.getPropertyStatusValuesSet()) {
if (propstatval.getIsActive().equals("W")) {
setPropStatValForView(propstatval);
LOGGER.debug("view: PropertyStatusValues for new modify screen: " + propstatval);
}
LOGGER.debug("view: Amalgamated property ids:");
if (PROP_CREATE_RSN.equals(propstatval.getPropertyStatus().getStatusCode()) && propstatval.getIsActive().equals("Y")) if (propstatval.getReferenceBasicProperty() != null) {
amalgPropIds[i]=propstatval.getReferenceBasicProperty().getUpicNo();
LOGGER.debug(amalgPropIds[i] + ", ");
i++;
}
}
}
if (currWfState.endsWith(WF_STATE_COMMISSIONER_APPROVED)) {
setIsApprPageReq(Boolean.FALSE);
if (basicProp.getUpicNo() != null && !basicProp.getUpicNo().isEmpty()) setIndexNumber(basicProp.getUpicNo());
int i=0;
for ( final PropertyStatusValues propstatval : basicProp.getPropertyStatusValuesSet()) {
if (propstatval.getIsActive().equals("Y")) {
setPropStatValForView(propstatval);
LOGGER.debug("PropertyStatusValues for view modify screen: " + propstatval);
}
LOGGER.debug("view: Amalgamated property ids:");
if (PROP_CREATE_RSN.equals(propstatval.getPropertyStatus().getStatusCode()) && propstatval.getIsActive().equals("Y")) if (propstatval.getReferenceBasicProperty() != null) {
amalgPropIds[i]=propstatval.getReferenceBasicProperty().getUpicNo();
LOGGER.debug(amalgPropIds[i] + ", ");
i++;
}
}
}
propertyAddr=basicProp.getAddress();
setModifyRsn(propertyModel.getPropertyDetail().getPropertyMutationMaster().getCode());
setDocNumber(propertyModel.getDocNumber());
LOGGER.debug("view: ModifyReason: " + getModifyRsn());
LOGGER.debug("Exiting from view");
return VIEW;
}
| Returns modify property view screen when modify property inbox item is opened |
public VCardParameter(String value){
this(value,false);
}
| Creates a new parameter. |
public static int dip2px(Context context,float dip){
float density=getDensity(context);
return (int)(dip * density + DensityUtils.DOT_FIVE);
}
| dip to px |
public void testCameraPairwiseScenario24() throws Exception {
genericPairwiseTestCase(Flash.AUTO,Exposure.NONE,WhiteBalance.FLUORESCENT,SceneMode.AUTO,PictureSize.SMALL,Geotagging.ON);
}
| Flash: Auto / Exposure: None / WB: Fluorescent Scene: Auto / Pic: Small / Geo: on |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.