| Eclipse _mthclass$ problem |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- Question about string pattern matchingRoedy,
Roedy Green wrote:
>On Mon, 09 Jan 2006 21:40:00 -0600, Alan Krueger
><email***@***.com> wrote, quoted or indirectly quoted someone
>who said :
>
>>If you insist on writing this yourself, study finite automata and
>>regular languages. Build a tool that translates regular expressions
>>into non-deterministic finite automata (NFAs) then transforms those into
>>optimized deterministic finite automata (DFAs). Make it so these are
>>compiled into Java source or bytecode directly for speed.
>
>or use a generated parser. See http://mindprod.com/jgloss/parser.html
>
>Also see http://mindprod.com/jgloss/finitestate.html
The resources are very useful!
regards,
George
--
Message posted via http://www.javakb.com
- 5
- benchmarks? java vs .net (binarytrees)On Sat, 7 Jun 2008 17:44:18 -0700 (PDT), kwikius
<email***@***.com> wrote:
>Java, .NET starts out slow buddy.. King Twat, Mr Skeet, Mr Harrop and
>you shoved a lot of time, figuring out what we already know for last
>10 years. Your only option... you turn off GC. Fucking unacceptable
>for any multi user system. Only way to get any sort of performance out
>of GC system is to hog the system.
>
>Have a nice fuckin' day.
>
>Oh and Fuck Off Ratboy..
lol ...
I added the C++ group back. If you are going to troll, keep all the
groups on the list.
Or are you ashamed?
- 5
- endeavorsYou should all JUMP UP AND DOWN for TWO HOURS while I decide on a NEW
CAREER!!
- 5
- updating value in all sessionHi, I am a little stumped on this one, and I was hoping someone else
out there ran into and solved this problem. Using a J2EE servlet
container every client (browser) will acquire a session and certain
values will be stored in this session. However, if a certain
parameter is changed it should invoke a method in one of the beans in
the session, which all sessions will have. This sounds like more like
a type of event handler, but I am not aware of any non-gui event
listeners. Any ideas?
Regards,
Brian
- 5
- GridBagLayout on JDesktopHi,
I have problems using GridBagLayout for positioning JInternalFrames on a
JDesktop.
For instance, I have 2 JInternalFrames and I neither set the size nor the
preferedSize of the InternalFrame because I thought my JInternalFrames would
get the size from the GridBagLayout-manager but it doesn't work at all.
[...]
desktop = new JDesktopPane();
gbl = new GridBagLayout();
desktop.setLayout(gbl);
content.add(desktop);
[...]
GridBagConstraints gbc1 = makegbc(0, 0, 1, 5);
gbl.setConstraints(treeIFrame, gbc1);
desktop.add(treeIFrame);
GridBagConstraints gbc2 = makegbc(1, 0, 4, 1);
gbl.setConstraints(tableIFrame,gbc2);
desktop.add(tableIFrame);
[...]
the makegbc is nothing more than:
private GridBagConstraints makegbc(int x, int y, int width, int height)
{
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = x;
gbc.gridy = y;
gbc.gridwidth = width;
gbc.gridheight = height;
gbc.insets = new Insets(1, 1, 1, 1);
return gbc;
}
Can anyone give me some hints?
Thx in advance
Thomas Pototschnig
- 6
- How to gray out the files in JFileChooser?I only let user select the directories,
not let user select the files.
So I
myFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
That is fine, but user complain about that, they want to
make sure there are files under the directory.
If I do
myFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
Then user will mistake select a file, which I don't let them select a
file. I need to popup a dialog says "Please select a directory only".
The idea thing is I can gray out the file names, so user can see
there are files under a directory, but they can't select any file,
only can select a directory.
Anyone out there has any idea how to gray out the file names in
JFileChooser?
Thank Q!
- 8
- 8
- Genercis adviceHello!
i've just read some docs about generics in Java, and i would like to do
a complete Canvas class. Here is my attempt:
import java.util.LinkedList;
import java.util.List;
public class Canvas {
private List<Shape> shapeList = null;
class Shape {
public void draw() {
}
}
class SubShape extends Shape {
public void draw() {
}
}
public Canvas() {
shapeList = new LinkedList<Shape>();
add(new SubShape());
drawAll();
}
public void drawAll() {
// TEH UGLYNESS !!!
List<? extends Shape> shapeList = this.shapeList;
for (Shape s:shapeList)
s.draw();
}
public void add(Shape s) {
shapeList.add(s);
}
}
From what i've understood:
- unbounded is for writing
- bounded is for reading
So basically, i have to use temporaries or i have to do a
"drawAll(bounded version)" wich is even worse.
I really hope i've missed something because i think this stink.
Any advice/explaination apreciated :)
- 8
- Calling constructor inside another constructorHello, I have a problem calling a constructor inside another
constructor, consider this code:
class Point
{
private final int Y_DEFAULT = 3;
private final int Z_DEFAULT = 5;
private int x,y,z;
Point(int x)
{
this(x,Y_DEFAULT,Z_DEFAULT);
}
Point(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
I get these errors whe I try to compile the code above:
cannot reference Y_DEFAULT before supertype constructor has been called
cannot reference Z_DEFAULT before supertype constructor has been called
Does anybody know why this happens?
TIA
- 8
- specifying import, is there a difference in memory usage?
Does it matter if you say
import java.awt.*
or
import java.awt.<the exact file you want>
I am used to specifying the wild card and was wondering if I am using
more memory at run time than I need to or if it doesn't matter as the
compiler takes care of it. Any other reasons for using ones way over
the other?
Thanks in advance,
Russell
- 9
- Write formatted XML to a fileHi,
I create the XML with DOM and save it to a file. But when I open such
file with Notepad, for instance, I see the XML file in one line - it
is not formatted/aligned. If I open it with IExplorer it looks fine.
I am looking for the way to save XML to a file so that XML would be
formatted.
The save code:
-------------------
doc.getDocumentElement().normalize();
DOMSource ds = new DOMSource(doc);
StreamResult sr = new StreamResult(out);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer trans = tf.newTransformer();
trans.transform(ds, sr);
Thanks,
Pavel
- 10
- Root Object == OO !?! [Was: Re: My strange service with an error]Lew wrote:
> (I've read a definition that a language that enforces a single Object root
> type is "object-oriented", whereas a language like C++ that allows root
> types other than Object is "object-supporting".)
You do seem to have a talent for finding the most astounding drivel ;-) Where
did you find that particular crock of moonshine ?
-- chris
(P.S. I don't at all dispute that C++ is better described as "supporting OO"
than as being an OO language -- but that's nothing at all to do with its lack
of a single root class.)
- 12
- cerat warI use jbuider 4 and I made a web application project. But I don't know how I
can get a war file from my project. Can somebody help me?
- 14
- Error loading SolarisSerialHello
I tried running the examples on the following link on windows XP and
2000.
http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html
Are those programs specific to solaris? Will they work on windows?
I get the following errors when i tried to run the programs:
E:\project\ckt download\Serial_port\trial2\classes>java SimpleWrite
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no
SolarisSerialPar
allel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while
loading driver c
om.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no
SolarisSerialPar
allel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while
loading driver c
om.sun.comm.SolarisDriver
port COM1 not found.
E:\project\ckt download\Serial_port\trial2\classes>java SimpleRead
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no
SolarisSerialPar
allel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while
loading driver c
om.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no
SolarisSerialPar
allel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while
loading driver c
om.sun.comm.SolarisDriver
port COM1 not found.
I get the following errors:
comm.jar is placed in:
%JAVA_HOME%/lib
%JAVA_HOME%/jre/lib/ext
win32com.dll is placed in:
%JAVA_HOME%/bin
%JAVA_HOME%/jre/bin
%windir%System32
javax.comm.properties is placed in:
%JAVA_HOME%/lib
%JAVA_HOME%/jre/lib
Environment variable PATH also points to comm.jar file. Please guide
me as to how I can correct the above errors.
Regards
Quad
- 16
- 64 bit linux on VM to run Java appOn Fri, 20 Jun 2008 15:58:35 GMT, Roedy Green
<email***@***.com> wrote, quoted or indirectly quoted
someone who said :
>
>see http://mindprod.com/bgloss/sixtyfourbit.html
Thanks for all your input in whipping that entry into shape.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
| Author |
Message |
klewta

|
Posted: 2004-1-29 7:04:00 |
Top |
java-programmer, Eclipse _mthclass$ problem
I have an issue with Eclipse not adding a static Class called
_mthclass$ to my compiled class file and when I compile the same
source using Ant with jdk 1.3 or 1.4 it adds this _mthclass$. I read
that Eclipse has its own javac to compile class files and that you
cannot change this. My classes are now incompatible during
Serialization. Has anyone come across a way to get Eclipse to add this
class or a work around?
|
| |
|
| |
 |
Emir Alikadic

|
Posted: 2004-1-31 0:40:00 |
Top |
java-programmer >> Eclipse _mthclass$ problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 28/01/2004 6:03 PM, Monkeyshyne wrote:
> I have an issue with Eclipse not adding a static Class called
> _mthclass$ to my compiled class file and when I compile the same
> source using Ant with jdk 1.3 or 1.4 it adds this _mthclass$. I read
> that Eclipse has its own javac to compile class files and that you
> cannot change this. My classes are now incompatible during
> Serialization. Has anyone come across a way to get Eclipse to add this
> class or a work around?
Eclipse does indeed have its own compiler that is an independent
implementation of the spec. This means that bugs in Sun's implementation may
not necessarily appear in Eclipse and vice versa, as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565 illustrates (Sun's Javac
was triggering a class initialization upon encountering a class literal,
whereas the spec says it shouldn't; Eclipse compiler was following the spec
which caused errors in code that relied on buggy Sun implementation).
One workaround is to make sure you use same compiler on both ends. If you
decide to use Sun's javac, you need to use Ant within Eclipse (right-click on
build.xml in Package Explorer and select Run Ant) which will use javac from
whatever J2SE SDK you have currently selected. Selecting Project -> Build
Project/All in the menu will use the internal Eclipse compiler.
- --
Emir Alikadic
Software Developer
CollectiveBid Systems Inc.
"If you think technology can solve your problems, then you don't understand
your problems and you don't understand technology." [Bruce Schneier]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
iD8DBQFAGojyuSy542G+Z7QRAhHEAJ0ftISBihldJ74ut5Vg9eWAB2WBiwCfTLMU
HxF+G7umGCPzPztMAoQVj6U=
=6x8k
-----END PGP SIGNATURE-----
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- 2
- ServletOutputStream to Browser OK in NS, but not IE??Hi All,
I am replacing a Netscape Application Server appLogic with a servlet.
The servlet is supposed to take a URL and stream the file to the
user's browser. I checked a number of examples from post in this news
group to get examples of how to do this (thanks for the good info).
The servelt works fine in NetScape 7.0 (jpg, pdf, html files open in
the current browser session), but always pops up the file download box
in IE 6. In IE the file is always downloaded and opened. This
happens even for html files. This is a problem, since the appLogic
opens most files in the browser, Word docs get opened in a separate
instance of MS Word. However, the user never sees the download box.
I tried modifiying the web.xml for this servelet to allow adding the
filename to to be appended to the servlet name,
GetContentItem/filename.jpg, but that didn't make any difference. The
content type and filename appear appear in the download dialog.
Here is the servelt code, any suggestions will be appreciated:
public class GetContentItem extends HttpServlet {
// initalise the servlet within init()
private static Log log = LogFactory.getLog(GetContentItem.class);
public void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
if (log.isDebugEnabled())
log.debug("IN " + GetContentItem.class + " doGet" );
String sCRBaseURLRoot =
"http://supporttest1.web.lucent.com:20101/cr/";
String sDocPath = "Live/Product/5ESS/R16/Retrofit_Information/090094058001c628.jpg";
String sDocPath2 =
"Live/Product/5ESS/R16/Release_Information/0900940580026c41/french.pdf";
String sDocPath3 =
"/Live/Product/5ESS/R16/Release_Information/0900940580026cc1/spanish.doc";
String sDocPath4 =
"/Live/Product/5ESS/R16/Release_Information/090094058002791c/61402_Release_Deployment.html";
String filename = "090094058001c628.jpg";
String filename2= "french.pdf";
String filename3= "spanish.doc";
String filename4 = "61402_Release_Deployment.html";
sDocPath=sDocPath4;
filename = filename4;
String sUrl = sCRBaseURLRoot + sDocPath;
java.io.InputStream in=null;
ServletOutputStream stream = null;
try{
URL u = new URL(sUrl);
URLConnection c = u.openConnection();
c.connect();
in = new DataInputStream(c.getInputStream());
String sHeaderField=null;
String sHeaderFieldKey=null;
int i = 1;
stream = response.getOutputStream();
response.setContentType(c.getContentType());
response.setContentLength(c.getContentLength());
response.setHeader("Content-disposition","attachment;filename=\"" +
filename + "\"");
int bytes_read;
int BUFSIZE = 8192;
byte[] buffer = new byte[BUFSIZE];
while((bytes_read=in.read(buffer,0,BUFSIZE))!=-1){
stream.write(buffer,0,bytes_read);
}
} catch(FileNotFoundException e){
log.error("FileNotFoundException accessing document " + sDocPath +
e );
} catch(Exception e){
log.error("Exception accessing document " + sDocPath + e );
} finally{
try{
in.close();
stream.flush();
stream.close();
} catch (Exception e){}
}
}
}
I hope the code display format is not too ugly in the post.
Thanks,
Tom
- 3
- Drag'n'Drop & Using Drag ImagesI have a situation where I want to be able to drag a component (or an image
of one) from one container to another. Using the excellent beginner article
at
http://java.sun.com/products/jfc/tsc/articles/dragndrop/
I have got this working in my own sample; the drag operation begins, and I
can react to the item being dropped.
The sample given uses
DragGestureEvent.startDrag(Cursor dragCursor, Transferable transferable,
DragSourceListener dsl)
This works fine, I get the change in cursor to represent the drag. Now I
want to actually have an image dragged with the cursor / in place of the
cursor (I don't mind which), so I adapted my working sample to instead use
DragGestureEvent.startDrag(Cursor dragCursor, Image dragImage, Point
imageOffset, Transferable transferable, DragSourceListener dsl)
However, there is no change: no image is dragged, it still just changes the
cursor. No exceptions are generated, and the drag still proceeds as normal.
I can see that the Image object (whose reference is being passed) is valid.
I tried a Point of (10, 10) (not sure whether this represents cursor hotspot
offset from image top-left or vice versa, or even something entirely
different) and of (0, 0) instead when that didn't work ( (0, 0) seems safe
in all cases).
I delved into the source code just a little to see if there was anything
obvious, such as the image needing to be of a specific size or format or
something; a cursory glance only shows that the image gets passed down the
line, and there are no comments on whether it should be a special type of
image or just any old image.
So I'm a little stuck. Anyone got any ideas for why it doesn't use the
supplied image? Have I missed a step?
WinXP Pro SP1
Java 1.4.2_03
--
- 4
- Workaround for JDialog memory leak in jdk1.6.0_02?I just submitted a bug report on a memory leak that I discovered in 1.6 (I
tested with 1.5 and there is no memory leak). What I am wondering is if
anyone has encountered this bug and if so if there is any better workaround
which I will describe shortly?
Basically one would first create a JFrame and then have a modal child dialog
(e.g,. PrimaryChildDialog) hanging off of it and then create another modal
child dialog (e.g., SecondardChildDialog) which hangs off the first modal
child dialog. Now one would close/dispose SecondaryChildDialog and then
close/dispose PrimaryChildDialog and then set PrimaryChildDialog to null.
Now if one repeats the above process n times one would see n
PrimaryChildDialog objects occupying memory (i.e.,
PrimaryChildDialog.finalize method never gets called and it is also returned
in the array of Window objects from the Windows.getWindows() method).
For example here is a code snippet for creating/showing and then disposing
PrimaryChildDialog:
public void openPrimaryChildDialog ()
{
fPrimaryChildDialog = new PrimaryChildDialog(getFrame (),
"Primary Child Dialog...", true);
fPrimaryChildDialog.openDialog ();
fPrimaryChildDialog.dispose ();
fPrimaryChildDialog = null;
// Note: there should be a better way of causing Java to IMMEDIATELY
// release the fPrimaryChildDialog resource! ==> Ugh!
getFrame ().dispose ();
Runtime.getRuntime ().runFinalization ();
getFrame ().setVisible (true);
}
In Java 1.5 PrimaryChildDialog's finalize method is correctly called each
time but in 1.6 there are n instances of PrimaryChildDialog and its finalize
method is never called. Oh yes, I got the following cool piece of code to
guarantee that the memory was indeed flushed which I called everytime I
disposed of PrimaryChildDialog:
private void flushMemory(PrintStream pPrintStream)
{
pPrintStream.println ("\nFlush memory begin:");
//Use a vector to hold the memory.
Vector v = new Vector();
int count = 0;
//increment in megabyte chunks initially
int size = 1048576;
//Keep going until we would be requesting
//chunks of 1 byte
while(size > 1)
{
try
{
for (; true ; count++)
{
//request and hold onto more memory
v.addElement( new byte[size] );
}
}
//If we encounter an OutOfMemoryError, keep
//trying to get more memory, but asking for
//chunks half as big.
catch (OutOfMemoryError bounded){size = size/2;}
}
//Now release everything for GC
v = null;
//and ask for a new Vector as a new small object
//to make sure garbage collection kicks in before
//we exit the method.
v = new Vector();
// Let's run gc anyhow...
Runtime.getRuntime ().gc ();
pPrintStream.println ("\nFlush memory end.");
}
The only workaround that I could think of is to minimize the memory impact
by calling the JDialog's getContentPane().removeAll () method as well as any
hard references in the class which I extended so that at least those items
can be garbage collected.
Does anyone have any better workaround and has anyone encountered this
problem?
If anyone is interested I can send the small test case (4 small Java files)
that I just submitted to Sun.
Karl
- 5
- Java support for AMD64 OptionsI am going to be setting up a JSP server and I have ordered a Dell 1850
EMT64 x2 Intel server with 4gigs of ram, if there is no native java
support what other options are there? can I run the 32bit native java
for FreeBSD or how well would the linux java run under load on it?
If I have to I will install regular 32bit FreeBSD on the server but it
would be nice to be able to run the AMD64 port of the OS.
Any comments would be appreciated
> Hi,
> Anyone can tell me what is status of native java port for AMD64 platform?
> Same question should consider eclipse - native java required - so if
> we get native java for AMD64, we should get running all other stuff
> such as eclipse, tomcat, or it's much more problematic?
> I would appreciate any URLs answering this problem, could be private
> if this question isn't in focus now.
>
> Best Regards,
> Lee
> _______________________________________________
> email***@***.com mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-java
> To unsubscribe, send any mail to "email***@***.com"
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 6
- How to add new optional Java packages to Blackberry (Microedition)Hello
I am trying to write some JSR-234 (advanced multimedia supplements) and
JSR-179 (location API) based code. My blackberry's JVM didn't come with
AMMS built-in. Has anyone tried adding additional jars files to
blackberry's default OS and did it work?
Any response will be appreciated.
- 7
- Finding the front-most windowOn Jul 22, 2:39 am, "Andrew Thompson" <u32984@uwe> wrote:
> Twisted wrote:
> >> No. Users of GG are responsible for their choice ...
>
> >What part of "The vast majority of GG users have no alternative news
> >posting option" don't you understand, ...
>
> <http://www.javakb.com/>
>
> There are web based alternatives, but ultimately, the
> problems experienced by users of web interfaces to
> usenet (WITUN) are not, and should not become, the
> problems of group contributors in general.
And how, pray tell, do you suggest that be arranged? If the WITUN
screws up, it screws up and the consequences will affect every
newsgroup. The posters there have no control over that. Did you think
they did?
As for people attempting a posting, and it failing to appear, then
after several hours trying again, that is something that will happen
if a normal NNTP server misbehaves in the same manner as well.
Postings either disappearing or being queued locally for ages before
eventually being posted successfully is by no means a unique problem
of WITUNs. I've seen it at NNTP servers a time or two in the past,
when you could actually find one to use that let you post without
paying extra.
As for this JavaKB, from the name I'm guessing it carries only this
group and maybe other comp.lang.java.* groups, rather than a full
feed, which makes it unuseful to me, since I read plenty of non-Java-
related groups as well.
- 8
- Setting insets for a contentPane?Hi,
I want to add a JPanel that has a border to a JFrame. Here's what I did:
public class Test2 extends JFrame
{
...
public Test2()
{
...
Container con = this.getContentPane();
con.setLayout(new BorderLayout());
JPanel pane = new JPanel();
pane.setBorder(BorderFactory.createEtchedBorder());
con.add(pane);
...
}
}
All is fine but the border of the panel is far too close to the border
of the frame. Is there some way of setting insets for the contentpane? I
saw a getInsets() method for the frame and for the contentpane but I see
nothing that would allow me to set the insets.
Thanks!
- 9
- taking Eclipse for a SpinI downloaded Eclipse. The orientation seems to want to bring up
Internet Explorer rather than my usual Opera.
Anyway it dies with a 500 server error.
IE can't seem to deal with URLs of this form that Eclipse help is
giving it. 127.0.0.1:64019
Opera eats them just fine.
So two questions:
1. What is the matter with IE?
2. Why is Eclipse using IE rather than my default browser?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
- 10
- Contructor bad practices----WAS: Re: Can someone use invokeLater()...Alex Hunsley coughed up:
...[rip]...
>> Overly strict. I cannot /count/ the number of times I've seen
>> horribly convoluted code set out to avoid putting nearly /anything/
>> into a constructor.
>
> "Constructors should *not* call non-final or
> non-private methods" is not overly strict
STOP RIGHT THERE.
You meant: should *not* call non-final or non-private methods of that same
object? Sorry, I misunderstood your intent.
Then I totally agree.
Here's something else I see *all the time*: (pseudo-java, ignore scoping
rules):
class A
{
A() { helper(); }
helper() {....};
}
class B extends A
{
helper() {....}; // dangerous: overridden
}
...[rip]...
--
Framsticks. 3D Artificial Life evolution. You can see the creatures
that evolve and how they interact, hunt, swim, etc. (Unaffiliated with
me). http://www.frams.alife.pl/
- 11
- Toward Terser JavaRoedy Green <email***@***.com> writes:
>Sometimes I just long for C preprocessor macro ability for when
>Java won't let you encapsulate patterns without a fight.
I could not resist that temptation.
I have a very early version of such an experimental
preprocessor, which I develope just for fun.
It is written in Java and called "Metava". To simplify the
implementation, it uses a package that can read extended
S-expressions in a language, which I call "Unotal".
My first goal is to have Metava to be able to pre-process
itself to Java, so that I can write Metava in Metava.
This is not yet finished; what works so far is that the
following input (which is the very start of the preprocessor
source code only) is translated to Java.
< import =
< de.dclj.ram.notation.unotal.RoomSource
de.dclj.ram.notation.unotal.StringValue
de.dclj.ram.notation.unotal.SetValue
de.dclj.ram.notation.unotal.FileRoomModule.fileRoom >
Hello =
< verbose = < from=String < &ePrint it >>
error = < from=String < &ePrint it >>
warning = < from=String < &ePrint it >>
emit = < from=String < &write it >>
emitLine = < < &line > < &emitIndentation >>
quit = < < &verbose ["quitting"] >< &System.exit 99 >>
indentation = < type=int >
indent = << &increment indentation by=2 >>
outdent = << &decrement indentation by=2 >>
emitIndentation = < < &repeat times=indentation < &write [" "] > >>
emitLine = < from=int < &repeat < &line >>< &emitIndentation >>
emitOpen = < < &emitLine >< &emit ["{ "] >< &indent >>
emitLeft = < from=boolean < &emitLine >< &emit ["("] >< &if <&emit [" "]>> <&indent> >
emitClose = < from=boolean < &if <&emit [" "]>>< &emit ["}"]>< &outdent >>
emitRight = < from=boolean < &if <&emit [" "]>>< &emit [")"]>< &outdent >>
< mainClass = < type=String value=["Hello"] >
source = < type=RoomSource >
< &verbose ["OK 555E6k: main"] >>>>>
The last three lines are supposed to become the body of the
main-method, but I see from the output, that a bug still
prevents it to be generated from them.
There are some fixed ad-hoc abbreviations for names used
often, like "ePrint" for "java.lang.System.err.printLn", but I
try to keep their number small.
The point is that I can implement whatever notation I would
like to have in that preprocessor. When I write a program with
it and miss a notation, I can add it to the preprocessor and
use it.
To explain a procedure definition in more detail as an example:
emitLine = < from=int < &repeat < &line >>< &emitIndentation >>
defines a procedure "emitLine". The name of the int-Parameter
defaults to "it". The "&repeat" keyword generates a loop to
repeat something a number of times, which - if unspecified -
also defaults to "it". So this gives "emitLine" as it can
be seen in the following Java-source-code that was generated
from the Metava-Source-code above:
import de.dclj.ram.notation.unotal.RoomSource;
import de.dclj.ram.notation.unotal.StringValue;
import de.dclj.ram.notation.unotal.SetValue;
import static de.dclj.ram.notation.unotal.FileRoomModule.fileRoom;
public class
Hello
{
public static void
emitClose
( final boolean it )
{
if
( it )
{
emit
( " " ); }
emit
( "}" );
outdent
(); }
public static void
emitIndentation
()
{
for
( int i = indentation; i-- > 0; )java.lang.System.out.print
( " " ); }
public static void
outdent
()
{
indentation -= 2;
}
public static void
emitLeft
( final boolean it )
{
emitLine
();
emit
( "(" );
if
( it )
{
emit
( " " ); }
indent
(); }
public static int indentation;
public static void
error
( final String it )
{
java.lang.System.err.println
( it ); }
public static void
quit
()
{
verbose
( "quitting" );
System.exit
( 99 ); }
public static void
emit
( final String it )
{
java.lang.System.out.print
( it ); }
public static void
main
( final java.lang.String[] it )
{ }
public static void
warning
( final String it )
{
java.lang.System.err.println
( it ); }
public static void
emitRight
( final boolean it )
{
if
( it )
{
emit
( " " ); }
emit
( ")" );
outdent
(); }
public static void
verbose
( final String it )
{
java.lang.System.err.println
( it ); }
public static void
emitLine
( final int it )
{
for
( int i = it; i-- > 0; )line
();
emitIndentation
(); }
public static void
emitLine
()
{
line
();
emitIndentation
(); }
public static void
indent
()
{
indentation += 2;
}
public static void
emitOpen
()
{
emitLine
();
emit
( "{ " );
indent
(); }}
- 12
- java compiler errors on regexsHi.
I have an array of strings that I'm trying to use in regexs. the
following line is generating Several errors:
BrowserIdentification.java:17: illegal escape character
protected static String[] acceptedUserAgentPatterns = {"MSIE\s?(\d)+
\.", "Firefox/(\d)\."};
It looks like it is complaining about the \d (which I read about in
the java regex documentation) as well as the \. (which I have to
escape so that it only matches a literal '.', right?
BTW, I am using the ( ) so that I can use matcher.group, later. I'm
compiling using 1.4.2 specifically jrockit-R27.1.0-jdk1.4.2_12
Am I just missing something really obvious here?
- 13
- Print a XML string to browser doesn't work in JSPxmlReq is the XML string, and I want to print it out in browser, but it doesn't
print it out. But when I go to view|source, then I could see the XML.
<%
String xmlReq = generateXML();
out.println(xmlReq);
%>
any ideas? please help. thanks!!
- 14
- Making a variable an objectInside a class, amongst other variables, I have a variable 'orientation'
which can hold three valid values: horizontal, vertical, and no orientation.
In true oo design, should i bother creating a Orientation nested class
just for the variable no matter how small the class is?
- 15
- Problem reading file from applet!Hello!
I'm not too experienced in java and I have a problem reading from a file
with my applet. As I understand the applet is aloud to read from the same
folder as the applet is in.
I have declared a File (that point to my file in the same folder), a
FileReader with try and catch Exception and then I have written
FileReader.read(char c, int, int) with try and catch. The compiler accepts
my code but when I run my applet in appletviewer the promt gives me errors.
Can somebody please help me?
Many, many thanks in advance!
Best regards
Marcus
|
|
|