code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static double convertLatOrLongToDouble(Rational[] coordinate,String reference){
try {
double degrees=coordinate[0].toDouble();
double minutes=coordinate[1].toDouble();
double seconds=coordinate[2].toDouble();
double result=degrees + minutes / 60.0 + seconds / 3600.0;
if ((reference.equals("S") || reference.equals("W"))) {
return -result;
}
return result;
}
catch ( ArrayIndexOutOfBoundsException e) {
throw new IllegalArgumentException();
}
}
| Gets the double representation of the GPS latitude or longitude coordinate. |
public byte[] asn1Encode() throws Asn1Exception, IOException {
DerOutputStream bytes=new DerOutputStream();
DerOutputStream temp=new DerOutputStream();
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,true,(byte)0x00),pATimeStamp.asn1Encode());
if (pAUSec != null) {
temp=new DerOutputStream();
temp.putInteger(BigInteger.valueOf(pAUSec.intValue()));
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,true,(byte)0x01),temp);
}
temp=new DerOutputStream();
temp.write(DerValue.tag_Sequence,bytes);
return temp.toByteArray();
}
| Encodes a PAEncTSEnc object. |
public void goToNextColor(){
mColorIndex=(mColorIndex + 1) % (mColors.length);
}
| Proceed to the next available ring color. This will automatically wrap back to the beginning of colors. |
public static Map<String,Object> createContentMethod(DispatchContext dctx,Map<String,? extends Object> rcontext){
Map<String,Object> context=UtilMisc.makeMapWritable(rcontext);
context.put("entityOperation","_CREATE");
List<String> targetOperationList=ContentWorker.prepTargetOperationList(context,"_CREATE");
if (Debug.infoOn()) Debug.logInfo("in createContentMethod, targetOperationList: " + targetOperationList,null);
List<String> contentPurposeList=ContentWorker.prepContentPurposeList(context);
context.put("targetOperationList",targetOperationList);
context.put("contentPurposeList",contentPurposeList);
Timestamp nowTimestamp=UtilDateTime.nowTimestamp();
Map<String,Object> result=FastMap.newInstance();
Delegator delegator=dctx.getDelegator();
LocalDispatcher dispatcher=dctx.getDispatcher();
String contentId=(String)context.get("contentId");
if (UtilValidate.isEmpty(contentId)) {
contentId=delegator.getNextSeqId("Content");
}
GenericValue content=delegator.makeValue("Content",UtilMisc.toMap("contentId",contentId));
content.setNonPKFields(context);
GenericValue userLogin=(GenericValue)context.get("userLogin");
String userLoginId=(String)userLogin.get("userLoginId");
if (UtilValidate.isEmpty(context.get("statusId"))) {
try {
GenericValue statusItem=EntityQuery.use(delegator).from("StatusItem").where("statusTypeId","CONTENT_STATUS").orderBy("sequenceId").queryFirst();
if (statusItem != null) {
content.put("statusId",statusItem.get("statusId"));
}
}
catch ( GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
}
}
content.put("createdByUserLogin",userLoginId);
content.put("lastModifiedByUserLogin",userLoginId);
content.put("createdDate",nowTimestamp);
content.put("lastModifiedDate",nowTimestamp);
context.put("currentContent",content);
if (Debug.infoOn()) Debug.logInfo("in createContentMethod, context: " + context,null);
Map<String,Object> permResults=ContentWorker.callContentPermissionCheckResult(delegator,dispatcher,context);
String permissionStatus=(String)permResults.get("permissionStatus");
if (permissionStatus != null && permissionStatus.equalsIgnoreCase("granted")) {
try {
content.create();
}
catch ( GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
}
catch ( Exception e2) {
return ServiceUtil.returnError(e2.getMessage());
}
result.put("contentId",contentId);
}
else {
String errorMsg=(String)permResults.get(ModelService.ERROR_MESSAGE);
result.put(ModelService.ERROR_MESSAGE,errorMsg);
return ServiceUtil.returnFailure(errorMsg);
}
context.remove("currentContent");
return result;
}
| Create a Content method. The work is done in this separate method so that complex services that need this functionality do not need to incur the reflection performance penalty. |
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
if (modelList == null) {
throw new NullPointerException();
}
if (knowledge == null) {
throw new NullPointerException();
}
}
| Adds semantic checks to the default deserialization method. This method must have the standard signature for a readObject method, and the body of the method must begin with "s.defaultReadObject();". Other than that, any semantic checks can be specified and do not need to stay the same from version to version. A readObject method of this form may be added to any class, even if Tetrad sessions were previously saved out using a version of the class that didn't include it. (That's what the "s.defaultReadObject();" is for. See J. Bloch, Effective Java, for help. |
public void paintBorder(Component c,Graphics g,int x,int y,int w,int h){
Graphics copy=g.create();
if (copy != null) {
try {
copy.translate(x,y);
paintLine(c,copy,w,h);
}
finally {
copy.dispose();
}
}
}
| Paint Border |
@Override public void unregisterListener(RadioListener mRadioListener){
log("Register unregistered.");
mService.unregisterListener(mRadioListener);
}
| Unregister listeners |
private double distance(Instance first,Instance second){
double diff, distance=0;
for (int i=0; i < m_instances.numAttributes(); i++) {
if (i == m_instances.classIndex()) {
continue;
}
double firstVal=m_globalMeansOrModes[i];
double secondVal=m_globalMeansOrModes[i];
switch (m_instances.attribute(i).type()) {
case Attribute.NUMERIC:
if (!first.isMissing(i)) {
firstVal=first.value(i);
}
if (!second.isMissing(i)) {
secondVal=second.value(i);
}
diff=norm(firstVal,i) - norm(secondVal,i);
break;
default :
diff=0;
break;
}
distance+=diff * diff;
}
return Math.sqrt(distance);
}
| Calculates the distance between two instances |
private static Method findGetTopologyMethod(Object topologySource,String methodName) throws NoSuchMethodException {
Class clazz=topologySource.getClass();
Method[] methods=clazz.getMethods();
ArrayList<Method> candidates=new ArrayList<Method>();
for ( Method method : methods) {
if (!method.getName().equals(methodName)) {
continue;
}
if (!method.getReturnType().equals(StormTopology.class)) {
continue;
}
Class[] paramTypes=method.getParameterTypes();
if (paramTypes.length != 1) {
continue;
}
if (paramTypes[0].isAssignableFrom(Map.class) || paramTypes[0].isAssignableFrom(Config.class)) {
candidates.add(method);
}
}
if (candidates.size() == 0) {
throw new IllegalArgumentException("Unable to find method '" + methodName + "' method in class: "+ clazz.getName());
}
else if (candidates.size() > 1) {
LOG.warn("Found multiple candidate methods in class '" + clazz.getName() + "'. Using the first one found");
}
return candidates.get(0);
}
| Given a `java.lang.Object` instance and a method name, attempt to find a method that matches the input parameter: `java.util.Map` or `backtype.storm.Config`. |
public boolean checkSlotAndSize(@Nonnull IInventory inv,@Nullable IMultiItemStacks expected,int src){
final ItemStack actual=inv.getStackInSlot(src);
if (expected == null) {
if (actual != null) return false;
}
else {
if (actual == null) return false;
if (!expected.containsItemStack(actual)) return false;
if (actual.stackSize < expected.getStackSize()) return false;
}
return true;
}
| Checks the given inventory and slot for an expected ItemStack |
public void write(String str,int off,int len) throws IOException {
internalOut.write(str,off,len);
}
| Writes a portion of a string. |
public static InputStream systemDotIn(){
return System.in;
}
| Get System.in. CliTools should be allowed to use System.in/out/err. This is private because we only want them to be used by cli tools. |
public void onMotion(MotionEvent event,Interaction iact){
}
| Notifies listener of a mouse motion event. A motion event is dispatched when no button is currently pressed, in an isolated "one shot" interaction, and always goes to the layer hit by the event coordinates. |
public void put(E e) throws InterruptedException {
checkNotNull(e);
final ReentrantLock lock=this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) notFull.await();
enqueue(e);
}
finally {
lock.unlock();
}
}
| Inserts the specified element at the tail of this queue, waiting for space to become available if the queue is full. |
public void draw(Shape s){
Stroke stroke=gc.getStroke();
if (stroke instanceof BasicStroke) {
Element svgShape=shapeConverter.toSVG(s);
if (svgShape != null) {
domGroupManager.addElement(svgShape,DOMGroupManager.DRAW);
}
}
else {
Shape strokedShape=stroke.createStrokedShape(s);
fill(strokedShape);
}
}
| Strokes the outline of a <code>Shape</code> using the settings of the current <code>Graphics2D</code> context. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, <code>Paint</code>, <code>Composite</code> and <code>Stroke</code> attributes. |
public void tank(double leftSpeed,double rightSpeed){
leftSpeed=speedLimiter.applyAsDouble(leftSpeed);
rightSpeed=speedLimiter.applyAsDouble(rightSpeed);
left.setSpeed(leftSpeed);
right.setSpeed(rightSpeed);
}
| Provide tank steering using the stored robot configuration. This function lets you directly provide joystick values from any source. |
@Override public InputHandler copy(){
return new DefaultInputHandler(this);
}
| Returns a copy of this input handler that shares the same key bindings. Setting key bindings in the copy will also set them in the original. |
public void schedBowlGames(){
for (int i=0; i < teamList.size(); ++i) {
teamList.get(i).updatePollScore();
}
Collections.sort(teamList,new TeamCompPoll());
semiG14=new Game(teamList.get(0),teamList.get(3),"Semis, 1v4");
teamList.get(0).gameSchedule.add(semiG14);
teamList.get(3).gameSchedule.add(semiG14);
semiG23=new Game(teamList.get(1),teamList.get(2),"Semis, 2v3");
teamList.get(1).gameSchedule.add(semiG23);
teamList.get(2).gameSchedule.add(semiG23);
bowlGames[0]=new Game(teamList.get(4),teamList.get(6),bowlNames[0]);
teamList.get(4).gameSchedule.add(bowlGames[0]);
teamList.get(6).gameSchedule.add(bowlGames[0]);
bowlGames[1]=new Game(teamList.get(5),teamList.get(7),bowlNames[1]);
teamList.get(5).gameSchedule.add(bowlGames[1]);
teamList.get(7).gameSchedule.add(bowlGames[1]);
bowlGames[2]=new Game(teamList.get(8),teamList.get(14),bowlNames[2]);
teamList.get(8).gameSchedule.add(bowlGames[2]);
teamList.get(14).gameSchedule.add(bowlGames[2]);
bowlGames[3]=new Game(teamList.get(9),teamList.get(15),bowlNames[3]);
teamList.get(9).gameSchedule.add(bowlGames[3]);
teamList.get(15).gameSchedule.add(bowlGames[3]);
bowlGames[4]=new Game(teamList.get(10),teamList.get(11),bowlNames[4]);
teamList.get(10).gameSchedule.add(bowlGames[4]);
teamList.get(11).gameSchedule.add(bowlGames[4]);
bowlGames[5]=new Game(teamList.get(12),teamList.get(13),bowlNames[5]);
teamList.get(12).gameSchedule.add(bowlGames[5]);
teamList.get(13).gameSchedule.add(bowlGames[5]);
bowlGames[6]=new Game(teamList.get(16),teamList.get(20),bowlNames[6]);
teamList.get(16).gameSchedule.add(bowlGames[6]);
teamList.get(20).gameSchedule.add(bowlGames[6]);
bowlGames[7]=new Game(teamList.get(17),teamList.get(21),bowlNames[7]);
teamList.get(17).gameSchedule.add(bowlGames[7]);
teamList.get(21).gameSchedule.add(bowlGames[7]);
bowlGames[8]=new Game(teamList.get(18),teamList.get(22),bowlNames[8]);
teamList.get(18).gameSchedule.add(bowlGames[8]);
teamList.get(22).gameSchedule.add(bowlGames[8]);
bowlGames[9]=new Game(teamList.get(19),teamList.get(23),bowlNames[9]);
teamList.get(19).gameSchedule.add(bowlGames[9]);
teamList.get(23).gameSchedule.add(bowlGames[9]);
hasScheduledBowls=true;
}
| Schedules bowl games based on team rankings. |
public Element(ElementType type,boolean defaultAttributes){
theType=type;
if (defaultAttributes) theAtts=new AttributesImpl(type.atts());
else theAtts=new AttributesImpl();
theNext=null;
preclosed=false;
}
| Return an Element from a specified ElementType. |
protected AbstractEvent retargetEvent(AbstractEvent e,NodeEventTarget target){
AbstractEvent clonedEvent=e.cloneEvent();
setTarget(clonedEvent,target);
return clonedEvent;
}
| Clones and retargets the given event. |
protected void sequence_TypeRef_TypeRefWithModifiers_UnionTypeExpressionOLD(ISerializationContext context,UnionTypeExpression semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: UnionTypeExpression.UnionTypeExpression_1_0 returns UnionTypeExpression IntersectionTypeExpression returns UnionTypeExpression IntersectionTypeExpression.IntersectionTypeExpression_1_0 returns UnionTypeExpression PrimaryTypeExpression returns UnionTypeExpression Constraint: ( typeRefs+=TypeRefWithoutModifiers typeRefs+=TypeRefWithoutModifiers* ((undefModifier=UndefModifierToken? nullModifier=NullModifierToken?) | undefModifier=UndefModifierToken)? ) |
private void updatePhysicalInterval(Register p,CompoundInterval c,BasicInterval stop){
CompoundInterval physInterval=regAllocState.getInterval(p);
if (physInterval == null) {
regAllocState.setInterval(p,c.copy(p,stop));
}
else {
if (VM.VerifyAssertions) VM._assert(!c.intersects(physInterval));
stop=new BasicInterval(stop.getBegin(),stop.getEnd());
physInterval.addNonIntersectingInterval(c,stop);
}
}
| Update the interval representing the allocations of a physical register p to include a new compound interval c. Include only those basic intervals in c up to and including basic interval stop. |
protected boolean isAssignable(AnnotatedTypeMirror varType,AnnotatedTypeMirror receiverType,Tree variable){
return true;
}
| Tests whether the variable accessed is an assignable variable or not, given the current scope TODO: document which parameters are nullable; e.g. receiverType is null in many cases, e.g. local variables. |
public void releaseStreamAllocation() throws IOException {
streamAllocation.release();
}
| Configure the socket connection to be either pooled or closed when it is either exhausted or closed. If it is unneeded when this is called, it will be released immediately. |
public void removeControllerListener(ControllerListener listener){
listeners.removeListener(listener);
}
| Removes the specified listener so it no longer receives controller events. |
static JsonObject wrap(JobRegistryService.EventType evType,Job job){
JsonObject value=new JsonObject();
value.addProperty("time",(Number)System.currentTimeMillis());
value.addProperty("event",evType.toString());
JsonObject obj=new JsonObject();
obj.addProperty("id",job.getId());
obj.addProperty("name",job.getName());
obj.addProperty("state",job.getCurrentState().toString());
obj.addProperty("nextState",job.getNextState().toString());
obj.addProperty("health",job.getHealth().toString());
obj.addProperty("lastError",job.getLastError());
value.add("job",obj);
return value;
}
| Creates a JsonObject wrapping a JobRegistryService event type and Job info. |
public void namespaceAfterStartElement(String prefix,String uri) throws SAXException {
if (m_elemContext.m_elementURI == null) {
String prefix1=getPrefixPart(m_elemContext.m_elementName);
if (prefix1 == null && EMPTYSTRING.equals(prefix)) {
m_elemContext.m_elementURI=uri;
}
}
startPrefixMapping(prefix,uri,false);
}
| This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). startPrefixMapping(prefix,uri) would be used before the startElement() call. |
public String toStringX(Properties ctx){
String in=Msg.getMsg(ctx,"Include");
String ex=Msg.getMsg(ctx,"Exclude");
StringBuffer sb=new StringBuffer();
sb.append(Msg.translate(ctx,"AD_Table_ID")).append("=").append(getTableName(ctx));
if (ACCESSTYPERULE_Accessing.equals(getAccessTypeRule())) sb.append(" - ").append(Msg.translate(ctx,"IsReadOnly")).append("=").append(isReadOnly());
else if (ACCESSTYPERULE_Exporting.equals(getAccessTypeRule())) sb.append(" - ").append(Msg.translate(ctx,"IsCanExport")).append("=").append(isCanExport());
else if (ACCESSTYPERULE_Reporting.equals(getAccessTypeRule())) sb.append(" - ").append(Msg.translate(ctx,"IsCanReport")).append("=").append(isCanReport());
sb.append(" - ").append(isExclude() ? ex : in);
return sb.toString();
}
| Extended String Representation |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
public DropDownTriangle(final UpDirection upState,final boolean down,final String upLabel,final String downLabel,final Window parent){
ddTriangle=new ClickableTriangle(upState,down);
upTriLabel=new JLabel(upLabel);
downTriLabel=new JLabel(downLabel);
this.parent=parent;
this.down=down;
this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
initLayout();
addMouseListener(this);
}
| Creates a drop down triangle with a label displayed when it is in the "up" state and a label displayed when it is in the "down" state. The triangle points either left or right in the "up" state and starts out either "up" or down. |
public static String clearLastViewedProducts(HttpServletRequest request,HttpServletResponse response){
HttpSession session=request.getSession();
if (session != null) {
session.setAttribute("lastViewedProducts",FastList.newInstance());
}
return "success";
}
| Event to clear the last vieweed products |
@Override public void stopCq(String cqName,ClientProxyMembershipID clientId) throws CqException {
String serverCqName=cqName;
if (clientId != null) {
serverCqName=this.constructServerCqName(cqName,clientId);
}
ServerCQImpl cQuery=null;
StringId errMsg=null;
Exception ex=null;
try {
HashMap<String,CqQueryImpl> cqMap=cqQueryMap;
if (!cqMap.containsKey(serverCqName)) {
return;
}
cQuery=(ServerCQImpl)getCq(serverCqName);
}
catch ( CacheLoaderException e1) {
errMsg=LocalizedStrings.CqService_CQ_NOT_FOUND_IN_THE_CQ_META_REGION_CQNAME_0;
ex=e1;
}
catch ( TimeoutException e2) {
errMsg=LocalizedStrings.CqService_TIMEOUT_WHILE_TRYING_TO_GET_CQ_FROM_META_REGION_CQNAME_0;
ex=e2;
}
finally {
if (ex != null) {
String s=errMsg.toLocalizedString(cqName);
if (logger.isDebugEnabled()) {
logger.debug(s);
}
throw new CqException(s,ex);
}
}
try {
if (!cQuery.isStopped()) {
cQuery.stop();
}
}
catch ( CqClosedException cce) {
throw new CqException(cce.getMessage());
}
finally {
this.removeFromMatchingCqMap(cQuery);
}
cQuery.getCqBaseRegion().getFilterProfile().stopCq(cQuery);
}
| Called directly on server side. |
private boolean isRunning(SystemMember member){
if (member instanceof ManagedEntity) {
return ((ManagedEntity)member).isRunning();
}
else {
return true;
}
}
| Returns whether or not the given member is running |
private static int NewLongArray(JNIEnvironment env,int length){
if (traceJNI) VM.sysWrite("JNI called: NewLongArray \n");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
long[] newArray=new long[length];
return env.pushJNIRef(newArray);
}
catch ( Throwable unexpected) {
if (traceJNI) unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0;
}
}
| NewLongArray: create a new long array |
private void fillPicks() throws Exception {
Properties ctx=Env.getCtx();
MLookup resourceL=MLookupFactory.get(ctx,m_WindowNo,0,MColumn.getColumn_ID(I_M_Product.Table_Name,"S_Resource_ID"),DisplayType.TableDir);
resource=new VLookup("S_Resource_ID",false,false,true,resourceL);
}
| Fill Picks Column_ID from C_Order |
@DSComment("Dalvik class method") @DSBan(DSCat.DALVIK) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:39.732 -0500",hash_original_method="51AB769B18373F25E42ACAB5FC64B8CC",hash_generated_method="2F173EE517FB3C5BC94167DFC70EE753") public Enumeration<String> entries(){
return new DFEnum(this);
}
| Enumerate the names of the classes in this DEX file. |
public TomcatServiceBuilder baseDir(Path baseDir){
baseDir=requireNonNull(baseDir,"baseDir").toAbsolutePath();
if (!Files.isDirectory(baseDir)) {
throw new IllegalArgumentException("baseDir: " + baseDir + " (expected: a directory)");
}
this.baseDir=baseDir;
return this;
}
| Sets the base directory of an embedded Tomcat. |
public void complete(ITextViewer viewer,int completionPosition,ICompilationUnit compilationUnit){
IDocument document=viewer.getDocument();
if (!(fContextType instanceof CompilationUnitContextType)) return;
Point selection=viewer.getSelectedRange();
Position position=new Position(completionPosition,selection.y);
String selectedText=null;
if (selection.y != 0) {
try {
selectedText=document.get(selection.x,selection.y);
document.addPosition(position);
fPositions.put(document,position);
}
catch ( BadLocationException e) {
}
}
CompilationUnitContext context=((CompilationUnitContextType)fContextType).createContext(document,position,compilationUnit);
context.setVariable("selection",selectedText);
int start=context.getStart();
int end=context.getEnd();
IRegion region=new Region(start,end - start);
Template[] templates=JavaPlugin.getDefault().getTemplateStore().getTemplates();
if (selection.y == 0) {
for (int i=0; i != templates.length; i++) {
Template template=templates[i];
if (context.canEvaluate(template)) {
fProposals.add(new TemplateProposal(template,context,region,getImage()));
}
}
}
else {
if (context.getKey().length() == 0) context.setForceEvaluation(true);
boolean multipleLinesSelected=areMultipleLinesSelected(viewer);
for (int i=0; i != templates.length; i++) {
Template template=templates[i];
if (context.canEvaluate(template) && (!multipleLinesSelected && template.getPattern().indexOf($_WORD_SELECTION) != -1 || (multipleLinesSelected && template.getPattern().indexOf($_LINE_SELECTION) != -1))) {
fProposals.add(new TemplateProposal(templates[i],context,region,getImage()));
}
}
}
}
| Inspects the context of the compilation unit around <code>completionPosition</code> and feeds the collector with proposals. |
private BluetoothSocket(int type,int fd,boolean auth,boolean encrypt,String address,int port) throws IOException {
this(type,fd,auth,encrypt,new BluetoothDevice(address),port,null);
}
| Construct a BluetoothSocket from address. Used by native code. |
public final double similarity(final boolean[] sig1,final boolean[] sig2){
double agg=0;
for (int i=0; i < sig1.length; i++) {
if (sig1[i] == sig2[i]) {
agg++;
}
}
agg=agg / sig1.length;
return Math.cos((1 - agg) * Math.PI);
}
| Compute the similarity between two signature, which is also an estimation of the cosine similarity between the two vectors. |
public UDAnimator cancel(){
AnimatorUtil.cancel(getAnimator());
if (mTarget != null) {
mTarget.cancelAnimation();
}
return this;
}
| cancel animator |
protected boolean engineVerify(byte[] signature) throws SignatureException {
return engineVerify(signature,0,signature.length);
}
| Verify all the data thus far updated. |
public boolean isLaunchedAsService(){
return launchedAsService;
}
| Checks if is launched as service. |
Vect extractComponent(BEGraphNode node){
BEGraphNode node1=(BEGraphNode)comStack.pop();
if (node == node1 && !node.transExists(node)) {
node.setNumber(MAX_FIRST);
return null;
}
Vect nodes=new Vect();
numFirstCom=secondNum++;
numSecondCom=thirdNum;
node1.setNumber(numFirstCom);
nodes.addElement(node1);
while (node != node1) {
node1=(BEGraphNode)comStack.pop();
node1.setNumber(numFirstCom);
nodes.addElement(node1);
}
return nodes;
}
| Returns the set of nodes in a nontrivial component. Returns null for a trivial one. It also assigns a new number to all the nodes in the component. |
public MultiGeneralAndersonDarlingTest(List<List<Double>> data,List<RealDistribution> distributions){
if (distributions == null) {
throw new NullPointerException();
}
this.distributions=distributions;
for ( List<Double> _data : data) {
Collections.sort(_data);
}
this.data=data;
runTest();
}
| Constructs an Anderson-Darling test for the given column of data. |
public CPaper(double x,double y,int units,boolean landscape,double left,double top,double right,double bottom){
super();
setMediaSize(x,y,units,landscape);
setImageableArea(left,top,getWidth() - left - right,getHeight() - top - bottom);
}
| Get Media Size |
public static int compareTimestamps(final int a,final int b){
long diff=diffTimestamps(a,b);
return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
}
| Compares two RTMP time stamps, accounting for time stamp wrapping. |
public static void main(String[] args){
try {
new Replier(args).run();
}
catch ( Exception ex) {
System.err.println("Exception: " + ex.getMessage());
ex.printStackTrace();
}
finally {
System.exit(0);
}
}
| Main executive. |
public ClassDefinitionBuilder methods(List<MethodDefinitionBuilder> mdbs){
for ( MethodDefinitionBuilder mdb : mdbs) {
method(mdb);
}
return this;
}
| Appends the methods built by the given builder (the methods are built without annotations if necessary). |
protected synchronized void rotate() throws IOException {
close();
final File file=m_fileStrategy.nextFile();
setFile(file,m_append);
openFile();
}
| Rotates the file. |
public ASN1Primitive toASN1Primitive(){
return seq;
}
| ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING, parameters [0] Parameters OPTIONAL, publicKey [1] BIT STRING OPTIONAL } |
public final void testValidateSucceeds(){
IRIValidator iriValidator=new IRIValidator("foo");
assertTrue(iriValidator.validate(""));
assertTrue(iriValidator.validate("http://www.foo.com"));
assertTrue(iriValidator.validate("http://www.foo123.com"));
assertTrue(iriValidator.validate("http://www.foo.com/bar/bar_2"));
assertTrue(iriValidator.validate("http://www.foo123.com/bar/bar_2"));
assertTrue(iriValidator.validate("http://foo.com"));
assertTrue(iriValidator.validate("http://foo123.com"));
assertTrue(iriValidator.validate("http://www.foo.com:8080"));
assertTrue(iriValidator.validate("http://www.foo123.com:8080"));
assertTrue(iriValidator.validate("http://www.foo.com.au"));
assertTrue(iriValidator.validate("http://www.foo123.com.au"));
assertTrue(iriValidator.validate("www.foo.com"));
assertTrue(iriValidator.validate("www.foo123.com"));
}
| Tests the functionality of the validate-method, if it succeeds. |
@Override public Label conditionalJump(int index,Condition condition){
Label label;
if (conditionalLabelPointer <= conditionalLabels.size()) {
label=new Label();
conditionalLabels.add(label);
conditionalLabelPointer=conditionalLabels.size();
}
else {
label=conditionalLabels.get(conditionalLabelPointer++);
}
conditionalJump(index,condition,label);
return label;
}
| This method caches the generated labels over two assembly passes to get information about branch lengths. |
public void addWhitelistURL(String URL){
serviceWhitelist.add(URL);
}
| Add URL to service whitelist |
@Override protected boolean isSplitable(JobContext context,Path filename){
RDFFormat rdfFormat=getRDFFormat(context);
if (RDFFormat.NTRIPLES.equals(rdfFormat) || RDFFormat.NQUADS.equals(rdfFormat)) {
return super.isSplitable(context,filename);
}
return false;
}
| Determine whether an input file can be split. If the input format is configured to be anything other than N-Triples or N-Quads, then the structure of the file is important and it cannot be split arbitrarily. Otherwise, default to the superclass logic to determine whether splitting is appropriate. |
@SuppressWarnings("unchecked") private Segment<K,V> ensureSegment(int k){
final Segment<K,V>[] ss=this.segments;
long u=(k << SSHIFT) + SBASE;
Segment<K,V> seg;
if ((seg=(Segment<K,V>)UNSAFE.getObjectVolatile(ss,u)) == null) {
Segment<K,V> proto=ss[0];
int cap=proto.table.length;
float lf=proto.loadFactor;
int threshold=(int)(cap * lf);
HashEntry<K,V>[] tab=(HashEntry<K,V>[])new HashEntry<?,?>[cap];
if ((seg=(Segment<K,V>)UNSAFE.getObjectVolatile(ss,u)) == null) {
Segment<K,V> s=new Segment<K,V>(lf,threshold,tab);
while ((seg=(Segment<K,V>)UNSAFE.getObjectVolatile(ss,u)) == null) {
if (UNSAFE.compareAndSwapObject(ss,u,null,seg=s)) break;
}
}
}
return seg;
}
| Returns the segment for the given index, creating it and recording in segment table (via CAS) if not already present. |
public void printSeries(){
for (int i=0; i < this.getItemCount(); i++) {
StochasticOscillatorItem dataItem=(StochasticOscillatorItem)this.getDataItem(i);
_log.debug("Type: " + this.getType() + " Time: "+ dataItem.getPeriod().getStart()+ " Value: "+ dataItem.getStochasticOscillator());
}
}
| Method printSeries. |
@SuppressWarnings("unchecked") private static void replacePlayerCape(AbstractClientPlayer player){
final String displayName=player.getDisplayNameString();
final NetworkPlayerInfo playerInfo;
try {
playerInfo=(NetworkPlayerInfo)GET_PLAYER_INFO.invokeExact(player);
}
catch ( Throwable throwable) {
Logger.fatal(throwable,"Failed to get NetworkPlayerInfo of %s",displayName);
return;
}
if (playerInfo == null) {
Logger.fatal("NetworkPlayerInfo of %s is null",displayName);
return;
}
final Map<MinecraftProfileTexture.Type,ResourceLocation> playerTextures;
try {
playerTextures=(Map<MinecraftProfileTexture.Type,ResourceLocation>)GET_PLAYER_TEXTURES.invokeExact(playerInfo);
}
catch ( Throwable throwable) {
Logger.fatal(throwable,"Failed to get player textures of %s",displayName);
return;
}
playerTextures.put(MinecraftProfileTexture.Type.CAPE,CAPE_LOCATION);
Logger.info("Replaced cape of %s!",displayName);
}
| Replace a player's cape with the TestMod3 cape. |
static int parseTenthsOfSecond(String text) throws ParseException {
int pos=text.indexOf(".");
int lastPos=text.lastIndexOf(".");
if (pos != lastPos) throw new ParseException(text,lastPos);
final int tenthsOfSecond;
if (pos == -1) {
int seconds=Integer.parseInt(text);
tenthsOfSecond=seconds * 10;
}
else {
String secondsStr=text.substring(0,pos);
String tenthsStr=text.substring(pos + 1);
int seconds=Integer.parseInt(secondsStr);
int tenths=tenthsStr.length() == 0 ? 0 : Integer.parseInt(tenthsStr);
tenthsOfSecond=seconds * 10 + tenths;
}
return tenthsOfSecond;
}
| Parses a value representing seconds and optional tenths of a second. For example, <code>32.8</code> is returned as <code>328</code> and <code>32</code> is returned as <code>320</code>. |
public void showTableItemControlDecoration(TableViewer tableViewer,Object data,String message){
if (null == tableViewer) {
return;
}
for ( TableItemControlDecoration decoration : tableItemControlDecorations) {
if (data == decoration.getData()) {
decoration.show();
decoration.setDescriptionText(message);
return;
}
}
for ( TableItem tableItem : tableViewer.getTable().getItems()) {
if (tableItem.getData() == data) {
TableItemControlDecoration decoration=new TableItemControlDecoration(tableItem);
decoration.show();
decoration.setDescriptionText(message);
tableItemControlDecorations.add(decoration);
return;
}
}
}
| Shows the error decoration data. |
public void removeUnusableGenerators(){
generatorCache.clear();
Set<GenericClass> removed=new LinkedHashSet<>();
for ( Map.Entry<GenericClass,Set<GenericAccessibleObject<?>>> entry : generators.entrySet()) {
if (entry.getValue().isEmpty()) {
recursiveRemoveGenerators(entry.getKey());
}
Set<GenericClass> toRemove=new LinkedHashSet<>();
for ( GenericAccessibleObject<?> gao : entry.getValue()) {
GenericClass owner=gao.getOwnerClass();
if (removed.contains(owner)) {
continue;
}
try {
cacheGenerators(owner);
}
catch ( ConstructionFailedException e) {
continue;
}
if (generatorCache.get(owner).isEmpty()) {
toRemove.add(owner);
}
}
for ( GenericClass tr : toRemove) {
recursiveRemoveGenerators(tr);
removed.add(tr);
}
}
removeOnlySelfGenerator();
removeDirectCycle();
generatorCache.clear();
}
| A generator for X might be a non-static method M of Y, but what if Y itself has no generator? In that case, M should not be a generator for X, as it is impossible to instantiate Y |
protected boolean isLeaderInShard(String shardId){
return gondola.getShard(shardId).getLocalMember().isLeader();
}
| Protected Methods. |
public EventType(String name,String description,EventAttribute attribute){
this(name,description,new EventAttribute[]{attribute});
}
| Create a new event type with a single attribute. |
public void testXformLoadFailed_ShowsError(){
mController.init();
mFakeGlobalEventBus.post(new FetchXformFailedEvent(FetchXformFailedEvent.Reason.UNKNOWN));
verify(mMockUi).showError(R.string.fetch_xform_failed_unknown_reason);
}
| Tests that an error message is displayed when the xform fails to load. |
public T summary(String value){
return attr("summary",value);
}
| Sets the <code>summary</code> attribute on the last started tag that has not been closed. |
public static double[] toDoubleArray(short[] array){
double[] result=new double[array.length];
for (int i=0; i < array.length; i++) {
result[i]=(double)array[i];
}
return result;
}
| Coverts given shorts array to array of doubles. |
protected void appendConfiguration(StringBuffer sb){
ConfigurationParameter[] params=this.getConfiguration();
for (int i=0; i < params.length; i++) {
ConfigurationParameter param=params[i];
if (!param.isModifiable()) {
continue;
}
String name=param.getName();
String value=param.getValueAsString();
if (value != null && !value.equals("")) {
if (name.equals(LOCATORS)) {
String locator=value;
int firstBracket=locator.indexOf('[');
int lastBracket=locator.indexOf(']');
if (firstBracket > -1 && lastBracket > -1) {
String host=locator.substring(0,firstBracket);
String port=locator.substring(firstBracket + 1,lastBracket);
locator=host + ":" + port;
}
sb.append(" ");
sb.append(name);
sb.append("=");
sb.append(locator);
}
else {
sb.append(" ");
sb.append(name);
sb.append("=");
sb.append(value);
}
}
}
}
| Appends configuration information to a <code>StringBuffer</code> that contains a command line. Handles certain configuration parameters specially. |
protected MetadataImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private static byte charToByte(char c){
return (byte)"0123456789ABCDEF".indexOf(c);
}
| Convert char to byte |
public void sortFromTo(int from,int to){
final int widthThreshold=10000;
if (size == 0) return;
checkRangeFromTo(from,to,size);
char min=elements[from];
char max=elements[from];
char[] theElements=elements;
for (int i=from + 1; i <= to; ) {
char elem=theElements[i++];
if (elem > max) max=elem;
else if (elem < min) min=elem;
}
double N=(double)to - (double)from + 1.0;
double quickSortEstimate=N * Math.log(N) / 0.6931471805599453;
double width=(double)max - (double)min + 1.0;
double countSortEstimate=Math.max(width,N);
if (width < widthThreshold && countSortEstimate < quickSortEstimate) {
countSortFromTo(from,to,min,max);
}
else {
quickSortFromTo(from,to);
}
}
| Sorts the specified range of the receiver into ascending order. The sorting algorithm is dynamically chosen according to the characteristics of the data set. Currently quicksort and countsort are considered. Countsort is not always applicable, but if applicable, it usually outperforms quicksort by a factor of 3-4. <p>Best case performance: O(N). <dt>Worst case performance: O(N^2) (a degenerated quicksort). <dt>Best case space requirements: 0 KB. <dt>Worst case space requirements: 40 KB. |
public void finaliseAddObservations(){
totalObservations=0;
for ( double[] currentObservation : vectorOfObservations) {
totalObservations+=currentObservation.length - k;
}
destPastVectors=new double[totalObservations][k];
destNextVectors=new double[totalObservations][1];
int startObservation=0;
for ( double[] currentObservation : vectorOfObservations) {
double[][] currentDestPastVectors=makeJointVectorForPast(currentObservation);
MatrixUtils.arrayCopy(currentDestPastVectors,0,0,destPastVectors,startObservation,0,currentDestPastVectors.length,k);
double[][] currentDestNextVectors=makeJointVectorForNext(currentObservation);
MatrixUtils.arrayCopy(currentDestNextVectors,0,0,destNextVectors,startObservation,0,currentDestNextVectors.length,1);
startObservation+=currentObservation.length - k;
}
try {
miKernel.setObservations(destPastVectors,destNextVectors);
}
catch ( Exception e) {
throw new RuntimeException(e);
}
addedMoreThanOneObservationSet=vectorOfObservations.size() > 1;
vectorOfObservations=null;
}
| Flag that the observations are complete, probability distribution functions can now be built. |
public static void checkGLError(String label){
int error;
while ((error=GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
Log.e(TAG,label + ": glError " + error);
throw new RuntimeException(label + ": glError " + error);
}
}
| Checks if we've had an error inside of OpenGL ES, and if so what that error is. |
private void isElementIndex(int index){
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException("Index [" + index + "] must be less than size ["+ size+ "]");
}
}
| Tells if the argument is the index of an existing element. |
protected void validateManagerSameInstance(Locale countryLocale,HolidayCalendar countryCalendar){
Locale defaultLocale=Locale.getDefault();
Locale.setDefault(countryLocale);
try {
HolidayManager defaultManager=HolidayManager.getInstance();
HolidayManager countryManager=HolidayManager.getInstance(countryCalendar);
Assert.assertEquals("Unexpected manager found",defaultManager,countryManager);
}
catch ( Exception e) {
Assert.fail("Unexpected error occurred: " + e.getClass().getName() + " - "+ e.getMessage());
}
finally {
Locale.setDefault(defaultLocale);
}
}
| Validate Country calendar and Default calendar is same if local default is set to country local |
public static void main(String[] args){
Application app;
String os=System.getProperty("os.name").toLowerCase();
if (os.startsWith("mac")) {
app=new OSXApplication();
}
else if (os.startsWith("win")) {
app=new SDIApplication();
}
else {
app=new SDIApplication();
}
DefaultApplicationModel model=new NetApplicationModel();
model.setName("JHotDraw Net");
model.setVersion(Main.class.getPackage().getImplementationVersion());
model.setCopyright("Copyright 2006-2010 (c) by the authors of JHotDraw and all its contributors.\n" + "This software is licensed under LGPL and Creative Commons 3.0 Attribution.");
model.setViewClassName("org.jhotdraw.samples.net.NetView");
app.setModel(model);
app.launch(args);
}
| Creates a new instance. |
public int asNode(XPathContext xctxt) throws javax.xml.transform.TransformerException {
return xctxt.getCurrentNode();
}
| Return the first node out of the nodeset, if this expression is a nodeset expression. This is the default implementation for nodesets. Derived classes should try and override this and return a value without having to do a clone operation. |
protected void attemptGridStrokeSelection(){
StrokeChooserPanel panel=new StrokeChooserPanel(this.gridStrokeSample,this.availableStrokeSamples);
int result=JOptionPane.showConfirmDialog(this,panel,localizationResources.getString("Stroke_Selection"),JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
this.gridStrokeSample.setStroke(panel.getSelectedStroke());
}
}
| Handle a grid stroke selection. |
private static Class<?> boxPrimatives(Class<?> type){
if (type == byte.class) {
return Byte.class;
}
else if (type == short.class) {
return Short.class;
}
else if (type == int.class) {
return Integer.class;
}
else if (type == long.class) {
return Long.class;
}
else if (type == float.class) {
return Float.class;
}
else if (type == double.class) {
return Double.class;
}
else if (type == char.class) {
return Character.class;
}
else if (type == boolean.class) {
return Boolean.class;
}
return type;
}
| Returns the box primitive type if the passed type is an (unboxed) primitive. Otherwise it returns the passed type |
public String buildImage(final BuildImageParams params,final ProgressMonitor progressMonitor) throws IOException {
if (params.getRemote() != null) {
DockerConnection dockerConnection=connectionFactory.openConnection(dockerDaemonUri).query("remote",params.getRemote());
return buildImage(dockerConnection,params,progressMonitor);
}
final File tar=Files.createTempFile(null,".tar").toFile();
try {
File[] files=new File[params.getFiles().size()];
files=params.getFiles().toArray(files);
createTarArchive(tar,files);
try (InputStream tarInput=new FileInputStream(tar)){
DockerConnection dockerConnection=connectionFactory.openConnection(dockerDaemonUri).header("Content-Type","application/x-compressed-tar").header("Content-Length",tar.length()).entity(tarInput);
return buildImage(dockerConnection,params,progressMonitor);
}
}
finally {
FileCleaner.addFile(tar);
}
}
| Builds new image. |
public void newProcessingInstruction(String target,Reader reader){
}
| This method is called when a processing instruction is encountered. PIs with target "xml" are handled by the parser. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:02.476 -0500",hash_original_method="43F228216BAE54D0FCDF4DEA936A6994",hash_generated_method="2D27E6B01FD5503A17C0CE28F2EA1FAE") static public boolean isSyncEnabled(Context context){
Cursor cursor=null;
try {
cursor=context.getContentResolver().query(CONTENT_URI,new String[]{VALUE},KEY + "=?",new String[]{KEY_SYNC_ENABLED},null);
if (cursor == null || !cursor.moveToFirst()) {
return false;
}
return cursor.getInt(0) != 0;
}
finally {
if (cursor != null) cursor.close();
}
}
| Returns true if bookmark sync is enabled |
public void start(){
thd=new Thread(this,"ConnectorHandler: initializing");
thd.start();
}
| Start the thread to serve thl changes to requesting slaves. |
@SuppressWarnings({"StringContatenationInLoop"}) protected static String[] determineStreamNames(StreamSpecCompiled[] streams){
String[] streamNames=new String[streams.length];
for (int i=0; i < streams.length; i++) {
streamNames[i]=streams[i].getOptionalStreamName();
if (streamNames[i] == null) {
streamNames[i]="stream_" + i;
}
}
return streamNames;
}
| Returns a stream name assigned for each stream, generated if none was supplied. |
public void testApp(){
assertTrue(true);
}
| Rigourous Test :-) |
public void add(Input key){
synchronized (this.keys) {
this.keys.put(key.getEvent(),key);
}
}
| Adds the given key. |
private static TextContainer parseTextContainer(TextContainer textContainer){
textContainer.setCurrentScale(1.0f).setCurrentColor(0x808080);
textContainer.registerTag(new FormatTags.TagNewLine());
textContainer.registerTag(new FormatTags.TagScale(1.0F));
textContainer.registerTag(new FormatTags.TagColor(0x808080));
textContainer.registerTag(new FormatTags.TagTooltip("N/A"));
textContainer.registerTag(new FormatTags.TagSimple("bold",ChatFormatting.BOLD));
textContainer.registerTag(new FormatTags.TagSimple("obfuscated",ChatFormatting.OBFUSCATED));
textContainer.registerTag(new FormatTags.TagSimple("italic",ChatFormatting.ITALIC));
textContainer.registerTag(new FormatTags.TagSimple("strikethrough",ChatFormatting.STRIKETHROUGH));
textContainer.registerTag(new FormatTags.TagSimple("underline",ChatFormatting.UNDERLINE));
textContainer.registerTag(new FormatTags.TagPagelink());
textContainer.registerTag(new FormatTags.TagRainbow());
try {
textContainer.parse();
}
catch ( Exception e) {
e.printStackTrace();
}
return textContainer;
}
| Parses the text container. Used to get the right width and height of the container |
public PKCS10Attribute(ObjectIdentifier attributeId,Object attributeValue){
this.attributeId=attributeId;
this.attributeValue=attributeValue;
}
| Constructs an attribute from individual components of ObjectIdentifier and the value (any java object). |
protected void figureOutChartSeriesForEntries(BinaryFile binFile) throws IOException, FormatException {
RpfTocEntry[] entriesAlreadyChecked=new RpfTocEntry[entries.length];
System.arraycopy(entries,0,entriesAlreadyChecked,0,entries.length);
for (int i=0; i < numFrameIndexRecords; i++) {
if (DEBUG_RPFTOCFRAMEDETAIL) {
Debug.output("RpfTocHandler: parseToc(): Read frame file index rec #: " + i);
}
binFile.seek(locations[3].componentLocation + indexRecordLength * i);
int boundaryId=(int)binFile.readShort();
if (DEBUG_RPFTOCFRAMEDETAIL) {
Debug.output("boundary id for frame: " + i + " is "+ boundaryId);
}
if (boundaryId > numBoundaries - 1) {
throw new FormatException("Bad boundary id in FF index record " + i);
}
RpfTocEntry entry=entriesAlreadyChecked[boundaryId];
if (entry == null) {
continue;
}
else {
entriesAlreadyChecked[boundaryId]=null;
}
binFile.readShort();
binFile.readShort();
binFile.readInteger();
String filename=binFile.readFixedLengthString(12);
int dot=filename.lastIndexOf('.');
entry.setInfo(filename.substring(dot + 1,dot + 3).intern());
}
}
| Method that looks at one frame file for each RpfTocEntry, in order to check the suffix and load the chart series information into the RpfTocEntry. This is needed for when the RpfTocHandler is asked for matching RpfTocEntries for a given scale and location when the chart type has been limited to a certain chart code. |
public int editOperationsBaseline(){
return editOperationsBaseline;
}
| Get the baseline editing Operations ( = total Objects) |
public void rebalanceNestedOperations(){
nestedOperations=preparedOperations;
}
| Used to make things stable again after an operation has failed between a workspace.prepareOperation() and workspace.beginOperation(). This method can only be safely called from inside a workspace operation. Should NOT be called from outside a prepareOperation/endOperation block. |
public boolean isInfoEnabled(){
return true;
}
| Enabled, return true |
public boolean isWorkflow(){
return getAD_Workflow_ID() > 0;
}
| Is it a Workflow |
public long node(){
if (version() != 1) {
throw new UnsupportedOperationException("Not a time-based UUID");
}
return leastSigBits & 0x0000FFFFFFFFFFFFL;
}
| The node value associated with this UUID. <p> The 48 bit node value is constructed from the node field of this UUID. This field is intended to hold the IEEE 802 address of the machine that generated this UUID to guarantee spatial uniqueness. <p> The node value is only meaningful in a time-based UUID, which has version type 1. If this UUID is not a time-based UUID then this method throws UnsupportedOperationException. |
protected void afterAttachActions() throws SQLException {
getDatabaseInfo(getDescribeDatabaseInfoBlock(),1024,getDatabaseInformationProcessor());
}
| Additional tasks to execute directly after attach operation. <p> Implementation retrieves database information like dialect ODS and server version. </p> |
public void incThreadIdentifiers(){
this._stats.incInt(_threadIdentifiersId,1);
}
| Increments the "threadIdentifiers" stat by 1. |
public WebResource createWebResource(String serviceURL){
Client client=Client.create();
WebResource webResource=client.resource(serviceURL);
return webResource;
}
| Create a web resource for the given URL |
public boolean hasAgent(){
return super.hasElement(Agent.KEY);
}
| Returns whether it has the Used in work addresses. Also for 'in care of' or 'c/o'. |
public void abort(){
if (_inputStream != null) {
try {
_inputStream.close();
}
catch ( Throwable e) {
}
}
if (_errorStream != null) {
try {
_errorStream.close();
}
catch ( Throwable e) {
}
}
if (_process != null) {
try {
_process.destroy();
}
catch ( Throwable e) {
log.log(Level.FINE,e.toString(),e);
}
}
}
| Aborts the compilation. |
public static String toString(double M_[][]){
return toString(M_,2);
}
| ToString - return a String representation. |
public static BigDecimal allocated(int p_C_Payment_ID,int p_C_Currency_ID) throws SQLException {
BigDecimal PayAmt=null;
int C_Charge_ID=0;
String sql="SELECT PayAmt, C_Charge_ID " + "FROM C_Payment_v " + "WHERE C_Payment_ID=?";
PreparedStatement pstmt=Adempiere.prepareStatement(sql);
pstmt.setInt(1,p_C_Payment_ID);
ResultSet rs=pstmt.executeQuery();
if (rs.next()) {
PayAmt=rs.getBigDecimal(1);
C_Charge_ID=rs.getInt(2);
}
rs.close();
pstmt.close();
if (C_Charge_ID > 0) return PayAmt;
int C_ConversionType_ID=0;
BigDecimal allocatedAmt=getAllocatedAmt(p_C_Payment_ID,p_C_Currency_ID,C_ConversionType_ID);
return Currency.round(allocatedAmt,p_C_Currency_ID,null);
}
| Get allocated Payment amount. - paymentAllocated |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.