public int compareTo(Object obj) { if (obj == null) { return (-1); } else if (obj instanceof CFBamEnumTagBuff) { CFBamEnumTagBuff rhs = (CFBamEnumTagBuff) obj; int retval = super.compareTo(rhs); if (retval != 0) { return (retval); } return (0); } else if (obj instanceof CFBamEnumTagByEnumTagTenantIdxKey) { CFBamEnumTagByEnumTagTenantIdxKey rhs = (CFBamEnumTagByEnumTagTenantIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } return (0); } else if (obj instanceof CFBamEnumTagByEnumIdxKey) { CFBamEnumTagByEnumIdxKey rhs = (CFBamEnumTagByEnumIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } return (0); } else if (obj instanceof CFBamEnumTagByDefSchemaIdxKey) { CFBamEnumTagByDefSchemaIdxKey rhs = (CFBamEnumTagByDefSchemaIdxKey) obj; if (getOptionalDefSchemaTenantId() != null) { Long lhsDefSchemaTenantId = getOptionalDefSchemaTenantId(); if (rhs.getOptionalDefSchemaTenantId() != null) { Long rhsDefSchemaTenantId = rhs.getOptionalDefSchemaTenantId(); int cmp = lhsDefSchemaTenantId.compareTo(rhsDefSchemaTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaTenantId() != null) { return (-1); } } if (getOptionalDefSchemaId() != null) { Long lhsDefSchemaId = getOptionalDefSchemaId(); if (rhs.getOptionalDefSchemaId() != null) { Long rhsDefSchemaId = rhs.getOptionalDefSchemaId(); int cmp = lhsDefSchemaId.compareTo(rhsDefSchemaId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagByEnumNameIdxKey) { CFBamEnumTagByEnumNameIdxKey rhs = (CFBamEnumTagByEnumNameIdxKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } { int cmp = getRequiredName().compareTo(rhs.getRequiredName()); if (cmp != 0) { return (cmp); } } return (0); } else if (obj instanceof CFBamEnumTagByPrevIdxKey) { CFBamEnumTagByPrevIdxKey rhs = (CFBamEnumTagByPrevIdxKey) obj; if (getOptionalPrevTenantId() != null) { Long lhsPrevTenantId = getOptionalPrevTenantId(); if (rhs.getOptionalPrevTenantId() != null) { Long rhsPrevTenantId = rhs.getOptionalPrevTenantId(); int cmp = lhsPrevTenantId.compareTo(rhsPrevTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevTenantId() != null) { return (-1); } } if (getOptionalPrevId() != null) { Long lhsPrevId = getOptionalPrevId(); if (rhs.getOptionalPrevId() != null) { Long rhsPrevId = rhs.getOptionalPrevId(); int cmp = lhsPrevId.compareTo(rhsPrevId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagByNextIdxKey) { CFBamEnumTagByNextIdxKey rhs = (CFBamEnumTagByNextIdxKey) obj; if (getOptionalNextTenantId() != null) { Long lhsNextTenantId = getOptionalNextTenantId(); if (rhs.getOptionalNextTenantId() != null) { Long rhsNextTenantId = rhs.getOptionalNextTenantId(); int cmp = lhsNextTenantId.compareTo(rhsNextTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextTenantId() != null) { return (-1); } } if (getOptionalNextId() != null) { Long lhsNextId = getOptionalNextId(); if (rhs.getOptionalNextId() != null) { Long rhsNextId = rhs.getOptionalNextId(); int cmp = lhsNextId.compareTo(rhsNextId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagHBuff) { CFBamEnumTagHBuff rhs = (CFBamEnumTagHBuff) obj; int retval = 0; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } if (getOptionalDefSchemaTenantId() != null) { Long lhsDefSchemaTenantId = getOptionalDefSchemaTenantId(); if (rhs.getOptionalDefSchemaTenantId() != null) { Long rhsDefSchemaTenantId = rhs.getOptionalDefSchemaTenantId(); int cmp = lhsDefSchemaTenantId.compareTo(rhsDefSchemaTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaTenantId() != null) { return (-1); } } if (getOptionalDefSchemaId() != null) { Long lhsDefSchemaId = getOptionalDefSchemaId(); if (rhs.getOptionalDefSchemaId() != null) { Long rhsDefSchemaId = rhs.getOptionalDefSchemaId(); int cmp = lhsDefSchemaId.compareTo(rhsDefSchemaId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalDefSchemaId() != null) { return (-1); } } if (getRequiredEnumId() < rhs.getRequiredEnumId()) { return (-1); } else if (getRequiredEnumId() > rhs.getRequiredEnumId()) { return (1); } if (getOptionalEnumCode() != null) { Short lhsEnumCode = getOptionalEnumCode(); if (rhs.getOptionalEnumCode() != null) { Short rhsEnumCode = rhs.getOptionalEnumCode(); int cmp = lhsEnumCode.compareTo(rhsEnumCode); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEnumCode() != null) { return (-1); } } { int cmp = getRequiredName().compareTo(rhs.getRequiredName()); if (cmp != 0) { return (cmp); } } if (getOptionalPrevTenantId() != null) { Long lhsPrevTenantId = getOptionalPrevTenantId(); if (rhs.getOptionalPrevTenantId() != null) { Long rhsPrevTenantId = rhs.getOptionalPrevTenantId(); int cmp = lhsPrevTenantId.compareTo(rhsPrevTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevTenantId() != null) { return (-1); } } if (getOptionalPrevId() != null) { Long lhsPrevId = getOptionalPrevId(); if (rhs.getOptionalPrevId() != null) { Long rhsPrevId = rhs.getOptionalPrevId(); int cmp = lhsPrevId.compareTo(rhsPrevId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalPrevId() != null) { return (-1); } } if (getOptionalNextTenantId() != null) { Long lhsNextTenantId = getOptionalNextTenantId(); if (rhs.getOptionalNextTenantId() != null) { Long rhsNextTenantId = rhs.getOptionalNextTenantId(); int cmp = lhsNextTenantId.compareTo(rhsNextTenantId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextTenantId() != null) { return (-1); } } if (getOptionalNextId() != null) { Long lhsNextId = getOptionalNextId(); if (rhs.getOptionalNextId() != null) { Long rhsNextId = rhs.getOptionalNextId(); int cmp = lhsNextId.compareTo(rhsNextId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalNextId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamEnumTagHPKey) { CFBamEnumTagHPKey rhs = (CFBamEnumTagHPKey) obj; { long lhsAuditClusterId = getAuditClusterId(); long rhsAuditClusterId = rhs.getAuditClusterId(); if (lhsAuditClusterId < rhsAuditClusterId) { return (-1); } else if (lhsAuditClusterId > rhsAuditClusterId) { return (1); } } { Calendar lhsAuditStamp = getAuditStamp(); Calendar rhsAuditStamp = rhs.getAuditStamp(); if (lhsAuditStamp == null) { if (rhsAuditStamp != null) { return (-1); } } else if (rhsAuditStamp == null) { return (1); } else { int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp); if (cmpstat != 0) { return (cmpstat); } } } { short lhsAuditActionId = getAuditActionId(); short rhsAuditActionId = rhs.getAuditActionId(); if (lhsAuditActionId < rhsAuditActionId) { return (-1); } else if (lhsAuditActionId > rhsAuditActionId) { return (1); } } { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } { UUID lhsAuditSessionId = getAuditSessionId(); UUID rhsAuditSessionId = rhs.getAuditSessionId(); if (lhsAuditSessionId == null) { if (rhsAuditSessionId != null) { return (-1); } } else if (rhsAuditSessionId == null) { return (1); } else { int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId); if (cmpstat != 0) { return (cmpstat); } } } if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFBamEnumTagPKey) { CFBamEnumTagPKey rhs = (CFBamEnumTagPKey) obj; if (getRequiredTenantId() < rhs.getRequiredTenantId()) { return (-1); } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) { return (1); } if (getRequiredId() < rhs.getRequiredId()) { return (-1); } else if (getRequiredId() > rhs.getRequiredId()) { return (1); } return (0); } else if (obj instanceof CFBamHPKey) { CFBamHPKey rhs = (CFBamHPKey) obj; { int lhsRequiredRevision = getRequiredRevision(); int rhsRequiredRevision = rhs.getRequiredRevision(); if (lhsRequiredRevision < rhsRequiredRevision) { return (-1); } else if (lhsRequiredRevision > rhsRequiredRevision) { return (1); } } return (0); } else { return (super.compareTo(obj)); } }
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); short L = Short.parseShort(br.readLine()); short R = Short.parseShort(br.readLine()); short out = maxXor(L, R); System.out.print(out); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // little endian this.cardinality = 0xFFFF & Short.reverseBytes(in.readShort()); if (this.content.limit() < this.cardinality) this.content = ShortBuffer.allocate(this.cardinality); for (int k = 0; k < this.cardinality; ++k) { this.content.put(k, Short.reverseBytes(in.readShort())); } }
public void handleTransaction(Packet106Transaction par1Packet106Transaction) { Short short1 = (Short) field_72586_s.lookup(playerEntity.craftingInventory.windowId); if (short1 != null && par1Packet106Transaction.shortWindowId == short1.shortValue() && playerEntity.craftingInventory.windowId == par1Packet106Transaction.windowId && !playerEntity.craftingInventory.isPlayerNotUsingContainer(playerEntity)) { playerEntity.craftingInventory.setPlayerIsPresent(playerEntity, true); } }
private void loadDataXM(RandomAccessFile fp) throws IOException { byte[] b = new byte[20]; // WHY THE HELL AM I DOING THIS name = Util.readStringNoNul(fp, b, 20); System.out.printf("name: \"%s\"\n", name); fp.read(); // skip 0x1A byte // THIS CAN'T BE HAPPENING fp.read(b, 0, 20); // skip tracker name // OH HELL NO int xmver = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); System.out.printf("XM version: %04X\n", xmver); // WHAT IS THIS CRAP InhibitedFileBlock ifb = new InhibitedFileBlock(fp, Integer.reverseBytes(fp.readInt()) - 4); // HELP ME PLEASE int ordnum = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); int respos = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); // can't be bothered right now --GM int chnnum = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); // yeah sure, allow out of range values if (chnnum > 64) throw new RuntimeException( String.format("%d-channel modules not supported (max 64)", chnnum)); int patnum = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); int insnum = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); int xmflags = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); int xmspeed = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); int xmtempo = 0xFFFF & (int) Short.reverseBytes(ifb.readShort()); // OH PLEASE, STOP IT if (ordnum > 255) ordnum = 255; if (xmtempo > 255) xmtempo = 255; if (xmspeed > 255) xmspeed = 255; this.bpm = xmtempo; this.spd = xmspeed; this.flags = FLAG_COMPATGXX | FLAG_OLDEFFECTS | FLAG_INSMODE | FLAG_STEREO | FLAG_VOL0MIX; if ((xmflags & 0x01) != 0) this.flags |= FLAG_LINEAR; // NONONONONONO System.out.printf("chn=%d ordnum=%d tempo=%d speed=%s\n", chnnum, ordnum, xmtempo, xmspeed); for (int i = 0; i < 256; i++) orderlist[i] = ifb.read(); for (int i = ordnum; i < 256; i++) orderlist[i] = 255; ifb.done(); // SAVE ME PLEEEEEAAASSSSEEEE for (int i = 0; i < patnum; i++) map_pat.put((Integer) i, new SessionPattern(this, fp, SessionPattern.FORMAT_XM, chnnum)); for (int i = 0; i < insnum; i++) map_ins.put((Integer) (i + 1), new SessionInstrument(fp, SessionInstrument.FORMAT_XM, this)); }
@Override protected void writeArray(DataOutput out) throws IOException { // little endian if (BufferUtil.isBackedBySimpleArray(content)) { short[] a = content.array(); for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(a[k])); } } else { for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(content.get(k))); } } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.write(this.cardinality & 0xFF); out.write((this.cardinality >>> 8) & 0xFF); if (BufferUtil.isBackedBySimpleArray(content)) { short[] a = content.array(); for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(a[k])); } } else { for (int k = 0; k < this.cardinality; ++k) { out.writeShort(Short.reverseBytes(content.get(k))); } } }
public boolean setPlayerInventorySlot( String playerName, int slot, int blockID, int damage, int quantity) { try { if (blockID == 0) { return clearPlayerInventorySlot(playerName, slot); } Player p = getPlayerExact(playerName); PlayerInventory inv = p.getInventory(); ItemStack it = new ItemStack(blockID, quantity, Short.valueOf(String.valueOf(damage)).shortValue()); if (slot == 103) inv.setHelmet(it); else if (slot == 102) inv.setChestplate(it); else if (slot == 101) inv.setLeggings(it); else if (slot == 100) inv.setBoots(it); else inv.setItem(slot, it); p.saveData(); return true; } catch (NullPointerException e) { return false; } }
public static short datoShort() { try { return Short.parseShort(dato()); } catch (NumberFormatException e) { return Short.MIN_VALUE; // valor más pequeño } }
private void readRulesId(BufferedReader bufferedReader, Integer amount) throws IOException { rulesId = new short[amount]; for (int i = 0; i < amount; i++) { String s1 = bufferedReader.readLine(); rulesId[i] = Short.valueOf(s1); } }
public boolean equals(Object obj) { if (obj instanceof Foo) { Foo ofoo = (Foo) obj; return s.equals(ofoo.s) && i.equals(ofoo.i) && l.equals(ofoo.l); } return false; }
public static void main(String[] args) throws IOException { File input = new File(args[0]); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(input))); File output = new File(input.getParentFile(), input.getName() + ".out"); PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output))); short numberOfCases = Short.parseShort(reader.readLine()); for (short c = 0; c < numberOfCases; ++c) { TreeMap<Short, TreeSet<Short>> intranet = new TreeMap<>(); short countOfRope = Short.parseShort(reader.readLine()); int intersectionCount = 0; for (short r = 0; r < countOfRope; ++r) { String line = reader.readLine(); String[] words = line.split(" "); short leftEndPoint = Short.parseShort(words[0]); short rightEndPoint = Short.parseShort(words[1]); for (Map.Entry<Short, TreeSet<Short>> e : intranet.entrySet()) { short l = e.getKey(); TreeSet<Short> rSet = e.getValue(); if (leftEndPoint < l) { Short res = rSet.lower(rightEndPoint); if (res != null) { intersectionCount += rSet.headSet(res, true).size(); } } else { // leftEndPoint > l Short res = rSet.higher(rightEndPoint); if (res != null) { intersectionCount += rSet.tailSet(res, true).size(); } } } // put TreeSet<Short> rights; if (intranet.containsKey(leftEndPoint)) { rights = intranet.get(leftEndPoint); } else { rights = new TreeSet<>(); intranet.put(leftEndPoint, rights); } rights.add(rightEndPoint); } writer.println("Case #" + (c + 1) + ": " + intersectionCount); } reader.close(); writer.close(); }
public int compareTo(Object obj) { if (obj == null) { return (1); } else if (obj instanceof CFBamSchemaDefByEAccSecIdxKey) { CFBamSchemaDefByEAccSecIdxKey rhs = (CFBamSchemaDefByEAccSecIdxKey) obj; if (getOptionalEditAccessSecurityId() != null) { Short lhsEditAccessSecurityId = getOptionalEditAccessSecurityId(); if (rhs.getOptionalEditAccessSecurityId() != null) { Short rhsEditAccessSecurityId = rhs.getOptionalEditAccessSecurityId(); int cmp = lhsEditAccessSecurityId.compareTo(rhsEditAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessSecurityId() != null) { return (-1); } } return (0); } else if (obj instanceof CFBamSchemaDefBuff) { CFBamSchemaDefBuff rhs = (CFBamSchemaDefBuff) obj; if (getOptionalEditAccessSecurityId() != null) { Short lhsEditAccessSecurityId = getOptionalEditAccessSecurityId(); if (rhs.getOptionalEditAccessSecurityId() != null) { Short rhsEditAccessSecurityId = rhs.getOptionalEditAccessSecurityId(); int cmp = lhsEditAccessSecurityId.compareTo(rhsEditAccessSecurityId); if (cmp != 0) { return (cmp); } } else { return (1); } } else { if (rhs.getOptionalEditAccessSecurityId() != null) { return (-1); } } return (0); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null); } }
@Override public short readShort() throws IOException { short s = this.stream.readShort(); if (endianness == ByteOrder.LITTLE_ENDIAN) { s = Short.reverseBytes(s); } return s; }
public static List readWatchableObjects(DataInputStream par0DataInputStream) throws IOException { ArrayList arraylist = null; for (byte byte0 = par0DataInputStream.readByte(); byte0 != 127; byte0 = par0DataInputStream.readByte()) { if (arraylist == null) { arraylist = new ArrayList(); } int i = (byte0 & 0xe0) >> 5; int j = byte0 & 0x1f; WatchableObject watchableobject = null; switch (i) { case 0: watchableobject = new WatchableObject(i, j, Byte.valueOf(par0DataInputStream.readByte())); break; case 1: watchableobject = new WatchableObject(i, j, Short.valueOf(par0DataInputStream.readShort())); break; case 2: watchableobject = new WatchableObject(i, j, Integer.valueOf(par0DataInputStream.readInt())); break; case 3: watchableobject = new WatchableObject(i, j, Float.valueOf(par0DataInputStream.readFloat())); break; case 4: watchableobject = new WatchableObject(i, j, Packet.readString(par0DataInputStream, 64)); break; case 5: short word0 = par0DataInputStream.readShort(); byte byte1 = par0DataInputStream.readByte(); short word1 = par0DataInputStream.readShort(); watchableobject = new WatchableObject(i, j, new ItemStack(word0, byte1, word1)); break; case 6: int k = par0DataInputStream.readInt(); int l = par0DataInputStream.readInt(); int i1 = par0DataInputStream.readInt(); watchableobject = new WatchableObject(i, j, new ChunkCoordinates(k, l, i1)); break; } arraylist.add(watchableobject); } return arraylist; }
public String toString() { String ret = "<CFSecurityISOCountryLanguageByCountryIdx" + " RequiredISOCountryId=" + "\"" + Short.toString(getRequiredISOCountryId()) + "\"" + "/>"; return (ret); }
// load // loads the provided program into memory public static void load(Scanner in) { int i = 0; String code; while (in.hasNext()) { code = in.next(); writeMemory((short) i, (byte) (0xFF & Short.valueOf(code, 16))); i++; } }
/** {@inheritDoc} */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll(Collection<?> collection) { boolean modified = false; TShortIterator iter = iterator(); while (iter.hasNext()) { if (!collection.contains(Short.valueOf(iter.next()))) { iter.remove(); modified = true; } } return modified; }
public String toString() { String ret = "<CFInternetURLProtocolHPKey" + " RequiredURLProtocolId=" + "\"" + Short.toString(getRequiredURLProtocolId()) + "\"" + " RequiredRevision=\"" + Integer.toString(getRequiredRevision()) + "\"" + "/>"; return (ret); }
public String toString() { String ret = "<CFBamISOLanguageHPKey" + " RequiredId=" + "\"" + Short.toString(getRequiredId()) + "\"" + " RequiredRevision=\"" + Integer.toString(getRequiredRevision()) + "\"" + "/>"; return (ret); }
public short getAddress(String functionName) throws ProgramException { Short address = (Short) functions.get(functionName); if (address != null) { return address.shortValue(); } else { String className = functionName.substring(0, functionName.indexOf(".")); if (staticRange.get(className) == null) { // The class is not implemented by a VM file - search for a // built-in implementation later. Display a popup to confirm // this as this is not a feature from the book but a later // addition. if (builtInAccessStatus == BUILTIN_ACCESS_UNDECIDED) { if (hasGUI && gui.confirmBuiltInAccess()) { builtInAccessStatus = BUILTIN_ACCESS_AUTHORIZED; } else { builtInAccessStatus = BUILTIN_ACCESS_DENIED; } } if (builtInAccessStatus == BUILTIN_ACCESS_AUTHORIZED) { return BUILTIN_FUNCTION_ADDRESS; } } // Either: // 1.The class is implemented by a VM file and no implementation // for the function is found - don't override with built-in // - or - // 2.The user did not authorize using built-in implementations. throw new ProgramException( className + ".vm not found " + "or function " + functionName + " not found in " + className + ".vm"); } }
public String toString() { String ret = "<CFAsteriskClusterId64Gen" + " RequiredId=" + "\"" + Long.toString(getRequiredId()) + "\"" + ", SliceId=\"" + Short.toString(getRequiredSliceId()) + "\"" + ", NextId=\"" + Long.toString(nextId) + "\"/>"; return (ret); }
/** Lee un <CODE>short</CODE> introducido por el teclado. */ public static final synchronized short readShort() { input = ""; short value = Short.MIN_VALUE; try { input = in.readLine(); } catch (IOException e) { error("standard input"); } try { value = Short.parseShort(input); } catch (NumberFormatException e) { error("Invalid int format"); } return value; }
public String toString() { String ret = "<CFCrmClusterId32Gen" + " RequiredId=" + "\"" + Long.toString(getRequiredId()) + "\"" + ", SliceId=\"" + Short.toString(getRequiredSliceId()) + "\"" + ", NextId=\"" + Integer.toString(nextId) + "\"/>"; return (ret); }
public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) { if (playerEntity.craftingInventory.windowId == par1Packet102WindowClick.window_Id && playerEntity.craftingInventory.isPlayerNotUsingContainer(playerEntity)) { ItemStack itemstack = playerEntity.craftingInventory.slotClick( par1Packet102WindowClick.inventorySlot, par1Packet102WindowClick.mouseClick, par1Packet102WindowClick.holdingShift, playerEntity); if (ItemStack.areItemStacksEqual(par1Packet102WindowClick.itemStack, itemstack)) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet106Transaction( par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, true)); playerEntity.playerInventoryBeingManipulated = true; playerEntity.craftingInventory.updateCraftingResults(); playerEntity.sendInventoryToPlayer(); playerEntity.playerInventoryBeingManipulated = false; } else { field_72586_s.addKey( playerEntity.craftingInventory.windowId, Short.valueOf(par1Packet102WindowClick.action)); playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet106Transaction( par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, false)); playerEntity.craftingInventory.setPlayerIsPresent(playerEntity, false); ArrayList arraylist = new ArrayList(); for (int i = 0; i < playerEntity.craftingInventory.inventorySlots.size(); i++) { arraylist.add(((Slot) playerEntity.craftingInventory.inventorySlots.get(i)).getStack()); } playerEntity.sendContainerAndContentsToPlayer(playerEntity.craftingInventory, arraylist); } } }
/** * Create and open a Connection. This Implementation only supports the <code>btl2cap://</code> * protocol schema. If url begins with <code>btl2cap://localhost</code>, this method call will * return a <code>javax.bluetooth.L2CAPConnectionNotifier</code>. * * @param url The URL for the connection. * @return A new <code>javax.bluetooth.L2CAPConnection</code> or a <code> * javax.bluetooth.L2CAPConnectionNotifier</code> * @throws IllegalArgumentException If a parameter is invalid. * @throws IOException If some other kind of I/O error occurs. * @see javax.bluetooth.L2CAPConnection * @see javax.bluetooth.L2CAPConnectionNotifier */ public static Connection open(String url) throws IOException { try { if (url.startsWith("btl2cap://localhost:")) { int endIndex = url.indexOf(';'); String psmString = url.substring(20, endIndex); Short psmShort = Short.decode(psmString); short psm = psmShort.shortValue(); return new JSR82ConnectionNotifier(psm); } if (url.startsWith("btl2cap://")) { byte[] bdAddrBytes = new byte[12]; String bdAddrString = url.substring(10, 22); Long bdAddrLong = Long.decode("0x" + bdAddrString); long remoteAddrLong = bdAddrLong.longValue(); int endIndex = url.indexOf(';', 22); String psmString = url.substring(23, endIndex); Short psmShort = Short.decode(psmString); short psm = psmShort.shortValue(); BluetoothStack bluetooth = BluetoothStack.getBluetoothStack(); LocalDevice localDev = LocalDevice.getLocalDevice(); DiscoveryAgent discovery = localDev.getDiscoveryAgent(); RemoteDevice remoteDevice = discovery.getRemoteDevice(remoteAddrLong); if (remoteDevice != null) { JSR82Channel channel = new JSR82Channel(); bluetooth.connectL2CAPChannel(channel, remoteDevice, psm); return channel; } else throw new IllegalArgumentException("Unable to locate Bluetooth Device."); } } catch (BluetoothStateException e) { throw new IOException("" + e); } catch (HCIException e) { throw new IOException("" + e); } throw new IllegalArgumentException( "This implementation of Connector only supports btl2cap:// Connections."); }
private void processRequest(PDU pdu) throws DBException, IOException { // Process the request and add to SMS_RECEIVE_QUEUE if (pdu.getCommandId() == Data.DELIVER_SM) { dsm = (DeliverSM) pdu; this.userId = dsm.getSourceAddr().getAddress(); this.serviceId = dsm.getDestAddr().getAddress(); this.info = dsm.getShortMessage(); ByteBuffer da = null; try { da = dsm.getDestSubaddress(); String te = Convert.hexToString(da.getHexDump().substring(2)); // this.RequestID = te; Gateway.util.log(this.getClass().getName(), "getDestSubaddress:" + te); } catch (ValueNotSetException ex) { } short destport = 0; try { destport = dsm.getDestinationPort(); Gateway.util.log(this.getClass().getName(), "getDestinationPort:" + destport); } catch (ValueNotSetException e) { // TODO Auto-generated catch block // Tim Dport o day // ByteBuffer otaData =new // ByteBuffer(info.getBytes(Data.ENC_ISO8859_1)); ByteBuffer otaData = new ByteBuffer(); otaData = dsm.getShortMessagebuff(); try { byte udhlength = otaData.removeByte(); byte udhele1 = otaData.removeByte(); byte udhele2 = otaData.removeByte(); short sdport = otaData.removeShort(); short ssport = otaData.removeShort(); String newmsg = otaData.removeString(otaData.length(), Data.ENC_ISO8859_1); if (udhlength == 6 && udhele1 == 5) { destport = sdport; this.info = newmsg; Gateway.util.log( this.getClass().getName(), "getDestinationPort:" + destport + "@info=" + newmsg); } } catch (NotEnoughDataInByteBufferException e1) { // TODO Auto-generated catch block } } this.Dport = Short.toString(destport); if (this.info == null) { this.info = "null"; } this.userId = removePlusSign(this.userId); this.serviceId = rebuildServiceId(this.serviceId); this.operator = Preference.mobileOperator; // Added on 22//2003 : VinaPhone gui ban tin DeliverReport voi // truong esm_class != 0x4. ==> He thong xem nhu ban tin thuong // sai format va gui thong bao -- report -- thong bao --> LOOP./ // To pass over this, set: if (dsm.getEsmClass() == 0x4 || info.startsWith("id:")) { // DeliverReport // (not // processed)! Gateway.util.log(this.getClass().getName(), "It can be DeliverReport (not processed)!"); return; // not processed } // Normal message (request): // Neu mobile o che do tieng viet // --> Loai bo space (ky tu 00) giua cac ky tu this.info = StringTool.removeChar(this.info, '\00'); String newserviceid = this.serviceId; newserviceid = newserviceid.substring(newserviceid.length() - 4); // DANND add DateFormat dateFormat = new SimpleDateFormat("MMddHHmmssSSS"); java.util.Date date = new java.util.Date(); String datetime = dateFormat.format(date); this.RequestID = Preference.prefix_requestid + datetime + threadId; dbTools.add2SMSReceiveQueueR( this.userId, this.serviceId, this.operator, this.commandCode, this.info, this.RequestID, this.Dport); } }
private void loadDataIT(RandomAccessFile fp) throws IOException { byte[] b = new byte[26]; this.name = Util.readString(fp, b, 26); System.out.printf("name: \"%s\"\n", name); this.philigt = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int ordnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int insnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int smpnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int patnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); this.cwtv = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); this.cmwt = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); this.flags = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); this.special = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); this.gv = fp.read(); this.mv = fp.read(); this.spd = fp.read(); this.bpm = fp.read(); this.pwd = fp.read(); this.sep = fp.read(); int msglgth = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int msgoffs = Integer.reverseBytes(fp.readInt()); this.timestamp = Integer.reverseBytes(fp.readInt()); fp.read(chnpan, 0, 64); fp.read(chnvol, 0, 64); System.out.printf("ver: %04X / compat: %04X\n", cwtv, cmwt); // Load orderlist for (int i = 0; i < ordnum; i++) orderlist[i] = fp.readUnsignedByte(); for (int i = ordnum; i < 256; i++) orderlist[i] = 255; // Load pointers int[] insptrs = new int[insnum]; int[] smpptrs = new int[smpnum]; int[] patptrs = new int[patnum]; for (int i = 0; i < insnum; i++) insptrs[i] = Integer.reverseBytes(fp.readInt()); for (int i = 0; i < smpnum; i++) smpptrs[i] = Integer.reverseBytes(fp.readInt()); for (int i = 0; i < patnum; i++) patptrs[i] = Integer.reverseBytes(fp.readInt()); // TODO: read MIDI + timestamp bollocks // TODO: look up and/or reverse engineer said bollocks // Load data for (int i = 0; i < insnum; i++) { if (insptrs[i] != 0) { fp.seek(insptrs[i]); map_ins.put( (Integer) (i + 1), new SessionInstrument( fp, cmwt < 0x200 ? SessionInstrument.FORMAT_IT100 : SessionInstrument.FORMAT_IT200)); } } for (int i = 0; i < smpnum; i++) { if (smpptrs[i] != 0) { fp.seek(smpptrs[i]); map_smp.put((Integer) (i + 1), new SessionSample(fp, SessionSample.FORMAT_IT)); } } for (int i = 0; i < patnum; i++) { if (patptrs[i] != 0) { fp.seek(patptrs[i]); map_pat.put((Integer) i, new SessionPattern(this, fp, SessionPattern.FORMAT_IT)); } } }
private void loadDataS3M(RandomAccessFile fp) throws IOException { byte[] b = new byte[28]; this.name = Util.readString(fp, b, 28); System.out.printf("name: \"%s\"\n", name); fp.readInt(); // first two bytes we've seen, second two are unused int ordnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int smpnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int patnum = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int s3flags = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int s3cwtv = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); int ffi = 0xFFFF & (int) Short.reverseBytes(fp.readShort()); fp.readInt(); // should have "SCRM" but really doesn't matter this.flags = FLAG_OLDEFFECTS | FLAG_VOL0MIX; this.gv = fp.read() * 2; this.spd = fp.read(); this.bpm = fp.read(); this.mv = fp.read(); fp.read(); // NO WE DON'T HAVE A GUS int dfpflag = fp.read(); // weird S3M crap // note: assuming default of 6/125 // it actually uses the previously-used speed/tempo if (this.spd == 0 || this.spd == 255) this.spd = 6; if (this.bpm < 33) this.bpm = 125; if ((this.mv & 0x80) != 0) { this.mv &= ~0x80; this.flags |= FLAG_STEREO; // XXX: this might need to be done internally in the player // if it turns out that IT does the same damn thing --GM this.mv = (this.mv * 11 + 4) >> 3; } // skip all that bollocks fp.seek(0x40); // load channel mappings // yes, we WILL want these! // though i don't think anyone's done anything completely bonkers // except Storlek and myself --GM int[] st3chnmap = new int[32]; for (int i = 32; i < 64; i++) { chnvol[i] = (byte) 0xC0; chnpan[i] = 0x20; } for (int i = 0; i < 32; i++) { chnpan[i] = 0; int v = fp.read(); st3chnmap[i] = v & 0x7F; // don't enable FM channels! chnvol[i] = ((v & 0x80) != 0 && (v & 0x7F) < 16) ? 0x40 : (byte) 0xC0; } // orderlist! // DON'T EVEN NEED TO FILTER IT YES :D for (int i = 0; i < ordnum; i++) orderlist[i] = fp.read(); for (int i = ordnum; i < 256; i++) orderlist[i] = 255; // load pointers int[] smpptrs = new int[smpnum]; int[] patptrs = new int[patnum]; for (int i = 0; i < smpnum; i++) smpptrs[i] = (0xFFFF & (int) Short.reverseBytes(fp.readShort())) * 16; for (int i = 0; i < patnum; i++) patptrs[i] = (0xFFFF & (int) Short.reverseBytes(fp.readShort())) * 16; // load default panning if necessary for (int i = 0; i < 32; i++) { int v = (dfpflag == 252) ? fp.read() : 0x10; int pan = (v & 0x10) != 0 ? (flags & FLAG_STEREO) != 0 ? (v & 0x08) != 0 ? 0xC : 0x3 : 0x7 : v & 15; // TODO: scale this crap correctly chnpan[i] = (byte) ((pan + 2) << 2); } // load data for (int i = 0; i < smpnum; i++) if (smpptrs[i] != 0) { fp.seek(smpptrs[i]); map_smp.put((Integer) (i + 1), new SessionSample(fp, SessionSample.FORMAT_S3M, ffi)); } for (int i = 0; i < patnum; i++) if (patptrs[i] != 0) { fp.seek(patptrs[i]); map_pat.put( (Integer) i, new SessionPattern(this, fp, SessionPattern.FORMAT_S3M, st3chnmap)); } // XXX: any other crap this needs? --GM }
// Get property value as a short public short getShort(String key) { return (properties.containsKey(key)) ? Short.parseShort(properties.get(key).toString()) : 0; }