Changeset 2117
- Timestamp:
- Sep 29, 2006, 8:35:28 PM (14 years ago)
- Location:
- to-imperative/branches/j-sharp/org/refal/plus
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/branches/j-sharp/org/refal/plus/Util.java
r2114 r2117 16 16 } 17 17 18 static final BigInteger bigZero = BigInteger.valueOf(0);19 20 18 public static boolean fitsNonnegativeInteger (BigInteger i) 21 19 { 22 return i.compareTo(bigZero) >= 0 && i.compareTo(maxInt) <= 0;20 return i.compareTo(BigInteger.valueOf(0)) >= 0 && i.compareTo(maxInt) <= 0; 23 21 } 24 22 } -
to-imperative/branches/j-sharp/org/refal/plus/library/Access.java
r2024 r2117 12 12 static private int intValue (BigInteger i) throws ValueOutOfBoundsException 13 13 { 14 if (i.compareTo(BigInteger. ZERO) < 0 || i.compareTo(Util.maxInt) > 0)14 if (i.compareTo(BigInteger.valueOf(0)) < 0 || i.compareTo(Util.maxInt) > 0) 15 15 throw new ValueOutOfBoundsException(); 16 16 return i.intValue(); … … 20 20 throws RefalException 21 21 { 22 assert s_left.getLen() == 1;22 //assert s_left.getLen() == 1; 23 23 try { 24 24 int left = intValue((BigInteger) s_left.at(0)); … … 36 36 throws RefalException 37 37 { 38 assert s_right.getLen() == 1;38 //assert s_right.getLen() == 1; 39 39 try { 40 40 int right = intValue((BigInteger) s_right.at(0)); … … 52 52 throws RefalException 53 53 { 54 assert s_left.getLen() == 1;55 assert s_len.getLen() == 1;54 //assert s_left.getLen() == 1; 55 //assert s_len.getLen() == 1; 56 56 try { 57 57 int len = intValue((BigInteger) s_len .at(0)); … … 70 70 throws RefalException 71 71 { 72 assert s_right.getLen() == 1;73 assert s_len.getLen() == 1;72 //assert s_right.getLen() == 1; 73 //assert s_len.getLen() == 1; 74 74 try { 75 75 int len = intValue((BigInteger) s_len .at(0)); … … 88 88 throws RefalException 89 89 { 90 assert s_left.getLen() == 1;91 assert s_right.getLen() == 1;90 //assert s_left.getLen() == 1; 91 //assert s_right.getLen() == 1; 92 92 try { 93 93 int left = intValue((BigInteger) s_left .at(0)); -
to-imperative/branches/j-sharp/org/refal/plus/library/Apply.java
r2024 r2117 12 12 throws RefalException 13 13 { 14 assert func.getLen() == 1;14 //assert func.getLen() == 1; 15 15 try { 16 16 return ((Func)func.at(0)).eval(arg, res); -
to-imperative/branches/j-sharp/org/refal/plus/library/Arithm.java
r2059 r2117 12 12 static public void _p_ (Expr s1, Expr s2, Result res) throws RefalException 13 13 { 14 assert s1.getLen() == 1;15 assert s2.getLen() == 1;14 //assert s1.getLen() == 1; 15 //assert s2.getLen() == 1; 16 16 try { 17 17 res.assign(((BigInteger) s1.at(0)).add((BigInteger) s2.at(0))); … … 23 23 static public void _m_ (Expr s1, Expr s2, Result res) throws RefalException 24 24 { 25 assert s1.getLen() == 1;26 assert s2.getLen() == 1;25 //assert s1.getLen() == 1; 26 //assert s2.getLen() == 1; 27 27 try { 28 28 res.assign(((BigInteger) s1.at(0)).subtract((BigInteger) s2.at(0))); … … 34 34 static public void _a_ (Expr s1, Expr s2, Result res) throws RefalException 35 35 { 36 assert s1.getLen() == 1;37 assert s2.getLen() == 1;36 //assert s1.getLen() == 1; 37 //assert s2.getLen() == 1; 38 38 try { 39 39 res.assign(((BigInteger) s1.at(0)).multiply((BigInteger) s2.at(0))); … … 45 45 static public void Div (Expr s1, Expr s2, Result res) throws RefalException 46 46 { 47 assert s1.getLen() == 1;48 assert s2.getLen() == 1;47 //assert s1.getLen() == 1; 48 //assert s2.getLen() == 1; 49 49 try { 50 50 res.assign(((BigInteger) s1.at(0)).divide((BigInteger) s2.at(0))); … … 58 58 static public void Rem (Expr s1, Expr s2, Result res) throws RefalException 59 59 { 60 assert s1.getLen() == 1;61 assert s2.getLen() == 1;60 //assert s1.getLen() == 1; 61 //assert s2.getLen() == 1; 62 62 try { 63 63 res.assign(((BigInteger) s1.at(0)).remainder((BigInteger) s2.at(0))); … … 72 72 throws RefalException 73 73 { 74 assert s1.getLen() == 1;75 assert s2.getLen() == 1;74 //assert s1.getLen() == 1; 75 //assert s2.getLen() == 1; 76 76 try { 77 77 BigInteger[] a = ((BigInteger) s1.at(0)).divideAndRemainder((BigInteger) s2.at(0)); … … 87 87 static public void GCD (Expr s1, Expr s2, Result res) throws RefalException 88 88 { 89 assert s1.getLen() == 1;90 assert s2.getLen() == 1;89 //assert s1.getLen() == 1; 90 //assert s2.getLen() == 1; 91 91 try { 92 92 BigInteger d = ((BigInteger) s1.at(0)).gcd((BigInteger) s2.at(0)); 93 if (d.equals(BigInteger. ZERO))93 if (d.equals(BigInteger.valueOf(0))) 94 94 throw new RefalException("Arithm", "GCD", "Zero arguments"); 95 95 res.assign(d); … … 101 101 static public void Max (Expr s1, Expr s2, Result res) throws RefalException 102 102 { 103 assert s1.getLen() == 1;104 assert s2.getLen() == 1;103 //assert s1.getLen() == 1; 104 //assert s2.getLen() == 1; 105 105 try { 106 106 res.assign(((BigInteger) s1.at(0)).max((BigInteger) s2.at(0))); … … 112 112 static public void Min (Expr s1, Expr s2, Result res) throws RefalException 113 113 { 114 assert s1.getLen() == 1;115 assert s2.getLen() == 1;114 //assert s1.getLen() == 1; 115 //assert s2.getLen() == 1; 116 116 try { 117 117 res.assign(((BigInteger) s1.at(0)).min((BigInteger) s2.at(0))); -
to-imperative/branches/j-sharp/org/refal/plus/library/Box.java
r2024 r2117 45 45 static public void _q_ (Expr box, Result res) throws RefalException 46 46 { 47 assert box.getLen() == 1;47 //assert box.getLen() == 1; 48 48 try { 49 49 res.assign(((Box) box.at(0)).expr); … … 55 55 static public void Store (Expr box, Expr e) throws RefalException 56 56 { 57 assert box.getLen() == 1;57 //assert box.getLen() == 1; 58 58 try { 59 59 ((Box) box.at(0)).expr = e; -
to-imperative/branches/j-sharp/org/refal/plus/library/Convert.java
r2024 r2117 13 13 static public void To_m_Chars (Expr e, Result res) 14 14 { 15 res.assign(Expr.fromSequence(e.toString Buffer()));15 res.assign(Expr.fromSequence(e.toString())); 16 16 } 17 17 -
to-imperative/branches/j-sharp/org/refal/plus/library/Dir.java
r2024 r2117 29 29 public static boolean Read_m_Dir (Expr dir, Result fname) throws RefalException 30 30 { 31 assert dir.getLen() == 1;31 //assert dir.getLen() == 1; 32 32 try { 33 33 Dir d = (Dir) dir.at(0); … … 44 44 public static void Close_m_Dir (Expr dir) throws RefalException 45 45 { 46 assert dir.getLen() == 1;46 //assert dir.getLen() == 1; 47 47 try { 48 48 ((Dir) dir.at(0)).files = null; -
to-imperative/branches/j-sharp/org/refal/plus/library/Dos.java
r2060 r2117 44 44 static public void Arg (Expr e, Result res) throws RefalException 45 45 { 46 assert e.getLen() == 1;46 //assert e.getLen() == 1; 47 47 try { 48 48 BigInteger i = (BigInteger) e.at(0); … … 72 72 static public void Exit (Expr e) throws RefalException 73 73 { 74 assert e.getLen() == 1;74 //assert e.getLen() == 1; 75 75 try { 76 76 BigInteger i = (BigInteger) e.at(0); -
to-imperative/branches/j-sharp/org/refal/plus/library/NamedVector.java
r1846 r2117 24 24 } 25 25 26 public String toString ()27 {28 return name;29 }26 //public String toString () 27 //{ 28 // return name; 29 //} 30 30 } -
to-imperative/branches/j-sharp/org/refal/plus/library/StdIO.java
r2066 r2117 87 87 public static void Write_e_ (Expr channel, Expr e) throws RefalException 88 88 { 89 assert channel.getLen() == 1;89 //assert channel.getLen() == 1; 90 90 try { 91 91 ((Channel) channel.at(0)).print(e.formattedRepresentation()); … … 102 102 public static void WriteLN_e_ (Expr channel, Expr e) throws RefalException 103 103 { 104 assert channel.getLen() == 1;104 //assert channel.getLen() == 1; 105 105 try { 106 106 ((Channel) channel.at(0)).println(e.formattedRepresentation()); … … 127 127 public static void Print_e_ (Expr channel, Expr e) throws RefalException 128 128 { 129 assert channel.getLen() == 1;129 //assert channel.getLen() == 1; 130 130 try { 131 131 ((Channel) channel.at(0)).print(e); … … 142 142 public static void PrintLN_e_ (Expr channel, Expr e) throws RefalException 143 143 { 144 assert channel.getLen() == 1;144 //assert channel.getLen() == 1; 145 145 try { 146 146 ((Channel) channel.at(0)).println(e); … … 157 157 public static void Flush_e_ (Expr channel) throws RefalException 158 158 { 159 assert channel.getLen() == 1;159 //assert channel.getLen() == 1; 160 160 try { 161 161 ((Channel) channel.at(0)).flush(); … … 555 555 try { 556 556 Result _v_Stream1 = new Result(); 557 Stream.Stream (_c_3, new Expr(StdIn, new Expr(BigInteger. ONE)), _v_Stream1);557 Stream.Stream (_c_3, new Expr(StdIn, new Expr(BigInteger.valueOf(1))), _v_Stream1); 558 558 Table.Bind (Buffers, StdIn, _v_Stream1.getExpr()); 559 559 } catch (RefalException _) {} -
to-imperative/branches/j-sharp/org/refal/plus/library/Table.java
r2062 r2117 26 26 static public void Bind (Expr tab, Expr key, Expr val) throws RefalException 27 27 { 28 assert tab.getLen() == 1;28 //assert tab.getLen() == 1; 29 29 try { 30 30 ((TreeMap) tab.at(0)).put(key, val); … … 36 36 static public void Unbind (Expr tab, Expr key) throws RefalException 37 37 { 38 assert tab.getLen() == 1;38 //assert tab.getLen() == 1; 39 39 try { 40 40 ((TreeMap) tab.at(0)).remove(key); … … 46 46 static public boolean Lookup (Expr tab, Expr key, Result val) throws RefalException 47 47 { 48 assert tab.getLen() == 1;48 //assert tab.getLen() == 1; 49 49 try { 50 50 Expr e = (Expr) ((TreeMap) tab.at(0)).get(key); … … 59 59 static public boolean In_m_Table_q_ (Expr tab, Expr key) throws RefalException 60 60 { 61 assert tab.getLen() == 1;61 //assert tab.getLen() == 1; 62 62 try { 63 63 return ((TreeMap) tab.at(0)).containsKey(key); … … 69 69 static public void Domain (Expr tab, Result res) throws RefalException 70 70 { 71 assert tab.getLen() == 1;71 //assert tab.getLen() == 1; 72 72 try { 73 73 res.assign(((TreeMap) tab.at(0)).keySet().toArray()); … … 79 79 static public void Values (Expr tab, Result res) throws RefalException 80 80 { 81 assert tab.getLen() == 1;81 //assert tab.getLen() == 1; 82 82 try { 83 83 res.assign(((TreeMap) tab.at(0)).values().toArray()); … … 89 89 static public void Entries (Expr tab, Result res) throws RefalException 90 90 { 91 assert tab.getLen() == 1;91 //assert tab.getLen() == 1; 92 92 try { 93 93 TreeMap t = (TreeMap) tab.at(0); … … 108 108 static public void Table_m_Copy (Expr tab, Result res) throws RefalException 109 109 { 110 assert tab.getLen() == 1;110 //assert tab.getLen() == 1; 111 111 try { 112 112 res.assign(((TreeMap) tab.at(0)).clone()); … … 118 118 static public void Replace_m_Table (Expr target, Expr source) throws RefalException 119 119 { 120 assert target.getLen() == 1;121 assert source.getLen() == 1;120 //assert target.getLen() == 1; 121 //assert source.getLen() == 1; 122 122 try { 123 123 TreeMap t = (TreeMap) target.at(0); … … 131 131 static public void Clear_m_Table (Expr tab) throws RefalException 132 132 { 133 assert tab.getLen() == 1;133 //assert tab.getLen() == 1; 134 134 try { 135 135 ((TreeMap) tab.at(0)).clear(); … … 141 141 static public void Table_m_Size (Expr tab, Result res) throws RefalException 142 142 { 143 assert tab.getLen() == 1;143 //assert tab.getLen() == 1; 144 144 try { 145 145 res.assign(BigInteger.valueOf(((TreeMap) tab.at(0)).size()));
Note: See TracChangeset
for help on using the changeset viewer.