code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public boolean removePassiveScanner(PassiveScanner passiveScanner){
if (passiveScanner == null) {
throw new IllegalArgumentException("Parameter passiveScanner must not be null.");
}
return removePassiveScanner(passiveScanner.getClass().getName());
}
| Removes the given passive scanner from the list of passive scanners that are used to scan proxied messages. <p> The passive scanners are removed using their class name. </p> |
public ClassNotFoundException(String s){
super(s,null);
}
| Constructs a <code>ClassNotFoundException</code> with the specified detail message. |
@SuppressWarnings("serial") public void testStatementPatternNode(){
final StatementPatternNode spn1=store.isQuads() ? (StatementPatternNode)new Helper(){
{
tmp=statementPatternNode(varNode(x),varNode(y),varNode(z),varNode(w));
}
}
.getTmp() : (StatementPatternNode)new Helper(){
{
tmp=statementPatternNode(varNode(x),varNode(y),varNode(z));
}
}
.getTmp();
final StatementPatternNode spn2=(StatementPatternNode)new Helper(){
{
tmp=statementPatternNode(constantNode(a),constantNode(b),constantNode(c));
}
}
.getTmp();
final StatementPatternNode spn3=(StatementPatternNode)new Helper(){
{
tmp=statementPatternNode(varNode(x),constantNode(b),varNode(z));
}
}
.getTmp();
final Set<IVariable<?>> requiredBoundSpn123=new HashSet<IVariable<?>>();
final Set<IVariable<?>> desiredBoundSpn1=store.isQuads() ? new HashSet<IVariable<?>>(){
{
add(Var.var("x"));
add(Var.var("y"));
add(Var.var("z"));
add(Var.var("w"));
}
}
: new HashSet<IVariable<?>>(){
{
add(Var.var("x"));
add(Var.var("y"));
add(Var.var("z"));
}
}
;
final Set<IVariable<?>> desiredBoundSpn2=new HashSet<IVariable<?>>();
final Set<IVariable<?>> desiredBoundSpn3=new HashSet<IVariable<?>>(){
{
add(Var.var("x"));
add(Var.var("z"));
}
}
;
final StaticAnalysis sa=new StaticAnalysis(new QueryRoot(QueryType.SELECT),null);
assertEquals(requiredBoundSpn123,spn1.getRequiredBound(sa));
assertEquals(desiredBoundSpn1,spn1.getDesiredBound(sa));
assertEquals(requiredBoundSpn123,spn2.getRequiredBound(sa));
assertEquals(desiredBoundSpn2,spn2.getDesiredBound(sa));
assertEquals(requiredBoundSpn123,spn3.getRequiredBound(sa));
assertEquals(desiredBoundSpn3,spn3.getDesiredBound(sa));
}
| Test interface implementation for statement patterns nodes. |
private long convertUTMToMGRS(long Zone,double Latitude,double Easting,double Northing,long Precision){
double grid_easting;
double grid_northing;
long[] letters=new long[MGRS_LETTERS];
double divisor;
long error_code;
divisor=Math.pow(10.0,(5 - Precision));
Easting=roundMGRS(Easting / divisor) * divisor;
Northing=roundMGRS(Northing / divisor) * divisor;
getGridValues(Zone);
error_code=getLatitudeLetter(Latitude);
letters[0]=getLastLetter();
if (error_code == MGRS_NO_ERROR) {
grid_northing=Northing;
if (grid_northing == 1.e7) grid_northing=grid_northing - 1.0;
while (grid_northing >= TWOMIL) {
grid_northing=grid_northing - TWOMIL;
}
grid_northing=grid_northing + false_northing;
if (grid_northing >= TWOMIL) grid_northing=grid_northing - TWOMIL;
letters[2]=(long)(grid_northing / ONEHT);
if (letters[2] > LETTER_H) letters[2]=letters[2] + 1;
if (letters[2] > LETTER_N) letters[2]=letters[2] + 1;
grid_easting=Easting;
if (((letters[0] == LETTER_V) && (Zone == 31)) && (grid_easting == 500000.0)) grid_easting=grid_easting - 1.0;
letters[1]=ltr2_low_value + ((long)(grid_easting / ONEHT) - 1);
if ((ltr2_low_value == LETTER_J) && (letters[1] > LETTER_N)) letters[1]=letters[1] + 1;
makeMGRSString(Zone,letters,Easting,Northing,Precision);
}
return error_code;
}
| The function UTM_To_MGRS calculates an MGRS coordinate string based on the zone, latitude, easting and northing. |
@Override public void addAttribute(String name,String value){
if (name.equals("class")) {
this.type=getOwner().findClass(value);
}
else {
super.addAttribute(name,value);
}
}
| Parses attributes of the element. The following attributes are supported: <dl> <dt>class <dd>the type of object for instantiation <dt>id <dd>the identifier of the variable that is intended to store the result </dl> |
private boolean hasNextInetSocketAddress(){
return socketAddresses != null;
}
| Returns true if there's another socket address to try. |
private void basicSuccessTest(String connectionEncoding,String columnName,String testInput,String expectedOutput) throws Exception {
Connection connection=getConnection(connectionEncoding);
try {
insertString(connection,columnName,testInput,DEFAULT_ID);
assertEquals(expectedOutput,selectString(connection,columnName,DEFAULT_ID));
}
finally {
connection.close();
}
}
| Test the basic success scenario. |
public SpinnerNumberModel(int value,int minimum,int maximum,int stepSize){
this(Integer.valueOf(value),Integer.valueOf(minimum),Integer.valueOf(maximum),Integer.valueOf(stepSize));
}
| Constructs a <code>SpinnerNumberModel</code> with the specified <code>value</code>, <code>minimum</code>/<code>maximum</code> bounds, and <code>stepSize</code>. |
public boolean specifiesRPProtection(){
return (recoverPoint != null && ((recoverPoint.getAdd() != null && !recoverPoint.getAdd().isEmpty()) || (recoverPoint.getRemove() != null && !recoverPoint.getRemove().isEmpty())));
}
| Convenience method that determines if RP protection has been specified. |
public InterfaceMethodRefConstant addInterfaceRef(String className,String name,String type){
InterfaceMethodRefConstant entry=getInterfaceRef(className,name,type);
if (entry != null) return entry;
ClassConstant classEntry=addClass(className);
NameAndTypeConstant typeEntry=addNameAndType(name,type);
entry=new InterfaceMethodRefConstant(this,_entries.size(),classEntry.getIndex(),typeEntry.getIndex());
addConstant(entry);
return entry;
}
| Adds an interface ref constant. |
public HeaderCard findCard(String key){
HeaderCard card=this.cards.get(key);
if (card != null) {
this.iter.setKey(key);
}
return card;
}
| Find the card associated with a given key. If found this sets the mark to the card, otherwise it unsets the mark. |
public void start() throws IOException, StunException {
sock=new IceUdpSocketWrapper(new SafeCloseDatagramSocket(localAddress));
stunStack.addSocket(sock);
requestSender=new BlockingRequestSender(stunStack,localAddress);
started=true;
}
| Puts the discoverer into an operational state. |
boolean isAlive(){
return alive;
}
| Returns a boolean value indicating whether we have received a STUN response or not. Note that this should NOT be taken as an indication that the negotiation has succeeded, it merely indicates that we have received ANY STUN response, possibly a BINDING_ERROR_RESPONSE. It is completely unrelated/independent from the ICE spec and it's only meant to be used for debugging purposes. |
boolean isCounterpart(int attribute,HTMLFont font){
switch (attribute) {
case BOLD:
return isBoldCounterpart(font);
case ITALIC:
return isItalicCounterpart(font);
case BIG:
return isBigCounterpart(font);
case SMALL:
return isSmallCounterpart(font);
default :
return false;
}
}
| Checks if the given font is the counterpart of the current form in the sense of the given attribute |
public void warn(ServerCommit commit){
LOGGER.warn("Server commit " + commit + " was garbage collected!\nCommit log is dirty!");
}
| Issues a warning that the given commit was garbage collected. |
protected void reduceParseTree(CompilationUnitDeclaration unit){
TypeDeclaration[] types=unit.types;
for (int i=0, l=types.length; i < l; i++) purgeMethodStatements(types[i],true);
}
| Called prior to the unit being resolved. Reduce the parse tree where possible. |
public static void closeStatement(Statement statement){
if (null != statement) {
try {
statement.close();
}
catch ( SQLException ignore) {
}
}
}
| Cleanup helper method that closes the given <code>Statement</code> while ignoring any errors. |
public int addPadding(byte[] in,int inOff){
byte code=(byte)(in.length - inOff);
while (inOff < in.length - 1) {
if (random == null) {
in[inOff]=0;
}
else {
in[inOff]=(byte)random.nextInt();
}
inOff++;
}
in[inOff]=code;
return code;
}
| add the pad bytes to the passed in block, returning the number of bytes added. |
private void onReady(MediaInfo mediaInfo,boolean shouldStartPlayback,int startPoint,JSONObject customData){
mSelectedMedia=mediaInfo;
updateClosedCaptionState();
try {
mCastController.setStreamType(mSelectedMedia.getStreamType());
if (shouldStartPlayback) {
mPlaybackState=MediaStatus.PLAYER_STATE_BUFFERING;
mCastController.setPlaybackStatus(mPlaybackState);
mCastManager.loadMedia(mSelectedMedia,true,startPoint,customData);
}
else {
if (mCastManager.isRemoteMediaPlaying()) {
mPlaybackState=MediaStatus.PLAYER_STATE_PLAYING;
}
else {
mPlaybackState=MediaStatus.PLAYER_STATE_PAUSED;
}
mCastController.setPlaybackStatus(mPlaybackState);
}
}
catch ( Exception e) {
LOGE(TAG,"Failed to get playback and media information",e);
mCastController.closeActivity();
}
MediaQueue mediaQueue=mCastManager.getMediaQueue();
int size=0;
int position=0;
if (mediaQueue != null) {
size=mediaQueue.getCount();
position=mediaQueue.getCurrentItemPosition();
}
mCastController.onQueueItemsUpdated(size,position);
updateMetadata();
restartTrickplayTimer();
}
| Loads the media on the cast device. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:35.898 -0500",hash_original_method="B6C33F6C9AFBFD4465A32F9300C74AFB",hash_generated_method="5E9890F60800B6FE556CD91BC5206B40") public void writeToXml(XmlSerializer serializer) throws IOException {
int N=countActions();
for (int i=0; i < N; i++) {
serializer.startTag(null,ACTION_STR);
serializer.attribute(null,NAME_STR,mActions);
serializer.endTag(null,ACTION_STR);
}
N=countCategories();
for (int i=0; i < N; i++) {
serializer.startTag(null,CAT_STR);
serializer.attribute(null,NAME_STR,mCategories.get(i));
serializer.endTag(null,CAT_STR);
}
N=countDataTypes();
for (int i=0; i < N; i++) {
serializer.startTag(null,TYPE_STR);
String type=mDataTypes.get(i);
if (type.indexOf('/') < 0) type=type + "/*";
serializer.attribute(null,NAME_STR,type);
serializer.endTag(null,TYPE_STR);
}
N=countDataSchemes();
for (int i=0; i < N; i++) {
serializer.startTag(null,SCHEME_STR);
serializer.attribute(null,NAME_STR,mDataSchemes.get(i));
serializer.endTag(null,SCHEME_STR);
}
N=countDataAuthorities();
for (int i=0; i < N; i++) {
serializer.startTag(null,AUTH_STR);
AuthorityEntry ae=mDataAuthorities.get(i);
serializer.attribute(null,HOST_STR,ae.getHost());
if (ae.getPort() >= 0) {
serializer.attribute(null,PORT_STR,Integer.toString(ae.getPort()));
}
serializer.endTag(null,AUTH_STR);
}
N=countDataPaths();
for (int i=0; i < N; i++) {
serializer.startTag(null,PATH_STR);
PatternMatcher pe=mDataPaths.get(i);
switch (pe.getType()) {
case PatternMatcher.PATTERN_LITERAL:
serializer.attribute(null,LITERAL_STR,pe.getPath());
break;
case PatternMatcher.PATTERN_PREFIX:
serializer.attribute(null,PREFIX_STR,pe.getPath());
break;
case PatternMatcher.PATTERN_SIMPLE_GLOB:
serializer.attribute(null,SGLOB_STR,pe.getPath());
break;
}
serializer.endTag(null,PATH_STR);
}
}
| Write the contents of the IntentFilter as an XML stream. |
private JCheckBox addCheckbox(String text,Container container){
JCheckBox checkbox=new JCheckBox(text);
checkbox.setAlignmentX(Component.LEFT_ALIGNMENT);
checkbox.setBorder(BorderFactory.createEmptyBorder(0,0,10,5));
container.add(checkbox);
return checkbox;
}
| Adds a preconfigured JCheckbox to the specified container, setting its alignment constraint to left and adding an empty padding border. |
private void run() throws Exception {
DevelopmentProvider tp=new DevelopmentProvider();
Topology t=tp.newTopology("kafkaSamplePublisher");
Map<String,Object> kafkaConfig=createKafkaConfig();
KafkaProducer kafka=new KafkaProducer(t,null);
AtomicInteger cnt=new AtomicInteger();
TStream<String> msgs=t.poll(null,1L,TimeUnit.SECONDS);
kafka.publish(msgs,topic);
System.out.println("Console URL for the job: " + tp.getServices().getService(HttpServer.class).getConsoleUrl());
tp.submit(t);
}
| Create a topology for the publisher application and run it. |
public boolean isAutoWidth(){
return this.intervalDelegate.isAutoWidth();
}
| Returns whether the interval width is automatically calculated or not. |
private CellSignalStrengthGsm(Parcel in){
mSignalStrength=in.readInt();
mBitErrorRate=in.readInt();
if (DBG) log("CellSignalStrengthGsm(Parcel): " + toString());
}
| Construct a SignalStrength object from the given parcel where the token is already been processed. |
private void buildAccentChar(float x,float y,char b,char a,Path gp){
Path pathA=getOutline(a,getWidth(a,null));
Matrix xformA=new Matrix();
xformA.setTranslate(x,y);
Matrix tmp=new Matrix(at);
if (at.invert(tmp)) {
xformA.preConcat(tmp);
}
else {
}
pathA.transform(xformA);
Path pathB=getOutline(b,getWidth(b,null));
Matrix xformB=new Matrix();
if (at.invert(xformB)) {
pathB.transform(xformB);
}
else {
}
gp.addPath(pathB);
gp.addPath(pathA);
}
| build an accented character out of two pre-defined glyphs. |
public InputVenueMessageContent.InputVenueMessageContentBuilder latitude(double latitude){
this.latitude=latitude;
return this;
}
| *Required Sets the latitude to the provided value |
public DatabaseInfo(String databaseName,Map<String,TableInfo> tableInfoMap){
this.databaseName=databaseName;
this.tableInfoMap=tableInfoMap;
}
| Database Schema object creation. |
private void explotion(){
final MPPProductBOM PP_Product_BOM=MPPProductBOM.get(getCtx(),getPP_Product_BOM_ID());
if (getM_Product_ID() != PP_Product_BOM.getM_Product_ID()) {
throw new AdempiereException("@NotMatch@ @PP_Product_BOM_ID@ , @M_Product_ID@");
}
final MProduct product=MProduct.get(getCtx(),PP_Product_BOM.getM_Product_ID());
if (!product.isVerified()) {
throw new AdempiereException("Product BOM Configuration not verified. Please verify the product first - " + product.getValue());
}
if (PP_Product_BOM.isValidFromTo(getDateStartSchedule())) {
MPPOrderBOM PP_Order_BOM=new MPPOrderBOM(PP_Product_BOM,getPP_Order_ID(),get_TrxName());
PP_Order_BOM.setAD_Org_ID(getAD_Org_ID());
PP_Order_BOM.saveEx();
for ( MPPProductBOMLine PP_Product_BOMline : PP_Product_BOM.getLines(true)) {
if (PP_Product_BOMline.isValidFromTo(getDateStartSchedule())) {
MPPOrderBOMLine PP_Order_BOMLine=new MPPOrderBOMLine(PP_Product_BOMline,getPP_Order_ID(),PP_Order_BOM.get_ID(),getM_Warehouse_ID(),get_TrxName());
PP_Order_BOMLine.setAD_Org_ID(getAD_Org_ID());
PP_Order_BOMLine.setM_Warehouse_ID(getM_Warehouse_ID());
PP_Order_BOMLine.setM_Locator_ID(getM_Locator_ID());
PP_Order_BOMLine.setQtyOrdered(getQtyOrdered());
PP_Order_BOMLine.saveEx();
}
else {
log.fine("BOM Line skiped - " + PP_Product_BOMline);
}
}
}
else {
throw new BOMExpiredException(PP_Product_BOM,getDateStartSchedule());
}
final MWorkflow AD_Workflow=MWorkflow.get(getCtx(),getAD_Workflow_ID());
if (!AD_Workflow.isValid()) {
throw new AdempiereException("Routing is not valid. Please validate it first - " + AD_Workflow.getValue());
}
if (AD_Workflow.isValidFromTo(getDateStartSchedule())) {
MPPOrderWorkflow PP_Order_Workflow=new MPPOrderWorkflow(AD_Workflow,get_ID(),get_TrxName());
PP_Order_Workflow.setAD_Org_ID(getAD_Org_ID());
PP_Order_Workflow.saveEx();
for ( MWFNode AD_WF_Node : AD_Workflow.getNodes(false,getAD_Client_ID())) {
if (AD_WF_Node.isValidFromTo(getDateStartSchedule())) {
MPPOrderNode PP_Order_Node=new MPPOrderNode(AD_WF_Node,PP_Order_Workflow,getQtyOrdered(),get_TrxName());
PP_Order_Node.setAD_Org_ID(getAD_Org_ID());
PP_Order_Node.saveEx();
for ( MWFNodeNext AD_WF_NodeNext : AD_WF_Node.getTransitions(getAD_Client_ID())) {
MPPOrderNodeNext nodenext=new MPPOrderNodeNext(AD_WF_NodeNext,PP_Order_Node);
nodenext.setAD_Org_ID(getAD_Org_ID());
nodenext.saveEx();
}
for ( MPPWFNodeProduct wfnp : MPPWFNodeProduct.forAD_WF_Node_ID(getCtx(),AD_WF_Node.get_ID())) {
MPPOrderNodeProduct nodeOrderProduct=new MPPOrderNodeProduct(wfnp,PP_Order_Node);
nodeOrderProduct.setAD_Org_ID(getAD_Org_ID());
nodeOrderProduct.saveEx();
}
for ( MPPWFNodeAsset wfna : MPPWFNodeAsset.forAD_WF_Node_ID(getCtx(),AD_WF_Node.get_ID())) {
MPPOrderNodeAsset nodeorderasset=new MPPOrderNodeAsset(wfna,PP_Order_Node);
nodeorderasset.setAD_Org_ID(getAD_Org_ID());
nodeorderasset.saveEx();
}
}
}
PP_Order_Workflow.getNodes(true);
for ( MPPOrderNode orderNode : PP_Order_Workflow.getNodes(false,getAD_Client_ID())) {
if (PP_Order_Workflow.getAD_WF_Node_ID() == orderNode.getAD_WF_Node_ID()) {
PP_Order_Workflow.setPP_Order_Node_ID(orderNode.getPP_Order_Node_ID());
}
for ( MPPOrderNodeNext next : orderNode.getTransitions(getAD_Client_ID())) {
next.setPP_Order_Next_ID();
next.saveEx();
}
}
PP_Order_Workflow.saveEx();
}
else {
throw new RoutingExpiredException(AD_Workflow,getDateStartSchedule());
}
}
| Create PP_Order_BOM from PP_Product_BOM. Create PP_Order_Workflow from AD_Workflow. |
public void iterateThruFolder(String path){
File root=new File(path);
File[] list=root.listFiles();
if (list == null) {
return;
}
for ( File f : list) {
if (f.isDirectory()) {
iterateThruFolder(f.getAbsolutePath());
if (!subdirectoriesList.contains(f.getPath())) {
subdirectoriesList.add(f.getPath());
}
}
}
}
| This method goes through a folder recursively and saves all its subdirectories to an ArrayList (subdirectoriesList). |
@Override protected MeasureOutput measure(int width,int height){
int screenH=WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
int weexH=WXViewUtils.getWeexHeight(getInstanceId());
int outHeight=height > (weexH >= screenH ? screenH : weexH) ? weexH - mAbsoluteY : height;
return super.measure(width,outHeight);
}
| Measure the size of the recyclerView. |
public String randomlyGenerateDestination(){
return Util.selectRandomlyFromList(getLocations());
}
| Returns a location which is selected by random. |
public static String createBaseRGBString(Color c){
return "-fx-base: " + createRGBString(c);
}
| Creates 'base' RGB string from the given color. |
public static String prettyFormat(String soap){
try {
Source xmlInput=new StreamSource(new StringReader(soap));
StringWriter stringWriter=new StringWriter();
StreamResult xmlOutput=new StreamResult(stringWriter);
TransformerFactory transformerFactory=TransformerFactory.newInstance();
Transformer transformer=transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT,"yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount","4");
transformer.transform(xmlInput,xmlOutput);
return xmlOutput.getWriter().toString();
}
catch ( Exception e) {
throw new RuntimeException(e);
}
}
| Converts the given SOAP message string to a pretty-printed format. |
@Override protected final Button createActionButton(String name,Runnable action){
Button btn=FXGL.getUIFactory().newButton(name);
btn.setOnAction(null);
return btn;
}
| Creates a new button with given name that performs given action on click/press. |
public VerletPhysics3D addParticle(VerletParticle3D p){
particles.add(p);
return this;
}
| Adds a particle to the list |
public Observation(){
}
| Instantiates a new observation. |
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix,namespace);
xmlWriter.setPrefix(prefix,namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}
| Util method to write an attribute with the ns prefix |
public OMScalingRaster(double ullat,double ullon,double lrlat,double lrlon,int w,int h,int[] pix){
super(ullat,ullon,w,h,pix);
lat2=lrlat;
lon2=lrlon;
}
| Creates an OMRaster images, Lat/Lon placement with a direct colormodel image. |
public <T>Flag registerOptional(final String name,final Class<T> type,final String usage,final String description,final T defaultValue){
return registerOptional(null,name,type,usage,description,defaultValue);
}
| Registers an option. This option requires a parameter of a specified type. |
public static int prevPow2(int x){
if (x < 1) throw new IllegalArgumentException("x must be greater or equal 1");
return (int)Math.pow(2,Math.floor(Math.log(x) / Math.log(2)));
}
| Returns the closest power-of-two number less than or equal to x. |
public void addCollected(BigDecimal amount){
addCollectedWithTolerance(amount,BigDecimal.ZERO);
}
| Add an amount to the existing collected amount, with zero tolerance i.e. balance cannot be exceeded. |
public MultiStateCompilationUnitChange(final String name,final ICompilationUnit unit){
super(name,(IFile)unit.getResource());
fUnit=unit;
setTextType("java");
}
| Creates a new multi state compilation unit change. |
private JSONWriter end(char m,char c) throws JSONException {
if (this.mode != m) {
throw new JSONException(m == 'a' ? "Misplaced endArray." : "Misplaced endObject.");
}
this.pop(m);
try {
this.writer.write(c);
}
catch ( IOException e) {
throw new JSONException(e);
}
this.comma=true;
return this;
}
| End something. |
public void enforceContext(Resource... contexts){
OpenRDFUtil.verifyContextNotNull(contexts);
this.contexts=contexts;
}
| Enforces the supplied contexts upon all statements that are reported to this RDFSailRemover. |
public void enableGrid(boolean enable){
gridEnabled=enable;
layerEffects.gridCell=gridCellSize;
layerEffects.gridColor=gridColor.toArray(null);
layerEffects.gridEnabled=enable;
}
| Show the surface grid |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-08-13 13:14:12.877 -0400",hash_original_method="450793B14B2760672928AE5911F3EF0A",hash_generated_method="D61AB6A8D39F54AA6F6EE26C3F3F9493") public static void disable(){
}
| Disables the JIT compiler. Does nothing on Android. |
public void addMapObserver(Observer<IOObjectMapEvent> observer){
mapObservable.addObserver(observer,false);
}
| Adds an observer, which receives updates when the map changes, i.e. an object is added/removed/changed or multiple objects are added/removed at the same time. |
public void addHeader(String header,String value){
clientHeaderMap.put(header,value);
}
| Sets headers that will be added to all requests this client makes (before sending). |
public String value(){
return value;
}
| Value of string field. |
@Override public Long hsetnx(final byte[] key,final byte[] field,final byte[] value){
checkIsInMultiOrPipeline();
client.hsetnx(key,field,value);
return client.getIntegerReply();
}
| Set the specified hash field to the specified value if the field not exists. <b>Time complexity:</b> O(1) |
public NumericDocValuesField(String name,long value){
super(name,TYPE);
fieldsData=Long.valueOf(value);
}
| Creates a new DocValues field with the specified 64-bit long value |
public void start() throws IOException, StunException {
localSocket=new IceUdpSocketWrapper(new SafeCloseDatagramSocket(serverAddress));
stunStack.addSocket(localSocket);
stunStack.addRequestListener(serverAddress,this);
}
| Initializes the underlying stack |
public Class<? extends OutputStreamProvider> bindOutputStreamProvider(){
return ConsoleOutputStreamProvider.class;
}
| Binds the output stream provider to the console based one in the UI. |
public static void main(final String[] args){
DOMTestCase.doMain(hc_noderemovechildnode.class,args);
}
| Runs this test from the command line. |
public boolean isParameter(){
if (o1 instanceof SootMethod && o2 instanceof Integer) return true;
return false;
}
| Decide if this pair represents a method parameter. |
private void ib7(int a,int b,int c,int d){
int t3=c | (a & b);
int t4=d & (a | b);
X3=t3 ^ t4;
int t6=~d;
int t7=b ^ t4;
int t9=t7 | (X3 ^ t6);
X1=a ^ t9;
X0=(c ^ t7) ^ (d | X1);
X2=(t3 ^ X1) ^ (X0 ^ (a & X3));
}
| InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms. |
private void enlargeCapacity(int key){
int diff=offCount - offset;
int newSize=arr.length;
if (newSize < 1) newSize=1;
while (newSize < key + offset + diff) {
newSize*=2;
}
if (newSize > arr.length) {
Object[] na=new Object[newSize];
for (int i=offset; i < offset + size; i++) {
na[i + diff]=arr[i];
}
arr=na;
offset+=diff;
}
}
| !!! all methods that use this method must be sync enlarge the inner array to given size |
static String xmltoRFC(String string){
try {
String s=changeLess32toRFC(string);
return changeWStoRFC(s);
}
catch ( Exception e) {
return string;
}
}
| Method xmltoRFC |
boolean update(InputStream in,OutputStream out,InputStream newManifest,JarIndex jarIndex) throws IOException {
ZipInputStream zis=new ZipInputStream(in);
ZipOutputStream zos=new JarOutputStream(out);
ZipEntry e=null;
boolean foundManifest=false;
boolean updateOk=true;
if (jarIndex != null) {
addIndex(jarIndex,zos);
}
while ((e=zis.getNextEntry()) != null) {
String name=e.getName();
boolean isManifestEntry=equalsIgnoreCase(name,MANIFEST_NAME);
if ((jarIndex != null && equalsIgnoreCase(name,INDEX_NAME)) || (Mflag && isManifestEntry)) {
continue;
}
else if (isManifestEntry && ((newManifest != null) || (ename != null))) {
foundManifest=true;
if (newManifest != null) {
FileInputStream fis=new FileInputStream(mname);
boolean ambiguous=isAmbiguousMainClass(new Manifest(fis));
fis.close();
if (ambiguous) {
return false;
}
}
Manifest old=new Manifest(zis);
if (newManifest != null) {
old.read(newManifest);
}
if (!updateManifest(old,zos)) {
return false;
}
}
else {
if (!entryMap.containsKey(name)) {
ZipEntry e2=new ZipEntry(name);
e2.setMethod(e.getMethod());
e2.setTime(e.getTime());
e2.setComment(e.getComment());
e2.setExtra(e.getExtra());
if (e.getMethod() == ZipEntry.STORED) {
e2.setSize(e.getSize());
e2.setCrc(e.getCrc());
}
zos.putNextEntry(e2);
copy(zis,zos);
}
else {
File f=entryMap.get(name);
addFile(zos,f);
entryMap.remove(name);
entries.remove(f);
}
}
}
for ( File f : entries) {
addFile(zos,f);
}
if (!foundManifest) {
if (newManifest != null) {
Manifest m=new Manifest(newManifest);
updateOk=!isAmbiguousMainClass(m);
if (updateOk) {
if (!updateManifest(m,zos)) {
updateOk=false;
}
}
}
else if (ename != null) {
if (!updateManifest(new Manifest(),zos)) {
updateOk=false;
}
}
}
zis.close();
zos.close();
return updateOk;
}
| Updates an existing jar file. |
public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException {
if (obj2.getType() == XObject.CLASS_NODESET) return obj2.lessThan(this);
return this.num() > obj2.num();
}
| Tell if one object is greater than the other. |
public static int safeParseInt(String s){
return safeParseInt(s,-1);
}
| Parses the specified string argument to an unsigned decimal integer. If the string starts with non-digital characters ( '-' included ), -1 is returned. If the string starts with digital characters but ends with non-digital ones, the value of the digital part is returned. |
public static final double nextDouble(double value){
if (value == Double.POSITIVE_INFINITY) {
return value;
}
long bits;
if (value == 0) {
bits=0;
}
else {
bits=Double.doubleToLongBits(value);
}
return Double.longBitsToDouble(value < 0 ? bits - 1 : bits + 1);
}
| Returns the double value which is closest to the specified double but larger. |
@Override public void run(){
amIActive=true;
boolean image1Bool=false;
boolean image2Bool=false;
double constant1=0;
double constant2=0;
if (args.length < 3) {
showFeedback("Plugin parameters have not been set properly.");
return;
}
String inputHeader1=args[0];
File file=new File(inputHeader1);
image1Bool=file.exists();
if (image1Bool) {
constant1=-1;
}
else {
constant1=Double.parseDouble(file.getName().replace(".dep",""));
}
file=null;
String inputHeader2=args[1];
file=new File(inputHeader2);
image2Bool=file.exists();
if (image2Bool) {
constant2=-1;
}
else {
constant2=Double.parseDouble(file.getName().replace(".dep",""));
}
file=null;
String outputHeader=args[2];
if ((inputHeader1 == null) || (inputHeader2 == null) || (outputHeader == null)) {
showFeedback("One or more of the input parameters have not been set properly.");
return;
}
try {
int row, col;
double z1, z2;
int progress, oldProgress=-1;
double[] data1;
double[] data2;
if (image1Bool && image2Bool) {
WhiteboxRaster inputFile1=new WhiteboxRaster(inputHeader1,"r");
WhiteboxRaster inputFile2=new WhiteboxRaster(inputHeader2,"r");
int rows=inputFile1.getNumberRows();
int cols=inputFile1.getNumberColumns();
double noData1=inputFile1.getNoDataValue();
double noData2=inputFile2.getNoDataValue();
if ((inputFile2.getNumberRows() != rows) || (inputFile2.getNumberColumns() != cols)) {
showFeedback("The input images must have the same dimensions and coordinates. Operation cancelled.");
return;
}
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader1,WhiteboxRaster.DataType.FLOAT,noData1);
outputFile.setPreferredPalette(inputFile1.getPreferredPalette());
for (row=0; row < rows; row++) {
data1=inputFile1.getRowValues(row);
data2=inputFile2.getRowValues(row);
for (col=0; col < cols; col++) {
z1=data1[col];
z2=data2[col];
if ((z1 != noData1) && (z2 != noData2)) {
outputFile.setValue(row,col,Math.min(z1,z2));
}
else {
outputFile.setValue(row,col,noData1);
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile1.close();
inputFile2.close();
outputFile.close();
}
else if (image1Bool) {
WhiteboxRaster inputFile1=new WhiteboxRaster(inputHeader1,"r");
int rows=inputFile1.getNumberRows();
int cols=inputFile1.getNumberColumns();
double noData=inputFile1.getNoDataValue();
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader1,WhiteboxRaster.DataType.FLOAT,noData);
outputFile.setPreferredPalette(inputFile1.getPreferredPalette());
for (row=0; row < rows; row++) {
data1=inputFile1.getRowValues(row);
for (col=0; col < cols; col++) {
z1=data1[col];
if (z1 != noData) {
outputFile.setValue(row,col,Math.min(z1,constant2));
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile1.close();
outputFile.close();
}
else if (image2Bool) {
WhiteboxRaster inputFile2=new WhiteboxRaster(inputHeader2,"r");
int rows=inputFile2.getNumberRows();
int cols=inputFile2.getNumberColumns();
double noData=inputFile2.getNoDataValue();
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader2,WhiteboxRaster.DataType.FLOAT,noData);
outputFile.setPreferredPalette(inputFile2.getPreferredPalette());
for (row=0; row < rows; row++) {
data2=inputFile2.getRowValues(row);
for (col=0; col < cols; col++) {
z2=data2[col];
if (z2 != noData) {
outputFile.setValue(row,col,Math.min(constant1,z2));
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile2.close();
outputFile.close();
}
else {
showFeedback("At least one of the inputs must be a raster image.");
}
returnData(outputHeader);
}
catch ( OutOfMemoryError oe) {
myHost.showFeedback("An out-of-memory error has occurred during operation.");
}
catch ( Exception e) {
myHost.showFeedback("An error has occurred during operation. See log file for details.");
myHost.logException("Error in " + getDescriptiveName(),e);
}
finally {
updateProgress("Progress: ",0);
amIActive=false;
myHost.pluginComplete();
}
}
| Used to execute this plugin tool. |
public Object trunc(InstanceScope scope,Object v){
if (v == null) return null;
if (v instanceof List) {
List<?> elems=(List<?>)v;
if (elems.size() <= 1) return null;
return elems.subList(0,elems.size() - 1);
}
v=convertAnythingIteratableToIterator(scope,v);
if (v instanceof Iterator) {
List<Object> a=new ArrayList<Object>();
Iterator<?> it=(Iterator<?>)v;
while (it.hasNext()) {
Object o=it.next();
if (it.hasNext()) a.add(o);
}
return a;
}
return null;
}
| Return all but the last element. <code>trunc(<i>x</i>)==null</code> if <code><i>x</i></code> is single-valued. |
public boolean containsExplicitExceptions(){
for (ThrownExceptionIterator i=iterator(); i.hasNext(); ) {
i.next();
if (i.isExplicit()) {
return true;
}
}
return false;
}
| Return whether or not the set contains any explicit exceptions. |
public IntelligentSorter(boolean ascending){
super(ascending);
mycomp=sage.Seeker.getInstance().getMediaFileComparator(true);
}
| Creates a new instance of IntelligentSorter |
public static <T>T castOrFail(Object object,Class<T> clazz){
requireNonNull(clazz);
if (object == null) {
throw new NoSuchElementException("null is not an instance of " + clazz.getName());
}
return Optional.of(object).filter(null).map(null).get();
}
| Casts and returns the provided object to the provided class. |
public void add(long x){
Cell[] as;
long b, v;
int[] hc;
Cell a;
int n;
if ((as=cells) != null || !casBase(b=base,b + x)) {
boolean uncontended=true;
if ((hc=threadHashCode.get()) == null || as == null || (n=as.length) < 1 || (a=as[(n - 1) & hc[0]]) == null || !(uncontended=a.cas(v=a.value,v + x))) retryUpdate(x,hc,uncontended);
}
}
| Adds the given value. |
public boolean isUpperLimitEnabled(){
return this.upperLimitEnabled;
}
| Returns true if the upper limit is enabled. |
@Transactional @Override public List<ReceiptHeader> createBankRemittance(final String[] serviceNameArr,final String[] totalCashAmount,final String[] totalAmount,final String[] totalCardAmount,final String[] receiptDateArray,final String[] fundCodeArray,final String[] departmentCodeArray,final Integer accountNumberId,final Integer positionUser,final String[] receiptNumberArray,final Date remittanceDate){
final List<ReceiptHeader> bankRemittanceList=new ArrayList<ReceiptHeader>(0);
final List<ReceiptHeader> bankRemitList=new ArrayList<ReceiptHeader>();
final SimpleDateFormat dateFomatter=new SimpleDateFormat("yyyy-MM-dd",Locale.getDefault());
financialsUtil.prepareForUpdateInstrumentDepositSQL();
final String instrumentGlCodeQueryString="SELECT COA.GLCODE FROM CHARTOFACCOUNTS COA,EGF_INSTRUMENTACCOUNTCODES IAC,EGF_INSTRUMENTTYPE IT " + "WHERE IT.ID=IAC.TYPEID AND IAC.GLCODEID=COA.ID AND IT.TYPE=";
final String receiptInstrumentQueryString="select DISTINCT (instruments) from org.egov.collection.entity.ReceiptHeader receipt " + "join receipt.receiptInstrument as instruments join receipt.receiptMisc as receiptMisc where ";
final String serviceNameCondition="receipt.service.name=? ";
final String receiptDateCondition="and date(receipt.receiptdate)=? ";
final String instrumentStatusCondition="and instruments.statusId.id=? ";
final String instrumentTypeCondition="and instruments.instrumentType.type = ? ";
final String receiptFundCondition="and receiptMisc.fund.code = ? ";
final String receiptDepartmentCondition="and receiptMisc.department.code = ? ";
final String receiptSourceCondition="and receipt.source = ? ";
final String cashInHandQueryString=instrumentGlCodeQueryString + "'" + CollectionConstants.INSTRUMENTTYPE_CASH+ "'";
final String chequeInHandQueryString=instrumentGlCodeQueryString + "'" + CollectionConstants.INSTRUMENTTYPE_CHEQUE+ "'";
final String cardPaymentQueryString=instrumentGlCodeQueryString + "'" + CollectionConstants.INSTRUMENTTYPE_CARD+ "'";
final Query cashInHand=persistenceService.getSession().createSQLQuery(cashInHandQueryString);
final Query chequeInHand=persistenceService.getSession().createSQLQuery(chequeInHandQueryString);
final Query cardPaymentAccount=persistenceService.getSession().createSQLQuery(cardPaymentQueryString);
String cashInHandGLCode=null, chequeInHandGlcode=null;
final String createVoucher=collectionsUtil.getAppConfigValue(CollectionConstants.MODULE_NAME_COLLECTIONS_CONFIG,CollectionConstants.APPCONFIG_VALUE_CREATEVOUCHER_FOR_REMITTANCE);
final String functionCode=collectionsUtil.getAppConfigValue(CollectionConstants.MODULE_NAME_COLLECTIONS_CONFIG,CollectionConstants.APPCONFIG_VALUE_COLLECTION_BANKREMITTANCE_FUNCTIONCODE);
final EgwStatus instrmentStatusNew=collectionsUtil.getStatusForModuleAndCode(CollectionConstants.MODULE_NAME_INSTRUMENTHEADER,CollectionConstants.INSTRUMENT_NEW_STATUS);
final EgwStatus receiptStatusRemitted=collectionsUtil.getReceiptStatusForCode(CollectionConstants.RECEIPT_STATUS_CODE_REMITTED);
if (!cashInHand.list().isEmpty()) cashInHandGLCode=cashInHand.list().get(0).toString();
if (!chequeInHand.list().isEmpty()) chequeInHandGlcode=chequeInHand.list().get(0).toString();
if (!cardPaymentAccount.list().isEmpty()) cardPaymentAccount.list().get(0).toString();
collectionsUtil.getVoucherType();
Boolean showRemitDate=false;
BigDecimal totalCashAmt=BigDecimal.ZERO;
BigDecimal totalChequeAmount=BigDecimal.ZERO;
BigDecimal totalCashVoucherAmt=BigDecimal.ZERO;
BigDecimal totalChequeVoucherAmt=BigDecimal.ZERO;
String fundCode="";
Date voucherDate=null;
List<InstrumentHeader> instrumentHeaderListCash=new ArrayList<InstrumentHeader>();
List<InstrumentHeader> instrumentHeaderListCheque=new ArrayList<InstrumentHeader>();
if (collectionsUtil.getAppConfigValue(CollectionConstants.MODULE_NAME_COLLECTIONS_CONFIG,CollectionConstants.APPCONFIG_VALUE_COLLECTION_BANKREMITTANCE_SHOWREMITDATE).equals(CollectionConstants.YES)) showRemitDate=true;
final EgwStatus instrumentStatusDeposited=collectionsUtil.getStatusForModuleAndCode(CollectionConstants.MODULE_NAME_INSTRUMENTHEADER,CollectionConstants.INSTRUMENT_DEPOSITED_STATUS);
final Bankaccount depositedBankAccount=(Bankaccount)persistenceService.find("from Bankaccount where id=?",Long.valueOf(accountNumberId.longValue()));
final String serviceGlCode=depositedBankAccount.getChartofaccounts().getGlcode();
for (int i=0; i < serviceNameArr.length; i++) {
final String serviceName=serviceNameArr[i].trim();
if (showRemitDate && remittanceDate != null) voucherDate=remittanceDate;
else try {
collectionsUtil.getRemittanceVoucherDate(dateFomatter.parse(receiptDateArray[i]));
}
catch ( final ParseException e) {
LOGGER.error("Error Parsing Date",e);
}
if (serviceName != null && serviceName.length() > 0) {
persistenceService.findByNamedQuery(CollectionConstants.QUERY_SERVICE_BY_NAME,serviceName);
final ServiceDetails serviceDetails=(ServiceDetails)persistenceService.findByNamedQuery(CollectionConstants.QUERY_SERVICE_BY_NAME,serviceName);
if (totalCashAmount[i].trim() != null && totalCashAmount[i].trim().length() > 0 && cashInHandGLCode != null) {
final StringBuilder cashQueryBuilder=new StringBuilder(receiptInstrumentQueryString);
cashQueryBuilder.append(serviceNameCondition);
cashQueryBuilder.append(receiptDateCondition);
cashQueryBuilder.append(instrumentStatusCondition);
cashQueryBuilder.append(instrumentTypeCondition);
cashQueryBuilder.append(receiptFundCondition);
cashQueryBuilder.append(receiptDepartmentCondition);
cashQueryBuilder.append("and receipt.status.id=(select id from org.egov.commons.EgwStatus where moduletype=? and code=?) ");
cashQueryBuilder.append(receiptSourceCondition);
final Object arguments[]=new Object[9];
arguments[0]=serviceName;
try {
arguments[1]=dateFomatter.parse(receiptDateArray[i]);
}
catch ( final ParseException exp) {
LOGGER.debug("Exception in parsing date " + receiptDateArray[i] + " - "+ exp.getMessage());
throw new ApplicationRuntimeException("Exception while parsing date",exp);
}
arguments[2]=instrmentStatusNew.getId();
arguments[3]=CollectionConstants.INSTRUMENTTYPE_CASH;
arguments[4]=fundCodeArray[i];
arguments[5]=departmentCodeArray[i];
arguments[6]=CollectionConstants.MODULE_NAME_RECEIPTHEADER;
arguments[7]=CollectionConstants.RECEIPT_STATUS_CODE_APPROVED;
arguments[8]=Source.SYSTEM.toString();
fundCode=fundCodeArray[i];
instrumentHeaderListCash=persistenceService.findAllBy(cashQueryBuilder.toString(),arguments);
totalCashAmt=totalCashAmt.add(new BigDecimal(totalCashAmount[i]));
if (CollectionConstants.YES.equalsIgnoreCase(createVoucher) && serviceDetails.getVoucherCreation()) totalCashVoucherAmt=totalCashVoucherAmt.add(new BigDecimal(totalCashAmount[i]));
else financialsUtil.updateInstrumentHeader(instrumentHeaderListCash,instrumentStatusDeposited,depositedBankAccount);
bankRemittanceList.addAll(getRemittanceList(serviceDetails,instrumentHeaderListCash));
}
if (totalAmount[i].trim() != null && totalAmount[i].trim().length() > 0 && chequeInHandGlcode != null) {
final StringBuilder chequeQueryBuilder=new StringBuilder(receiptInstrumentQueryString);
chequeQueryBuilder.append(serviceNameCondition);
chequeQueryBuilder.append(receiptDateCondition);
chequeQueryBuilder.append(instrumentStatusCondition);
chequeQueryBuilder.append("and instruments.instrumentType.type in ( ?, ?)");
chequeQueryBuilder.append("and receipt.status.id=(select id from org.egov.commons.EgwStatus where moduletype=? and code=?) ");
chequeQueryBuilder.append(receiptFundCondition);
chequeQueryBuilder.append(receiptDepartmentCondition);
chequeQueryBuilder.append(receiptSourceCondition);
final Object arguments[]=new Object[10];
arguments[0]=serviceName;
try {
arguments[1]=dateFomatter.parse(receiptDateArray[i]);
}
catch ( final ParseException exp) {
LOGGER.debug("Exception in parsing date " + receiptDateArray[i] + " - "+ exp.getMessage());
throw new ApplicationRuntimeException("Exception while parsing date",exp);
}
arguments[2]=instrmentStatusNew.getId();
arguments[3]=CollectionConstants.INSTRUMENTTYPE_CHEQUE;
arguments[4]=CollectionConstants.INSTRUMENTTYPE_DD;
arguments[5]=CollectionConstants.MODULE_NAME_RECEIPTHEADER;
arguments[6]=CollectionConstants.RECEIPT_STATUS_CODE_APPROVED;
arguments[7]=fundCodeArray[i];
arguments[8]=departmentCodeArray[i];
arguments[9]=Source.SYSTEM.toString();
fundCode=fundCodeArray[i];
instrumentHeaderListCheque=persistenceService.findAllBy(chequeQueryBuilder.toString(),arguments);
totalChequeAmount=totalChequeAmount.add(new BigDecimal(totalAmount[i]));
if (CollectionConstants.YES.equalsIgnoreCase(createVoucher) && serviceDetails.getVoucherCreation()) totalChequeVoucherAmt=totalChequeVoucherAmt.add(new BigDecimal(totalAmount[i]));
else financialsUtil.updateInstrumentHeader(instrumentHeaderListCheque,instrumentStatusDeposited,depositedBankAccount);
bankRemittanceList.addAll(getRemittanceList(serviceDetails,instrumentHeaderListCheque));
}
}
for ( final ReceiptHeader receiptHeader : bankRemittanceList) if (!bankRemitList.contains(receiptHeader)) bankRemitList.add(receiptHeader);
}
final Remittance remittance=populateAndPersistRemittance(totalCashAmt,totalChequeAmount,fundCode,cashInHandGLCode,chequeInHandGlcode,serviceGlCode,functionCode,bankRemitList,createVoucher,voucherDate,depositedBankAccount,totalCashVoucherAmt,totalChequeVoucherAmt);
for ( final ReceiptHeader receiptHeader : bankRemitList) {
receiptHeader.setStatus(receiptStatusRemitted);
receiptHeader.setRemittanceReferenceNumber(remittance.getReferenceNumber());
receiptHeaderService.update(receiptHeader);
}
return bankRemitList;
}
| Create Contra Vouchers for String array passed of serviceName, totalCashAmount, totalChequeAmount, totalCardAmount and |
public PluginException(String msg,Throwable throwable){
super(msg,throwable);
}
| Creates a new <code>PluginException</code> object |
@Override public void endWindow(){
if (verport.isConnected()) {
for ( Map.Entry<Integer,Set<Integer>> e : valhistory.entrySet()) {
verport.emit(new KeyHashValPair<Integer,Integer>(e.getKey(),e.getValue().size()));
}
}
if (clearHistory) {
valhistory.clear();
}
}
| Emits the total count of unique values per key as KeyHashValPairs to the verification port |
public DViewPrivateKey(JDialog parent,String title,PrivateKey privateKey,Provider provider) throws CryptoException {
super(parent,title,ModalityType.DOCUMENT_MODAL);
this.privateKey=privateKey;
this.provider=provider;
initComponents();
}
| Creates new DViewPrivateKey dialog where the parent is a dialog. |
public void add(Individual individual){
individuals.add(individual);
}
| Adds a single individual. |
public double optDouble(int index,double defaultValue){
try {
return this.getDouble(index);
}
catch ( Exception e) {
return defaultValue;
}
}
| Get the optional double value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. |
public Graph search(){
long start=System.currentTimeMillis();
this.numIndependenceTests=0;
this.allTriples=new HashSet<>();
this.ambiguousTriples=new HashSet<>();
this.colliderTriples=new HashSet<>();
this.noncolliderTriples=new HashSet<>();
this.maxRemainingAtDepth=new int[20];
this.maxVariableAtDepth=new Node[20];
Arrays.fill(maxRemainingAtDepth,-1);
Arrays.fill(maxVariableAtDepth,null);
Graph graph=new EdgeListGraph();
this.a=new HashSet<>();
this.variables=test.getVariables();
Node target=variables.get(0);
graph.addNode(target);
for ( Node node : variables) {
if (!graph.containsNode(node)) {
graph.addNode(node);
}
constructFan(node,graph);
}
for ( Node node : variables) {
if (!graph.containsNode(node)) {
graph.addNode(node);
}
}
orientUnshieldedTriples(knowledge,graph,getTest(),getDepth(),graph.getNodes());
MeekRules meekRules=new MeekRules();
meekRules.setAggressivelyPreventCycles(this.aggressivelyPreventCycles);
meekRules.setKnowledge(knowledge);
meekRules.orientImplied(graph);
this.logger.log("graph","\nReturning this graph: " + graph);
return graph;
}
| Does a pattern search. |
public static byte[] decodeWebSafe(byte[] source,int off,int len) throws Base64DecoderException {
return decode(source,off,len,WEBSAFE_DECODABET);
}
| Decodes web safe Base64 content in byte array format and returns the decoded byte array. Web safe encoding uses '-' instead of '+', '_' instead of '/' |
private void processKeywords(){
if (isKind(PRIMITIVETYPES)) {
for (int i=0; i < PRIM_TYPES.length; i++) {
if (NameMatcher.isSimilarName(fName,PRIM_TYPES[i])) {
addResult(new SimilarElement(PRIMITIVETYPES,PRIM_TYPES[i],50));
}
}
}
if (isKind(VOIDTYPE)) {
String voidType="void";
if (NameMatcher.isSimilarName(fName,voidType)) {
addResult(new SimilarElement(PRIMITIVETYPES,voidType,50));
}
}
}
| Method addPrimitiveTypes. |
public boolean isIndependent(Node x,Node y,List<Node> z){
if (z == null) {
throw new NullPointerException();
}
for ( Node node : z) {
if (node == null) {
throw new NullPointerException();
}
}
if (!observedVars.contains(x)) {
throw new IllegalArgumentException("Not an observed variable: " + x);
}
if (!observedVars.contains(y)) {
throw new IllegalArgumentException("Not an observed variable: " + y);
}
for ( Node _z : z) {
if (!observedVars.contains(_z)) {
throw new IllegalArgumentException("Not an observed variable: " + _z);
}
}
boolean dSeparated=!isDConnectedTo4(x,y,z,graph,getAlpha());
System.out.println("Dseparated = " + dSeparated);
if (verbose) {
if (dSeparated) {
double pValue=1.0;
TetradLogger.getInstance().log("independencies",SearchLogUtils.independenceFactMsg(x,y,z,pValue));
System.out.println(SearchLogUtils.independenceFactMsg(x,y,z,pValue));
}
else {
double pValue=0.0;
TetradLogger.getInstance().log("dependencies",SearchLogUtils.dependenceFactMsg(x,y,z,pValue));
System.out.println(SearchLogUtils.dependenceFactMsg(x,y,z,pValue));
}
}
if (dSeparated) {
if (this.facts != null) {
this.facts.add(new IndependenceFact(x,y,z));
}
pvalue=1.0;
}
else {
pvalue=0.0;
}
return dSeparated;
}
| Checks the indicated d-separation fact. |
public DoublesUnion build(){
return new HeapDoublesUnion(k_);
}
| Returns a virgin Union object with the default k |
public boolean isPerStreamStatEnabled(){
return getBoolean(SERVER_ENABLE_PERSTREAM_STAT,SERVER_ENABLE_PERSTREAM_STAT_DEFAULT);
}
| Whether the per stream stat enabled for not in this server. |
@SuppressWarnings("unchecked") public <SubT extends T>ChildNodes<? extends SubT> as(Class<SubT> subClass){
elementClass.asSubclass(subClass);
return (ChildNodes<SubT>)this;
}
| Statically cast this ChildNodes object to represent a collection containing a subtype of the original. This only succeeds if the dynamic type of this ChildNodes is such that the cast is safe. |
NetworkPacket(boolean compressed,int marshallingType,byte[] data){
this.compressed=compressed;
this.marshallingType=marshallingType;
this.data=data;
}
| Creates new packet |
public LoadUnit(String tu,String physicalPosition){
this.transportUnit=tu;
this.physicalPosition=physicalPosition;
}
| Create a new LoadUnit. |
public boolean isAudited(){
Object oo=get_Value(COLUMNNAME_IsAudited);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Activate Audit. |
private void createInfoWindow(){
infoWindow=new JWindow(SwingUtilities.getWindowAncestor(textField));
infoLabel=new JLabel();
infoWindow.add(infoLabel);
JPanel contentPane=(JPanel)infoWindow.getContentPane();
Border border=BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.GRAY),BorderFactory.createEmptyBorder(2,4,2,4));
contentPane.setBorder(border);
contentPane.setBackground(HtmlColors.decode("#EEEEEE"));
infoLabel.setFont(textField.getFont());
containingWindow=SwingUtilities.getWindowAncestor(textField);
if (containingWindow != null) {
containingWindow.addComponentListener(componentListener);
}
textField.addComponentListener(componentListener);
}
| Creates the window for the info popup. This should only be run once and then reused, only changing the text and size. |
public Cci(RealMatrix data,List<String> variables,double alpha){
if (data == null) throw new NullPointerException();
if (variables == null) throw new NullPointerException();
if (data.getColumnDimension() != variables.size()) {
throw new IllegalArgumentException("Columns in data do not match # variables.");
}
this.alpha=alpha;
this.cutoff=StatUtils.getZForAlpha(alpha);
this.data=data;
indices=new HashMap<>();
for (int i=0; i < variables.size(); i++) {
indices.put(variables.get(i),i);
}
h=new double[data.getColumnDimension()];
for (int i=0; i < data.getColumnDimension(); i++) {
h[i]=h(variables.get(i));
}
}
| Constructs a new Independence test which checks independence facts based on the correlation data implied by the given data set (must be continuous). The given significance level is used. |
public boolean readBit(){
return readBits(1) == 1;
}
| Reads a single bit. |
public Set<String> keySet(){
return propMap.keySet();
}
| Get property keys. |
public AppletObjectInputStream(InputStream in,AppletClassLoader loader) throws IOException, StreamCorruptedException {
super(in);
if (loader == null) {
throw new AppletIllegalArgumentException("appletillegalargumentexception.objectinputstream");
}
this.loader=loader;
}
| Loader must be non-null; |
private List<TaskRecord> createRecordList(ResultSet rs,int offset,int limit) throws SQLException {
List<TaskRecord> lst=new ArrayList<TaskRecord>();
int i=0;
while (rs.next()) {
if (i >= offset && i < offset + limit) lst.add(readTaskRecord(rs));
i++;
}
return lst;
}
| Creates a list of TaskRecord objects from a databse result set |
@Override public final void perform(IR ir){
if (!ir.method.isInterruptible() || !Instrumentation.instrumentationEnabled() || ir.method.getDeclaringClass().hasSaveVolatileAnnotation()) {
return;
}
BasicBlock firstBB=ir.cfg.entry();
MethodInvocationCounterData data=AOSDatabase.methodInvocationCounterData;
int cmid=ir.compiledMethod.getId();
Instruction c=data.createEventCounterInstruction(cmid);
firstBB.prependInstructionRespectingPrologue(c);
}
| Insert basic block counters |
@Override public void updateString(int columnIndex,String x) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("updateString(" + columnIndex + ", "+ quote(x)+ ");");
}
update(columnIndex,x == null ? ValueNull.INSTANCE : ValueString.get(x));
}
catch ( Exception e) {
throw logAndConvert(e);
}
}
| Updates a column in the current or insert row. |
public DateTime withYearOfCentury(int yearOfCentury){
return withMillis(getChronology().yearOfCentury().set(getMillis(),yearOfCentury));
}
| Returns a copy of this datetime with the year of century field updated. <p> DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year of century changed. |
public ExpressionStatement createExpressionStatement(){
ExpressionStatementImpl expressionStatement=new ExpressionStatementImpl();
return expressionStatement;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public int cardinality(){
if (this.isNoView) return this.elements.size();
else return super.cardinality();
}
| Returns the number of cells having non-zero values. |
public int describeContents(){
return 0;
}
| Implement the Parcelable interface |
private void checkContact(ContactResource contact,String contactId,String repoId){
assertThat(contact).isNotNull();
assertThat(contact.getContactId()).isEqualTo(contactId);
assertThat(contact.getRepoId()).isEqualTo(repoId);
}
| Verifies that contact id and ROID match expected values |
public static void writeChartAsPNG(OutputStream out,JFreeChart chart,int width,int height) throws IOException {
writeChartAsPNG(out,chart,width,height,null);
}
| Writes a chart to an output stream in PNG format. |
public ICommitRecord fetchCommitRecord(final Entry entry){
ICommitRecord commitRecord=cache.get(entry.commitTime);
if (commitRecord == null) {
commitRecord=loadCommitRecord(store,entry.addr);
assert entry.commitTime == commitRecord.getTimestamp();
cache.put(entry.commitTime,commitRecord,false);
}
return commitRecord;
}
| Materialize a commit record, from cache if possible. <p> Note: This DOES NOT perform lookup of the commit time! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.