Changeset 1761

Show
Ignore:
Timestamp:
05/02/10 15:37:24 (3 years ago)
Author:
dmisev
Message:

resolving circular imports

Location:
src/jomdoc/trunk/src
Files:
13 added
7 modified

Legend:

Unmodified
Added
Removed
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/lang/OMDocContainer.java

    r1746 r1761  
    129129    } 
    130130 
     131    public static Stack<String> getStack() { 
     132        return stack.get(); 
     133    } 
     134 
    131135    /** 
    132136     * Print the contents of the stack 
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/lang/OMDocDocument.java

    r1760 r1761  
    1818 
    1919import java.net.URI; 
     20import java.net.URISyntaxException; 
    2021import java.util.ArrayList; 
    2122import java.util.List; 
     23import java.util.logging.Level; 
     24import java.util.logging.Logger; 
    2225import nu.xom.Attribute; 
    2326import nu.xom.Document; 
     
    160163 
    161164    public void setCDBase(URI cdBase) { 
     165        if (!cdBase.isAbsolute()) { 
     166            try { 
     167                cdBase = new URI("file:" + cdBase.toString()); 
     168            } catch (URISyntaxException ex) { 
     169            } 
     170        } 
    162171        this.cdBase = cdBase; 
    163172        modify(); 
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/lang/attributes/OMName.java

    r1700 r1761  
    9797    } 
    9898 
     99    public void setCd(String cd) { 
     100        this.cd = cd; 
     101    } 
     102 
     103    public void setCdbase(URI cdbase) { 
     104        this.cdbase = cdbase; 
     105    } 
     106 
     107    public void setName(String name) { 
     108        this.name = name; 
     109    } 
     110 
    99111    @Override 
    100112    public String toString() { 
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/lang/math/om/OMS.java

    r1573 r1761  
    100100    } 
    101101 
     102    public void setCDBase(URI cdbase) { 
     103        symbolID.setCdbase(cdbase); 
     104        symbol = null; 
     105        modify(); 
     106    } 
     107 
    102108    public String getCD() { 
    103109        return symbolID.getCD(); 
    104110    } 
    105111 
    106     public String getTheoryName() { 
     112    public void setCD(String cd) { 
     113        symbolID.setCd(cd); 
     114        symbol = null; 
     115        modify(); 
     116    } 
     117 
     118    public String getName() { 
    107119        return symbolID.getName(); 
     120    } 
     121 
     122    public void setName(String name) { 
     123        symbolID.setName(name); 
     124        symbol = null; 
     125        modify(); 
    108126    } 
    109127 
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/lang/theories/Theory.java

    r1700 r1761  
    176176    } 
    177177 
    178     public String getTheoryId() { 
     178    public String getId() { 
    179179        String ret = getName(); 
    180180        if (ret == null) { 
    181181            ret = getID(); 
    182182        } 
    183         ret = "#" + ret; 
    184  
     183        return ret; 
     184    } 
     185 
     186    public String getTheoryId() { 
     187        String ret = "#" + getId(); 
    185188        URI docURI = getOMDocDocument().getCDBase(); 
    186189        if (docURI != null) { 
    187190            ret = docURI.toString() + ret; 
    188191        } 
    189  
    190192        return ret; 
    191193    } 
  • src/jomdoc/trunk/src/jomdoc/org/omdoc/jomdoc/util/etc/IOUtil.java

    r1695 r1761  
    1919import java.io.File; 
    2020import java.io.FileInputStream; 
     21import java.io.IOException; 
    2122import java.net.URISyntaxException; 
    2223import java.net.URL; 
    2324import java.net.URI; 
    2425import java.util.ArrayList; 
     26import java.util.Collection; 
     27import java.util.Collections; 
     28import java.util.Comparator; 
    2529import java.util.List; 
    2630import java.util.jar.JarEntry; 
    2731import java.util.jar.JarInputStream; 
     32import nu.xom.ParsingException; 
     33import org.apache.commons.io.FileUtils; 
    2834import org.apache.commons.io.filefilter.FileFileFilter; 
     35import org.omdoc.jomdoc.lang.OMDocDocument; 
     36import org.omdoc.jomdoc.parser.Parser; 
    2937import org.omdoc.jomdoc.util.err.ErrorUtil; 
     38import org.omdoc.jomdoc.util.xml.XMLUtil; 
    3039 
    3140/** 
     
    221230        } 
    222231    } 
     232 
     233    public static List<OMDocDocument> getOMDocs(File dir) throws URISyntaxException, IOException, ParsingException { 
     234        List<OMDocDocument> ret = new ArrayList<OMDocDocument>(); 
     235        Collection<File> files = FileUtils.listFiles(dir, new String[]{"omdoc"}, true); 
     236        List<File> tmp = new ArrayList<File>(files); 
     237        Collections.<File>sort(tmp, new Comparator<File>() { 
     238            public int compare(File o1, File o2) { 
     239                return o1.getPath().compareTo(o2.getPath()); 
     240            } 
     241        }); 
     242        for (File f : tmp) { 
     243            ret.add(Parser.parse(XMLUtil.buildDocument(f))); 
     244        } 
     245        return ret; 
     246    } 
    223247} 
  • src/jomdoc/trunk/src/test/org/omdoc/jomdoc/coll/ntn/ImportsAwareTest.java

    r1737 r1761  
    4444    public static String CDBASES_PATH = IMPORTS_PATH + "cdbases/"; 
    4545 
     46//    @Ignore 
     47    @Test 
     48    public void testVirtualDocument() { 
     49        String exp = IMPORTS_AWARE_PATH + "vd.exp"; 
     50        String inp = "/home/dimitar/projects/slides/dmath/en/generated-exam.omdoc"; 
     51        render("-t", inp, "-o", exp); 
     52//        render("-t", "-p", inp, "-o", TMP); 
     53//        Assert.assertTrue(pdiff(exp, TMP)); 
     54    } 
     55 
    4656    @Ignore 
    4757    @Test