Counter class
Counter increases and decreases by 1, records count nonnegative integer and tests whether the current count value is zero. No method allows the value of counter to become negative. Can anyone assist?public class Counter
private int count; // definition of counter
public Counter(int aCount) // Constructor to initialize count
count = aCount;
public void setCountToZero() //method to zero out counter
count = 0;
public void addOneToCount() //method to add one to counter
count += 1; // or count++;
public void subtractOneFromCount() //method to subtract one from counter
if ((count - 1) >= 0)
{count -= 1;} // or count--;
public void displayCount()
System.out.println("The count is " + count);
//tester
package counter;
public class CounterTest
public static void main(String[] args)
Counter myCounter = new Counter(-1); // Create myCounter Object and give 10 to counter
myCounter.displayCount(); // Displays the zero value
myCounter.addOneToCount(); // Now count has value of 11
myCounter.displayCount(); // Displays the zero value
myCounter.subtractOneFromCount(); // Subtracted one from count
myCounter.displayCount(); // Displays count
myCounter.setCountToZero(); // Resets count to zero
myCounter.displayCount(); // Displays the zero value
}
In Java it's normal not to decorate argument names (or any other names for that matter), so call the 'count' argument 'count'. If there's an ambiguity with a field of an object, use 'this.' to indicate the field. Making the argument final prevents any assignment, which would be an error - it's only use is to input a value to the constructor.
If a negative value is an illegal value for the argument, then throw an IllegalArgumentException instead of trying to guess the correct value (so far guesses have been 'the client requested -17, perhaps he meant zero' and 'the client requested -2147483648, perhaps he meant, err, -2147483648' ( abs(-2147483648) == -2147483648 as signed 32 bits doesn't have a +2147483648) ) - something is trying to create a counter with a negative count, and that is a bug, so making it show up as an exception means you find the bug earlier.
public Counter (final int count) {
if (count < 0)
throw new IllegalArgumentException("Count must be greater than or equal to zero: " + count);
this.count = count;
}
Similar Messages
-
Counting class of period work schedule not available on 01.01.2012
HI SAP GURUS,
while creating attendance through info type 2002 for an employee its giving error message i.e " counting class of period work schedule 03/KGPG not available on 01.01.2012. Please suggest.Check out this link in the IMG:
IMG > Time Management > Time Data Recording and Administration > Attendances/Actual Working Times > Attendance Counting > Define Counting Classes for the Period Work Schedule
Under the PSG Grouping 03, and PWS KGPG, maintain the value = 1 (or other class as required).
If you do not find the entry, you need to create a new record.
Also, under the Counting rule (that you assign to your attendance) make sure that the appropriate Counting class for PWS is checked mark otherwise your attendance will not be counted properly. You can create the couting rule with this IMG step:
IMG > Time Management > Time Data Recording and Administration > Attendances/Actual Working Times > Attendance Counting > Rules for Attendance Counting (New) > Define Counting Rules
Regards,
Harshal -
Necessity of definin periodic work schedules with the counting classe - Reg
Hi every one,
While customizing attendances and absences we have to define the periodic work schedule with the counting classes. And this counting classes are used in the counting rule. Can anyone please tel me what is the need of defining periodic work schedules with the counting classes.
With Regards,
Jagadeeshif there are multiple PWS in an organisation and if the client requires the absences to be counted in different manner depending on the PWS. this counting class can be used.
use the appropriate check box in counting rule. -
Hai all
on what basis we will enter a counting class to periodic work schedule.
regards
MadhuMore-over for PWS :
Assign a counting rule to an attendance/absence type:
A counting rule must be assigned to each attendance/absence type to ensure that
the payroll days and hours are determined for the special attendance/absence.
In some cases, you may want to calculate the duration of absences and attendances
differently depending on the type of work on that day or the work pattern.
You can determine for which daily work schedules or period work schedules the
counting rule to determine payroll days and hours is to apply.
To do so, you can use the counting classes of the period work schedules and the
daily work schedule classes. You can select from the counting classes 0 to 9 for
both the daily and period work schedules.Different counting rules can therefore be
set up for different daily work schedules as well as different period work schedules.
Hope it helps,
Regards,
Swapnil
Reward Points Helpful -
Help query with having or count class
Hi gurus,
I want to pull the records from this table ,whihc are having only the two xtn's , do i need to have having with the count ? kindly suggest
select distinct ID, MCC, XTN
from prod.merch_xtn_serv
where xtn in (1,18)
GROUP BY ID,MCC,XTN
ORDER BY ID ,mcc,XTNHi,
978485 wrote:
Hi gurus,
I want to pull the records from this table ,whihc are having only the two xtn's , do i need to have having with the count ? kindly suggest
select distinct ID, MCC, XTN
from prod.merch_xtn_serv
where xtn in (1,18)
GROUP BY ID,MCC,XTN
ORDER BY ID ,mcc,XTN
It depends on your data and your requirements.
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
Without that information, it's unclear what you want. It sounds like a HAVING clause would be a good solution; maybe you want 2 separate conditions in the HAVING clause, each using COUNT. -
How do I make a batch file if the .class file uses a foreign package?
I am trying to make an MS-DOS batch file using the bytecode file from the Java source file, called AddFields.java. This program uses the package BreezySwing; which is not standard with the JDK. I had to download it seperately. I will come back to this batch file later.
But first, in order to prove the concept, I created a Java file called Soap.java in JCreator. It is a very simple GUI program that uses the javax.swing package; which does come with the JDK. The JDK is currently stored in the following directory: C:\Program Files\Java\jdk1.6.0_07. I have the PATH environment variable set to the 'bin' folder of the JDK. I believe that it is important that this variable stay this way because C:\Program Files\Java\jdk1.6.0_07\bin is where the file 'java.exe' and 'javac.exe' are stored. Here is my batch file so far for Soap:
@echo off
cd \acorn
set path=C:\Program Files\Java\jdk1.6.0_07\bin
set classpath=.
java Soap
pause
Before I ran this file, I compiled Soap.java in my IDE and then ran it successfully. Then I moved the .class file to the directory C:\acorn. I put NOTHING ELSE in this folder. then I told the computer where to find the file 'java.exe' which I know is needed for execution of the .class file. I put the above text in Notepad and then saved it as Soap.bat onto my desktop. When I double click on it, the command prompt comes up in a little green box for a few seconds, and then the GUI opens and says "It Works!". Now that I know the concept of batch files, I tried creating another one that used the BreezySwing package.
After I installed my JDK, I installed BreezySwing and TerminalIO which are two foreign packages that make building code much easier. I downloaded the .zip file from Lambert and Osborne called BreezySwingAndTerminalIO.zip. I extracted the files to the 'bin' folder of my JDK. Once I did this, and set the PATH environment variable to the 'bin' folder of my JDK, all BreezySwing and TerminalIO programs that I made worked. Now I wanted to make a batch file from the program AddFields.java. It is a GUI program that imports two packages, the traditional GUI javax.swing package and the foreign package BreezySwing. The user enters two numbers in two DoubleField objects and then selects one of four buttons; one for each arithmetic operation (add, subtract, multiply, or divide). Then the program displays the solution in a third DoubleField object. This program both compiles and runs successfully in JCreator. So, next I moved the .class file from the MyProjects folder that JCreator uses to C:\acorn. I put nothing else in this folder. The file Soap.class was still in there, but I did not think it would matter. Then I created the batch file:
@echo off
cd \acorn
set path=C:\Program Files\Java\jdk1.6.0_07\bin
set classpath=.
java AddFields
pause
As you can see, it is exactly the same as the one for Soap. I made this file in Notepad and called it AddFields.bat. Upon double clicking on the file, I got this error message from command prompt:
Exception in thread "main" java.lang.NoClassDefFoundError: BreezySwing/GBFrame
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Caused by: java.lang.ClassNotFoundException: BreezySwing.GBFrame
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 12 more
Press any key to continue . . .
I know that most of this makes no sense; but that it only means that it cannot find the class BreezySwing or GBFrame (which AddFields extends). Notice, however that it does not give an error for javax.swing. If I change the "set path..." command to anything other than the 'bin' folder of my JDK, I get this error:
'java' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
I know this means that the computer cannot find the file 'java.exe' which I believe holds all of the java.x.y.z style packages (native packages); but not BreezySwing or any other foreign packages. Remember, I do not get this error for any of the native Java packages. I decided to compare the java.x.y.z packages with BreezySwing:
I see that all of the native packages are not actually visible in the JDK's bin folder. I think that they are all stored in one of the .exe files in there because there are no .class files in the JDK's bin folder.
However, BreezySwing is different, there is no such file called "BreezySwing.exe"; there are just about 20 .class files all with names like "GBFrame.class", and "GBActionListener.class". As a last effort, I moved all of these .class files directly into the bin folder (they were originally in a seperate folder called BreezySwingAndTerminalIO). This did nothing; even with all of the files in the same folder as java.exe.
So my question is: What do I need to do to get the BreezySwing package recognized on my computer? Is there possibly a download for a file called "BreezySwing.exe" somewhere that would be similar to "java.exe" and contain all of the BreezySwing packages?There is a lot of detail in your posts. I won't properly quote everything you put (too laborious). Instead I'll just put your words inside quotes (").
"..there are some things about the interface that I do not like."
Like +what?+ This is not a help desk, and I would appreciate you participating in this discussion by providing details of what it is about the 'interface' of webstart that you 'do not like'. They are probably misunderstandings on your part.
"Some of the .jar files I made were so dangerously corrupt, that I had to restart my computer before I could delete them."
Corrupt?! I have never once had the Java tools produce a corrupt Jar. OTOH, the 'cannot delete' problem might relate to the JRE gaining a file lock on the archive at run-time. If the file lock persisted after ending the app., it suggests that the JRE was not properly shut down. This is a bug in the code and should be fixed. Deploying as .class files will only 'hide' the problem (from casual inspection - though the Task Manager should show the orphaned 'java' process).
"I then turned to batch files for their simple structure and portability (I managed to successfully transport a java.util containing batch file from my computer to another). This was what I did:
- I created a folder called Task
- Then I copied three things into this folder: 1. The file "java.exe" from my JDK. 2. The program's .class file (Count.class). and 3. The original batch file.
- Then I moved the folder from a removable disk to the second computer's C drive (C:\Task).
- Last, I changed the code in the batch file...:"
That is the +funniest+ thing I've heard on the forums in the last 72 hours. You say that is easy?! Some points.
- editing batch files is not scalable to 100+ machines, let alone 10000+.
- The fact that Java worked on the target machine was because it was +already installed.+ Dragging the 'java.exe' onto a Windows PC which has no Java will not magically make it 'Java enabled'.
And speaking of Java on the client machine. Webstart has in-built mechanisms to ensure that the end user has the minimum required Java version to run the app. - we can also use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] on the original web page, to check for minimum Java before it puts the link to download/install the app. - if the user does not have the required Java, the script should guide them through installing it.
Those nice features in deployJava.js are available to applets and apps. launched using webstart, but they are not available for (plain) Jar's or loose class files. So if 'ensuring the user has Java' is one of the requirements for your launch, you are barking up the wrong tree by deploying loose class files.
Note also that if you abandon webstart, but have your app. set up to work from a Jar, the installation process would be similar to above (though it would not need a .bat file, or editing it). This basic strategy is one way that I provide [Appleteer (as a downloadable ZIP archive)|http://pscode.org/appleteer/#download]. Though I side-step your part 1 by putting the stuff into a Jar with the path Appleteer/ - when the user expands the ZIP, the parts of the app. are already in the Appleteer directory.
Appleteer is also provided as a webstart launched application (and as an applet). Either of those are 'easier' to use than the downloadable ZIP, but I thought I would provide it in case the end user wants to save it to disk and transport the app. to a machine with no internet connection, but with Java (why they would be testing applets on a PC with no internet connection, I am not sure - but the option is there).
"I know that .jar and .exe files are out because I always get errors and I do not like their interfaces. "
What on earth are you talking about? Once the app. is on-screen, the end user would not be able to distinguish between
1) A Jar launched using a manifest.
2) A Jar launched using webstart.
3) Loose class files.
Your fixation on .bat files sounds much like the adage that 'If the only tool you have is a hammer, every job starts to look like a nail'.
Get over them, will you? +Using .bat files is not a practical way to provide a Java app. to the end user+ (and launching an app. from a .bat looks quite crappy and 'second hand' to +this+ user).
Edit 1:
The instructions for running Appleteer as a Jar are further up the page, in the [Running Appleteer: Application|http://pscode.org/appleteer/#application] section.
Edited by: AndrewThompson64 on May 19, 2009 12:06 PM -
Word Frequency Counter...
Hello all, I am working on a project that is supposed to read in a text file from a command prompt, and then break all the words up. As the words are read in by the Scanner, I need to have a counter that counts the number of times the word has occured already that I can access and display in the output. I have come up with this so far as my driver/main class, and also the Count class that I'm trying to use to keep track of the number of times a word has occured in the text, and then so I can add it to a HashMap and display later... The problem is, whenever I try to run the program with a text file, it just ends up displaying all the words in a line and then a number 1 next to it. What I need is the output to look similar to this... For example,
hello 1
world 1
Any help would be appreciated! Thanks.
import java.io.*;
import java.util.*;
public class Driver{
public static void main(String[] args){
HashMap words = new HashMap();
String nameOfFile = args[0];
File file = new File(nameOfFile);
String wordd;
Count count;
try{
Scanner scanner = new Scanner(file).useDelimiter(" \t\n\r\f.,<>\"\'=/");
while(scanner.hasNext())
String word = scanner.next();
count = (Count) words.get(word);
if(count==null){
words.put(word, new Count(word, 1));
else {
count.i++;
System.out.println(word);
catch(FileNotFoundException e){
Set set = words.entrySet();
Iterator iter = set.iterator();
while(iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
wordd = (String) entry.getKey();
count = (Count) entry.getValue();
System.out.println(wordd +
(wordd.length() < 8 ? "\t\t" : "\t") +
count.i);
{code}
{code}
public class Count
String word;
int i;
public Count(String inputWord, int increment)
word = inputWord;
i = increment;
{code}
Edited by: VisualAssassin on Apr 22, 2009 2:45 PMVisualAssassin wrote:
Scanner scanner = new Scanner(file).useDelimiter(" \t\n\r\f.,<>\"\'=/");
{code}According to the documentation for Scanner.useDelimiter(), the String supplied is used as a regular expression. Therefore, for the scanner to tokenize into two separate tokens, your input stream would have to contain all of those listed characters in order!
Instead, use this (untested):
{code}
Scanner scanner = new Scanner(file).useDelimiter("[" + Pattern.quote(" \t\n\r\f.,<>\"\'=/") + "]+");
The beginning and end square braces tell the regular expression engine to match +any+ of those characters, and the plus means one or more times. The Pattern.quote is used to escape some of the characters that would get you into trouble because they have a special meaning in regexes, notably "."
Edited by: endasil on 22-Apr-2009 11:43 PM -
How to get total number of result count for particular key on cluster
Hi-
My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer.
To get subset of record i'm using IndexAwarefilter and returning only limited set each individual node. though i get total number of records present on the individual node, it is not possible to return this count to client form IndexAwarefilter (filter return only Binary set).
Is there anyway i can get this number (total result size) on client side without returning whole chunk of data?
Thanks in advance.
Prashantuser11100190 wrote:
Hi,
Thanks for suggesting a soultion, it works well.
But apart from the count (cardinality), the client also expects the actual results. In this case, it seems that the filter will be executed twice (once for counting, then once again for generating actual resultset)
Actually, we need to perform the paging. In order to achieve paging in efficient manner we need that filter returns only the PAGESIZE records and it also returns the total 'count' that meets the criteria.
If you want to do paging, you can use the LimitFilter class.
If you want to have paging AND total number of results, then at the moment you have to use two passes if you want to use out-of-the-box features because LimitFilter does not return the total number of results (which by the way may change between two page retrieval).
What we currently do is, the filter puts the total count in a static variable and but returns only the first N records. The aggregator then clubs these info into a single list and returns to the client. (The List returned by aggregator contains a special entry representing the count).
This is not really a good idea because if you have more than one user doing this operation then you will have problems storing more than one values in a single static variable and you used a cache service with a thread-pool (thread-count set to larger than one).
We assume that the aggregator will execute immediately after the filter on the same node, this way aggregator will always read the count set by the filter.
You can't assume this if you have multiple client threads doing the same kind of filtering operation and you have a thread-pool configured for the cache service.
Please tell us if our approach will always work, and whether it will be efficient as compared to using Count class which requires executing filter twice.
No it won't if you used a thread-pool. Also, it might happen that Coherence will execute the filtering and the aggregation from the same client thread multiple times on the same node if some partitions were newly moved to the node which already executed the filtering+aggregation once. I don't know anything which would even prevent this being executed on a separate thread concurrently.
The following solution may be working, but I can't fully recommend it as it may leak memory depending on how exactly the filtering and aggregation is implemented (if it is possible that a filtering pass is done but the corresponding aggregation is not executed on the node because of some partitions moved away).
At sending the cache.aggregate(Filter, EntryAggregator) call you should specify a unique key for each such filtering operation to both the filter and the aggregator.
On the storage node you should have a static HashMap.
The filter should do the following two steps while being synchronized on the HashMap.
1. Ensure that a ConcurrentLinkedQueue object exists in a HashMap keyed by that unique key, and
2. Enqueue the total number count you want to pass to the aggregator into that queue.
The parallel aggregator should do the following two steps while being synchronized on the HashMap.
1. Dequeue a single element from the queue, and return it as a partial total count.
2. If the queue is now empty, then remove it from the HashMap.
The parallel aggregator should return the popped number as a partial total count as part of the partial result.
The client side of the parallel aware aggregator should sum the total counts in the partial result.
Since the enqueueing and dequeueing may be interleaved from multiple threads, it may be possible that the partial total count returned in a result does not correspond to the data in the partial result, so you should not base anything on that assumption.
Once again, that approach may leak memory based on how Coherence is internally implemented, so I can't recommend this approach but it may work.
Another thought is that since returning entire cached values from an aggregation is more expensive than filtering (you have to deserialize and reserialize objects), you may still be better off by running a separate count and filter pass from the client, since for that you may not need to deserialize entries at all, so the cost on the server may be lower.
Best regards,
Robert -
How to access a class file outside the package?
created a two java files Counter.java and TestCounter.java as shown below:
public class Counter
public void print()
System.out.println("counter");
package foo;
public class TestCounter
public static void main(String args[])
Counter c = new Counter();
c.print();
Both these files are stored under "D:\Test". I first compiled Counter.java and got Counter.class which resides in folder "D:\Test"
when i compile TestCounter.java i got the following error message:
D:\Test>javac -classpath "d:\Test" -d "d:\Test" TestCounter.java
TestCounter.java:6: cannot find symbol
symbol : class Counter
location: class foo.TestCounter
Counter c = new Counter();
^
TestCounter.java:6: cannot find symbol
symbol : class Counter
location: class foo.TestCounter
Counter c = new Counter();
^
2 errors
what could be the problem. Is it possible to access a class file outside the package?ya that's fine..if we have two java files where both resides in the same package works fine or two java files which donot have a package statement also works fine. But my doubt is, i have a Counter.class which does not reside in a package and i have a TestCounter.class which resides in a package "foo", in such a scenario, how do i tell to the compiler that "Counter.class resides in such a path, please look at that and give me TestCounter.class". i cannot use import statement to import Counter.class in TestCounter.java because i donot have a package for Counter.java.
-
How to access variables from other class
public boolean inIn(Person p)
if (name == p.name && natInsceNo == p.natInsceNo && dateOfBirth == p.dateOfBirth)
return true;
else
return false;
}//returns true if Person with same name/natInsceNo/dateOfBirth as phello,
here am trying to compare the existing object with another object.
could you please tell me how to access the variables of other class because i meet this error?
name cannot be resolved!
thank you!public class Person
protected String name;
protected char gender; //protected attributes are visible in the subclass
protected int dateOfBirth;
protected String address;
protected String natInsceNo;
protected String phoneNo;
protected static int counter;//class variable
//Constractor Starts, (returns a new object, may set an object's initial state)
public Person(String nme,String addr, char sex, int howOld, String ins,String phone)
dateOfBirth = howOld;
gender = sex;
name = nme;
address = addr;
natInsceNo = ins;
phoneNo = phone;
counter++;
public class Store
//Declaration of variables
private Person[] list;
private int count;
private int maxSize;
//constructor starts
public Store(int max)
list = new Person[max];//size array with parameters
maxSize = max;
count = 0;
}//end of store
//constructor ends
//accessor starts
public boolean inIn(Person p)
return (name == p.name && address == p.address && natInsceNo == p.natInsceNo);
}//returns true if Person with same name/natInsceNo/dateOfBirth as phope it helps now! -
Count MySQL rows based off Value in Dynamic Table
Greetings all. I have 2 MySQL tables; 1 that contains the names of my classes.(Class A, Class, B, etc.) and 1 table that contains the names of students in each Class (for example Class A: John Doe; Class A: Susie Smith.; Class B: Jane Doe). In the 2nd table the Class name is in its own column and the student's name is in a 2nd column.
I currently have a dynamic repeating table that lists the names of all of the classes from the 1st table. What I'm trying to do is add a second column to this repeating dynamic table that lists the number of students in each class. For example; Row 1 of the dynamic table would say "Class A | 5; Class B | 3; Class C | 7, etc.). The dynamic table works perfectly to list the class names. For the life of me I can't figure out how to perform a count for each class to insert in the repeating table. I will be adding more Classes which as why I'm trying to set up the counting query dynamically. So far I have only been able to figure out how to count the total rows in the 2nd table, or count the rows with a specified class name. Any advice or guidance on how to count the number of rows in the 2nd MySQL table based off the class name in the repeating table is much appreciated. Thank you for any and all help. Have a great day.Select count(*), Class from MyTable
Group by Class
Time to learn about SQL:
http://www.w3schools.com/sql/sql_intro.asp -
Memory leak within FOProcessor class
Hi all,
I'm trying to use the XML Publisher API (5.6.2 and 5.6.3) to generate PDF documents from XSL templates and XML data in a J2EE environment (Jboss 4.0.5) with Struts but a memory leak occurs.
It seems not to be a multithreading issue because the leak is there even if the PDF documents are generated one by one.
I made many tests to isolate the leak and I have simplified my code as much as possible: it seems to happen within the FOProcessor class.
One of the tests generates 4,500 PDF documents (one at a time) from an XML file (3 KB) and an XSL file (74 KB with blanks). Nothing else is done with the Jboss server during this test. The XSL file was created before the test from a RTF file with XML Publisher. The memory leak is around 70 KB for each PDF document (around 300 MB for the whole test).
As you can see below from the heap histogram (taken at end of test after a full garbage collection) it seems that the XSL and XML elements/attributes are not released (and thus never garbage collected).
Did I miss something or is there an actual problem with the XML/XSL parsing within the XML Publisher API?
Thanks for your help.Object Histogram:
Size Count Class description
131376968 2353450 java.lang.Object[]
60389464 937300 char[]
48260304 335141 oracle.xml.parser.v2.XSLResultElement
35690000 2230625 oracle.xml.util.FastVector
24127104 1005296 java.lang.String
16539120 413478 oracle.xml.parser.v2.XSLNode$AttrValueTmpl
14757064 128058 int[]
13348768 417149 java.lang.ref.Finalizer
12701776 102220 * ConstMethodKlass
12544808 23433 byte[]
12204080 108965 oracle.xml.parser.v2.XSLText
8344600 86584 java.util.Hashtable$Entry[]
7363768 102220 * MethodKlass
5592784 138700 * SymbolKlass
5362256 335141 oracle.xml.parser.v2.XSLAttributeSet[]
5267336 8135 * ConstantPoolKlass
5234016 163563 java.util.TreeMap$Entry
5121744 213406 java.util.Hashtable$Entry
4900480 61256 oracle.xml.parser.v2.XPathStep
4087120 51089 java.lang.reflect.Method
3823216 40276 java.util.HashMap$Entry[]
3524696 8135 * InstanceKlassKlass
3378000 84450 java.util.Hashtable
3064872 127703 java.util.HashMap$Entry
2971904 6880 * ConstantPoolCacheKlass
2968560 26505 oracle.xml.parser.v2.XSLValueOf
2770656 24738 oracle.xml.parser.v2.XSLVariable
2167520 27094 oracle.xml.parser.v2.XPathFunctionCall
1880088 33573 oracle.xml.parser.v2.PathExpr
1726360 61482 java.lang.String[]
1573720 39343 java.util.HashMap
1476576 30762 oracle.xml.parser.v2.XSLExprValue
1460840 36521 java.util.TreeMap
1319360 23560 oracle.xml.parser.v2.XPathConstantExpr
1054976 16484 org.jboss.mx.server.InvocationContext
1001264 3546 * MethodDataKlass
887424 11049 short[]
835680 8705 java.lang.Class
830208 25944 oracle.xml.util.NSNameImpl
705816 29409 java.util.ArrayList
684152 4501 org.jboss.web.tomcat.tc5.session.SessionBasedClusteredSession
670288 14071 java.lang.Object[]
640832 10013 oracle.xml.parser.v2.XPathVarReference
561056 35066 javax.management.modelmbean.DescriptorSupport
556272 23178 EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap$Entry
552984 30451 java.lang.Class[]
494760 2945 oracle.xml.parser.v2.XSLTemplate
480792 20033 antlr.ANTLRHashString
442576 27661 java.lang.Integer
432096 4501 org.jboss.web.tomcat.statistics.ReplicationStatistics$TimeStatistic
429040 10726 org.hibernate.hql.ast.tree.Node
369880 9247 javax.management.modelmbean.ModelMBeanOperationInfo
312384 19524 java.util.TreeMap$3
305368 5453 java.net.URL
287392 8981 org.jboss.mx.interceptor.ReflectedDispatcher
259264 338 EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap$Entry[]
252280 4505 org.jboss.cache.lock.ReadWriteLockWithUpgrade
238600 5965 org.jboss.mx.interceptor.PersistenceInterceptor
238600 5965 org.jboss.mx.interceptor.AttributeDispatcher
236616 9859 org.jboss.mx.server.AbstractMBeanInvoker$OperationKey
219776 3434 java.lang.reflect.Constructor
206880 6465 javax.management.modelmbean.ModelMBeanAttributeInfo
193168 2259 java.lang.reflect.Method[]
173184 5412 java.lang.ref.SoftReference
164920 589 oracle.xml.parser.v2.XSLStylesheet
164464 541 * ObjArrayKlassKlass
152832 6368 org.dom4j.tree.DefaultAttribute
149472 2076 java.lang.reflect.Field
144160 4505 org.jboss.cache.Node
143160 5965 org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor
140600 3515 org.apache.xerces.dom.DeferredTextImpl
140224 2740 javax.management.modelmbean.ModelMBeanAttributeInfo[]
139056 7658 boolean[]
134664 3359 java.lang.String[][]
131936 1178 oracle.xml.parser.v2.XSLCondition
131936 1178 oracle.xml.parser.v2.XSLForEach
129072 2668 javax.management.modelmbean.ModelMBeanOperationInfo[]
128952 5373 EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap$Entry
124776 1733 org.hibernate.hql.ast.tree.IdentNode
115200 1800 javax.management.modelmbean.ModelMBeanInfoSupport
113088 2356 oracle.xml.parser.v2.AdditiveExpr
109416 4559 java.beans.PropertyChangeSupport
108960 1135 java.io.ObjectStreamClass
108120 4505 org.jboss.cache.lock.IdentityLock
105864 345 long[]
98752 3086 java.io.ObjectStreamClass$WeakClassKey
97968 4082 java.util.Vector
96672 2014 java.util.Properties
94240 589 oracle.xml.parser.v2.XSLOutput
90072 3753 javax.management.ObjectName$Property
87432 3643 javax.management.MBeanParameterInfo
82368 858 org.hibernate.hql.ast.tree.DotNode
81248 5078 java.lang.Long
78656 1229 org.hibernate.mapping.Column
77664 4854 java.util.Collections$SynchronizedSet
77448 3227 java.util.LinkedList$Entry
73824 769 org.jboss.mx.modelmbean.XMBean
73536 4596 java.util.Hashtable$KeySet
72144 4509 EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet
72144 4509 EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList
72144 4509 org.jboss.cache.Fqn
72080 4505 org.jboss.cache.lock.ReadWriteLockWithUpgrade$WriterLock
72080 4505 org.jboss.cache.lock.LockStrategyRepeatableRead
72080 4505 org.jboss.cache.lock.ReadWriteLockWithUpgrade$ReaderLock
72080 4505 org.jboss.cache.lock.LockMap
72016 4501 org.apache.catalina.session.StandardSessionFacade
71776 4486 java.io.FileDescriptor
70680 589 oracle.xml.parser.v2.XSLCallTemplate
70680 589 oracle.xml.parser.v2.XSLApplyTemplates
70224 154 org.hibernate.persister.entity.SingleTableEntityPersister
68296 2774 javax.management.ObjectName$Property[]
68160 1065 org.apache.xerces.dom.DeferredElementNSImpl
67760 770 org.hibernate.loader.entity.EntityLoader
66992 19 EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap$Entry[]
65968 1178 oracle.xml.parser.v2.XPathFilterExpr
65968 589 oracle.xml.parser.v2.XMLUTF8Reader
64432 4027 java.util.HashSet
63648 1326 oracle.xml.parser.v2.XMLNode[]
63440 1586 org.hibernate.loader.DefaultEntityAliases
61256 589 oracle.xml.parser.v2.XSLNode
61256 589 oracle.xml.parser.v2.XMLReader
60816 2534 org.apache.xerces.xni.QName
57360 478 org.hibernate.hql.ast.tree.FromElement
56976 1187 org.hibernate.mapping.Property
56544 1178 oracle.xml.parser.v2.XSLNodeSetExpr
56544 1178 oracle.xml.parser.v2.MultiplicativeExpr
56544 1178 oracle.xml.parser.v2.EqualExpr
54384 618 oracle.xml.parser.v2.XMLError
49392 2783 javax.management.MBeanParameterInfo[]
47648 1489 java.util.LinkedHashMap$Entry
47120 589 oracle.xml.parser.v2.XMLByteReader[]
... -
To use my class files in my applications
Hi all!
public class Count
private int serialNumber;
private static int counter=0;
public static int getTotalCount()
return counter;
public Count()
counter++;
serialNumber=counter;
public class TestCounter
public static void main(String args[])
System.out.println("Number of counter is " +Count.getTotalCount());
Count c1=new Count();
System.out.println("Number of counter is " +Count.getTotalCount());
As you see above i want to use my count class in the TestCounter class but i cant compile it.It says i cant find the count class.How can i use count class in my TestCounter class.
I try to make a package.So i put the counter class to a new package and import it by this package name in the TestCounter but i says there is no class in import.How can i make a package that i can import in my other applications.Sorry, I somehow got the impression that you could compile but not run...
You must be making a small, irritating, frustrating mistake somewhere since the settings you desrcribe are correct.
The code for the Count class is in c:\java\Count.java?
The code for the TestCount class is in c:\java\TestCount.java?
Can you compile Count with:
c:\java>javac Count.java
And after that TestCount with
c:\java>javac TestCount.java
If not, what is the exact error message (with line numbers and stuff) you get?What if you try compiling with
c:\java>javac *.java
Or "javac -classpath . *.java"?
You are using a 1.2+ jdk, right? Not those 1.1 ones? As the 1.1 jdks require some extra setting in the classpath - the compiler may not be finding the superclass of Count, java.lang.Object, and then saying it can't find Count... older jdks have a 'feature' like that.
Let's hope this will shed some light on the problem... -
Perform Full Cycle Count - No Data Found
I am trying to initialize a full cycle count for all items in a subinventory. I have a recent ABC compile set and a new cycle count setup. A, B, C and D classes are all set to count 1x per year. I have verified that all items from the compile are no in the cycle count. I submitted a "Cycle Count Scheduler" request and ensured that it completed. I then set all the parameters in the "Perform Full Cycle Count" request and set to save to file. After it completes and I view the output, the file says "No data found". My only recourse is to dump all items from Material workbench and use Data Load to enter them in ( a bit tedious for 900+ items). Is there anything I need to be doing different?
You mention that you have done the ABC setups.
But in Cycle count setups, have you defined a cycle count schedule?
And more importantly, in cycle count classes, have you entered the frequency at which each class should be counted?
Last but not the least, what is the last count date (on the serial and schedule tab)?
If it is today, you will have to wait till tomorrow.
Hope this helps,
Sandeep Gandhi -
How can I call a nonstatic class
Hello All,
I've wrote a simple bean for my testcase that count a value (e.g. site access):
public class Bean1 {
private int accessCount = 1;
public int getAccessCount() {
return (accessCount++);
If I call the bean with a jsp-site, it works fine with different scope. e.g. session and application.
With session scope different browser count different. With application scope different bowser count together. Thats the normal attitude.
My jsp code:
<jsp:useBean id="counter" class="ml.view.Bean1" scope="session" />
<jsp:getProperty name="counter" property="accessCount" />
This don't work with a static bean (normal too), but I can only call a static class in my UIX site.
I call the bean from uix with the invoke element. Is that correct? How can I call a nonstatic class with a special scope? Which other solution ist possible?
My uix code:
<invoke method="getAccessCount" result="${uix.eventResult.getAccessCount}" instance="${sessionScope.myBean.getAccessCount}" exception="${uix.eventResult.error}" javaType="ml.view.myBean"/>
Thank you for any solution!
The error messages are:
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java)
at oracle.cabo.servlet.event.InvokeEventHandler._invoke(Unknown Source)
at
and so forth...false in my uix code example: javaType="ml.view.myBean"
correct: javaType="ml.view.Bean1"
Sorry :-) that was only an error in my post not in the really example.
Maybe you are looking for
-
How do I import video from sony handycam
how do I import video from sony handycam?
-
To install oracle 9i on Suse 10
Hi, I want to install oracle 9i on Suse 10. Can i install? Do i need download any patches?(What are patches?) I dont have cd's also. So what should i do? Regards, Chaitra
-
Dear Friends: I want the change the report from vertical print to horizontal print. How should I do for that? Pls kindly help, thanks...
-
Not all the time, but very frequently when I close a tab it stays open in the background(if it is a video, I can hear it still playing) When I exit out of the browser completely it keeps running in the background. It appears to be closed. When I try
-
Double-clicking an album no longer begins playback
Prior to this release of iTunes, double-clicking an album cover in album view would initiate playback of the entire album, queuing the all songs in "Up Next." This seems to be broken in 12.1, and clicking the "Play" symbol when the album is expanded