Search in sources :

Example 36 with INTEGER

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());
}
Also used : Integer(org.jpl7.Integer) Test(org.junit.Test)

Example 37 with INTEGER

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());
}
Also used : org.jpl7(org.jpl7) Integer(org.jpl7.Integer) HashMap(java.util.HashMap) Integer(org.jpl7.Integer) Test(org.junit.Test)

Example 38 with INTEGER

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());
}
Also used : org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Float) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Enum(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Enum) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary)

Example 39 with INTEGER

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;
}
Also used : org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer) org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column(org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column)

Example 40 with INTEGER

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);
}
Also used : INTEGER(org.mozilla.jss.asn1.INTEGER)

Aggregations

Integer (org.jpl7.Integer)19 INTEGER (org.mozilla.jss.asn1.INTEGER)15 BigInteger (java.math.BigInteger)11 Test (org.junit.Test)10 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer)9 Query (org.jpl7.Query)6 Term (org.jpl7.Term)6 SEQUENCE (org.mozilla.jss.asn1.SEQUENCE)6 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Char)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Decimal)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Double)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Enum (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Enum)5 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Binary)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Blob)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Boolean)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Clob)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Date)4 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Datetime)4