use of org.mozilla.jss.asn1.INTEGER in project packages-jpl by SWI-Prolog.
the class Test_List method testIsPairList2.
@Test
public void testIsPairList2() {
Term t = new Compound(JPL.LIST_PAIR, new Term[] { new Integer(1), new Integer(2) });
String msg = String.format("term %s should be a pair list", t.toString());
assertTrue(msg, t.isListPair());
assertEquals("[1, 2]", t.toString());
}
use of org.mozilla.jss.asn1.INTEGER in project packages-jpl by SWI-Prolog.
the class Test_Dict method test_dict1.
// /////////////////////////////////////////////////////////////////////////////
// SUPPORTING CODE
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
// TESTS
// /////////////////////////////////////////////////////////////////////////////
@Test
public void test_dict1() {
Map<Atom, Term> map = new HashMap<Atom, Term>();
map.put(new Atom("x"), new org.jpl7.Integer(12));
map.put(new Atom("y"), new org.jpl7.Integer(23));
map.put(new Atom("z"), new Integer(312));
Dict dict = new Dict(new Atom("location"), map);
assertEquals("location{x:12, z:312, y:23}", dict.toString());
assertEquals(Prolog.DICT, dict.type());
}
use of org.mozilla.jss.asn1.INTEGER in project jaxdb by jaxdb.
the class Compiler method createColumn.
private CreateStatement createColumn(final LinkedHashSet<CreateStatement> alterStatements, final $Table table, final $Column column, final Map<String, Map<String, String>> tableNameToEnumToOwner) {
final StringBuilder builder = new StringBuilder();
builder.append(q(column.getName$().text())).append(' ');
// FIXME: Passing null to compile*() methods will throw a NPE
if (column instanceof $Char) {
final $Char type = ($Char) column;
builder.append(getDialect().compileChar(type.getVarying$() != null && type.getVarying$().text(), type.getLength$() == null ? null : type.getLength$().text()));
} else if (column instanceof $Binary) {
final $Binary type = ($Binary) column;
builder.append(getDialect().compileBinary(type.getVarying$() != null && type.getVarying$().text(), type.getLength$() == null ? null : type.getLength$().text()));
} else if (column instanceof $Blob) {
final $Blob type = ($Blob) column;
builder.append(getDialect().compileBlob(type.getLength$() == null ? null : type.getLength$().text()));
} else if (column instanceof $Clob) {
final $Clob type = ($Clob) column;
builder.append(getDialect().compileClob(type.getLength$() == null ? null : type.getLength$().text()));
} else if (column instanceof $Integer) {
builder.append(createIntegerColumn(($Integer) column));
} else if (column instanceof $Float) {
final $Float type = ($Float) column;
builder.append(getDialect().declareFloat(type.getMin$() == null ? null : type.getMin$().text()));
} else if (column instanceof $Double) {
final $Double type = ($Double) column;
builder.append(getDialect().declareDouble(type.getMin$() == null ? null : type.getMin$().text()));
} else if (column instanceof $Decimal) {
final $Decimal type = ($Decimal) column;
builder.append(getDialect().declareDecimal(type.getPrecision$() == null ? null : type.getPrecision$().text(), type.getScale$() == null ? null : type.getScale$().text(), type.getMin$() == null ? null : type.getMin$().text()));
} else if (column instanceof $Date) {
builder.append(getDialect().declareDate());
} else if (column instanceof $Time) {
final $Time type = ($Time) column;
builder.append(getDialect().declareTime(type.getPrecision$() == null ? null : type.getPrecision$().text()));
} else if (column instanceof $Datetime) {
final $Datetime type = ($Datetime) column;
builder.append(getDialect().declareDateTime(type.getPrecision$() == null ? null : type.getPrecision$().text()));
} else if (column instanceof $Boolean) {
builder.append(getDialect().declareBoolean());
} else if (column instanceof $Enum) {
builder.append(getDialect().declareEnum(($Enum) column, tableNameToEnumToOwner));
}
final String autoIncrementFragment = column instanceof $Integer ? $autoIncrement(alterStatements, table, ($Integer) column) : null;
if (autoIncrementFragment == null || autoIncrementFragment.length() == 0) {
final String defaultFragment = $default(column);
if (defaultFragment != null && defaultFragment.length() > 0)
builder.append(" DEFAULT ").append(defaultFragment);
}
final String nullFragment = $null(table, column);
if (nullFragment != null && nullFragment.length() > 0)
builder.append(' ').append(nullFragment);
if (autoIncrementFragment != null && autoIncrementFragment.length() > 0)
builder.append(' ').append(autoIncrementFragment);
return new CreateStatement(builder.toString());
}
use of org.mozilla.jss.asn1.INTEGER in project jaxdb by jaxdb.
the class OracleCompiler method dropTypes.
@Override
LinkedHashSet<DropStatement> dropTypes(final $Table table, final Map<String, Map<String, String>> tableNameToEnumToOwner) {
final LinkedHashSet<DropStatement> statements = super.dropTypes(table, tableNameToEnumToOwner);
if (table.getColumn() != null) {
for (final $Column column : table.getColumn()) {
if (column instanceof $Integer) {
final $Integer type = ($Integer) column;
if (Generator.isAuto(type)) {
statements.add(new DropStatement("BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE " + q(getSequenceName(table, type)) + "'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -2289 THEN RAISE; END IF; END;"));
statements.add(new DropStatement("BEGIN EXECUTE IMMEDIATE 'DROP TRIGGER " + q(getTriggerName(table, type)) + "'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -4080 THEN RAISE; END IF; END;"));
}
}
}
}
return statements;
}
use of org.mozilla.jss.asn1.INTEGER in project jss by dogtagpki.
the class CMCStatusInfo method addBodyPartID.
/**
* Adds a BodyPartID to the bodyList SEQUENCE.
*/
public void addBodyPartID(int id) {
INTEGER id1 = new INTEGER(id);
assert (id1.compareTo(BODYIDMAX) <= 0);
bodyList.addElement(id1);
}
Aggregations