/** * Creates, adds into the internal table and returns the * character entity like <code>&lt;</code> * (means '<code><</code>' ); * This method inactivates the recursive refenrences to the same * entity. * @param name The entity name (without heading & and closing ;) * @param type The entity type * @param character The entity value (single character) * @return The created entity */ public Entity defEntity(String name, int type, String data) { int r; String eref = "%" + name + ";"; do { r = data.indexOf(eref); if (r > 0) { data = data.substring(0, r) + data.substring(r + 1); } } while (r > 0); return super.defEntity(name, type, data); }
public final boolean overlaps( final com.artemis.Entity a, int x, int y) { final Bounds b1 = bm.getSafe(a); final Pos p1 = pm.getSafe(a); if ( b1==null || p1 ==null) return false; final float minx = p1.x + b1.minx; final float miny = p1.y + b1.miny; final float maxx = p1.x + b1.maxx; final float maxy = p1.y + b1.maxy; final float bminx = x; final float bminy = y; final float bmaxx = x + 1; final float bmaxy = y + 1; return !(minx > bmaxx || maxx < bminx || miny > bmaxy || maxy < bminy ); }
/** * Return string, corresponding the given named entity. The name is passed * with the preceeding &, but without the ending semicolon. */ protected String resolveNamedEntity(final String a_tag) { // Discard & if (!a_tag.startsWith("&")) throw new AssertionError("Named entity " + a_tag + " must start witn '&'." ); String tag = a_tag.substring(1); try { Entity entity = dtd.getEntity(tag); if (entity != null) return entity.getString(); entity = dtd.getEntity(tag.toLowerCase()); if (entity != null) { error("The name of this entity should be in lowercase", a_tag); return entity.getString(); } } catch (IndexOutOfBoundsException ibx) { /* The error will be reported. */ } error("Unknown named entity", a_tag); return a_tag; }
/** Check if screen coordinates are blockaded. */ public boolean blockaded(int x, int y, Team team) { for (com.artemis.Entity entity : getActives()) { if ( !mBlockade.get(entity).passableBy.contains(team) && overlaps(entity, x, y) ) { // blockades can be passable by teams. return true; } } return false; }
private String getEntity(final char ch) { boolean useName = ch == '<' || ch == '>' || ch == '&' || ch == '"'; Entity entity = (Entity)getDTD().entityHash.get(new Integer(ch)); if (entity == null) { return null; } else if (useName) { return "&" + entity.getName() + ";"; } else { return "&#" + Integer.toString(ch) + ";"; } }
public void testName2type() { assertEquals("PUBLIC", Entity.name2type("PUBLIC"), DTDConstants.PUBLIC); assertEquals("SDATA", Entity.name2type("SDATA"), DTDConstants.SDATA); assertEquals("PI", Entity.name2type("PI"), DTDConstants.PI); assertEquals("STARTTAG", Entity.name2type("STARTTAG"), DTDConstants.STARTTAG); assertEquals("ENDTAG", Entity.name2type("ENDTAG"), DTDConstants.ENDTAG); assertEquals("MS", Entity.name2type("MS"), DTDConstants.MS); assertEquals("MD", Entity.name2type("MD"), DTDConstants.MD); assertEquals("SYSTEM", Entity.name2type("SYSTEM"), DTDConstants.SYSTEM); assertEquals("surely unknown ", Entity.name2type("audrius"), DTDConstants.CDATA ); }
public void testPublicSystemGeneralParameter() { int[] pu_sy = new int[] { DTDConstants.PUBLIC, DTDConstants.SYSTEM, 0 }; int[] gen_par = new int[] { DTDConstants.GENERAL, DTDConstants.PARAMETER, 0 }; for (int ps = 0; ps < pu_sy.length; ps++) { for (int gp = 0; gp < gen_par.length; gp++) { Entity e = new Entity(null, 0, null); e.type = pu_sy [ ps ] | gen_par [ gp ]; assertEquals(e.isGeneral(), gen_par [ gp ] == DTDConstants.GENERAL); assertEquals(e.isParameter(), gen_par [ gp ] == DTDConstants.PARAMETER ); assertEquals((e.type & DTDConstants.SYSTEM) != 0, pu_sy [ ps ] == DTDConstants.SYSTEM ); assertEquals((e.type & DTDConstants.PUBLIC) != 0, pu_sy [ ps ] == DTDConstants.PUBLIC ); assertEquals((e.type & DTDConstants.GENERAL) != 0, gen_par [ gp ] == DTDConstants.GENERAL ); assertEquals((e.type & DTDConstants.PARAMETER) != 0, gen_par [ gp ] == DTDConstants.PARAMETER ); } } }
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){ setRotationAngles(f, f1, f2, f3, f4, f5); Shape1.render(f5); }
public Entity readEntity(final int id) { throw new NoSuchEntityException(id); }
public LoadEntityResult(final Entity entity) { this.entity = entity; results = Results.NO_RESULT; }
public Entity getEntity() { return entity; }
@Override protected void processEntities(ImmutableBag<com.artemis.Entity> entities) { }