Changeset 205 for liacs/TOOS


Ignore:
Timestamp:
Oct 25, 2010, 7:42:47 PM (14 years ago)
Author:
Rick van der Zwet
Message:

Log4j compatibe logging (more easy to write)

Location:
liacs/TOOS/assignment1
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • liacs/TOOS/assignment1/build.xml

    r204 r205  
    11<project>
    2   <target name="init">
    3       <property name="javac.includeAntRuntime" value="false" />
    4   </target>
     2  <property name="lib.dir" value="lib" />
     3  <property name="javac.includeAntRuntime" value="false" />
     4
     5  <path id="classpath">
     6    <fileset dir="${lib.dir}" includes="**/*.jar"/>
     7  </path>
     8
    59
    610  <target name="clean">
     
    812  </target>
    913
    10   <target name="compile" depends="init">
     14  <target name="compile">
    1115      <mkdir dir="build/classes"/>
    12       <javac srcdir="src" destdir="build/classes" includeAntRuntime="${javac.includeAntRuntime}" />
     16      <javac srcdir="src" destdir="build/classes"
     17        includeAntRuntime="${javac.includeAntRuntime}" classpathref="classpath">
     18
     19        <compilerarg value="-Xlint:unchecked" />
     20      </javac>
    1321  </target>
    1422
     
    2331
    2432  <target name="run" depends="jar">
    25       <java jar="build/jar/Census.jar" fork="true"/>
     33      <java jar="build/jar/Census.jar" fork="true">
     34        <classpath>
     35          <path refid="classpath" />
     36        </classpath>
     37      </java>
    2638  </target>
    2739</project>
  • liacs/TOOS/assignment1/src/Census.java

    r204 r205  
     1package nl.rickvanderzwet.toos.assignment1;
     2
     3import java.util.HashSet;
     4import nl.rickvanderzwet.toos.assignment1.Voter;
     5import org.apache.log4j.BasicConfigurator;
     6import org.apache.log4j.Logger;
     7
    18public class Census {
     9  static Logger logger = Logger.getLogger(Census.class);
    210  public static void main(String[] args) {
    3     System.out.println("Hello, world!");
     11    BasicConfigurator.configure();
     12    HashSet<Voter> voters = new HashSet<Voter>();
     13    voters.add(new Voter(true));
     14   
     15    logger.info("Hello, world!");
     16  }
     17  public boolean census(HashSet<Voter> Voters) {
     18    return false;
    419  }
    520}
  • liacs/TOOS/assignment1/src/Voter.java

    r204 r205  
     1package nl.rickvanderzwet.toos.assignment1;
     2
     3public class Voter {
     4  public Voter() {
     5    fvote = null;
     6  }
     7  public Voter(Boolean vote) {
     8    fvote = vote;
     9  }
     10
     11  public Boolean voted() {
     12    return fvote;
     13  }
     14  public Boolean fvote;
     15}
Note: See TracChangeset for help on using the changeset viewer.