コード例 #1
0
  @Override
  protected boolean isTokenChar(int c) {

    if (Character.getName(c).equals("NUMBER SIGN")
        || Character.getName(c).equals("COMMERCIAL AT")
        || Character.getName(c).equals("LOW LINE")
        || Character.isDigit(c)) return true;

    // System.out.println(Character.getName(c));
    return Character.isLetter(c);
  }
コード例 #2
0
ファイル: DebugPlugin.java プロジェクト: mmx900/ManalithBot
 @BotCommand
 public String len(String values) {
   char first = StringUtils.left(values, 1).charAt(0);
   char last = StringUtils.right(values, 1).charAt(0);
   return String.format(
       "%d char / %d bytes ('%s' %s ~ '%s' %s)",
       values.length(),
       values.getBytes(Charset.forName("UTF-8")).length,
       first,
       Character.getName(first),
       last,
       Character.getName(last));
 }
コード例 #3
0
ファイル: DataActivity.java プロジェクト: kkauck/Java1
  private void displayInfo(Character character) {

    ((TextView) findViewById(R.id.toonNameLabel)).setText(character.getName());
    ((TextView) findViewById(R.id.toonLevelLabel)).setText(character.getLevel().toString());
    ((TextView) findViewById(R.id.realmNameLabel)).setText(character.getServer());
    ((TextView) findViewById(R.id.battlegroupLabel)).setText(character.getBattlegroup());
    ((TextView) findViewById(R.id.achievementLabel))
        .setText(character.getAchievements().toString());
    ((TextView) findViewById(R.id.honorableKillsLabel))
        .setText(character.getHonorableKills().toString());
  }
コード例 #4
0
 public Animation(Character character, String name, int repeat, int framerate) {
   TextureAtlas atlas =
       SpriteSheetService.getInstance()
           .getSpriteSheet(character.getName().toLowerCase() + "_" + name);
   for (TextureRegion texture : atlas.getRegions()) {
     this.getTextures().add(texture);
     this.width = texture.getRegionWidth();
     this.height = texture.getRegionHeight();
   }
   this.framerate = framerate;
   this.repeat = repeat;
 }
コード例 #5
0
ファイル: Event.java プロジェクト: Nightloyd/T3kken-2
  public void fajt(Character a, Character b) {
    while (true) {
      int dam = a.hit(b);
      b.setHp(b.getHp() - dam);

      if (b.getHp() < 1) {
        b.dies();
        System.out.println(a.getName() + " har krossat " + b.getName());
        System.out.println(
            "Det verkar som om " + a.getWeapon().getType() + " är ett överlägset vapen.");
        break;
      }

      dam = b.hit(a);
      a.setHp(a.getHp() - dam);
      if (a.getHp() < 1) {
        a.dies();
        System.out.println(b.getName() + " har krossat " + a.getName());
        System.out.println(
            "Det verkar som om " + b.getWeapon().getType() + " är ett överlägset vapen.");
        break;
      }
    }
  }
コード例 #6
0
  public void test_getName() throws Exception {
    // Character.getName requires the corresponding ICU data.
    // Changed from "NULL" and "BELL" by Unicode 49.2
    assertEquals("<control-0000>", Character.getName(0x0000));
    assertEquals("<control-0007>", Character.getName(0x0007));
    assertEquals("LATIN SMALL LETTER L", Character.getName('l'));
    // This changed name from Unicode 1.0. Used to be "OPENING...".
    assertEquals("LEFT CURLY BRACKET", Character.getName('{'));
    assertEquals("ARABIC-INDIC DIGIT SIX", Character.getName(0x0666));
    assertEquals("LINEAR B SYLLABLE B008 A", Character.getName(0x010000));

    // Some private use code points.
    assertEquals("PRIVATE USE AREA E000", Character.getName(0xe000));
    assertEquals("SUPPLEMENTARY PRIVATE USE AREA A F0000", Character.getName(0xf0000));

    // An unassigned code point.
    assertNull(Character.getName(0x10ffff));

    try {
      Character.getName(-1);
      fail();
    } catch (IllegalArgumentException expected) {
    }
    try {
      Character.getName(Integer.MAX_VALUE);
      fail();
    } catch (IllegalArgumentException expected) {
    }
    try {
      Character.getName(Integer.MIN_VALUE);
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }
コード例 #7
0
  public void run3() {
    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();
    // Session session = Factory.getSession(SessionType.CURRENT);

    try {

      timelog("Beginning graph2 test3...");

      DElementStore crewStore = new DElementStore();
      crewStore.setStoreKey(crewPath);
      crewStore.addType(Crew.class);
      DElementStore movieStore = new DElementStore();
      movieStore.setStoreKey(moviePath);
      movieStore.addType(Movie.class);
      DElementStore characterStore = new DElementStore();
      characterStore.setStoreKey(charactersPath);
      characterStore.addType(Character.class);
      DElementStore edgeStore = new DElementStore();
      edgeStore.setStoreKey(edgePath);
      DConfiguration config = new DConfiguration();
      graph = new DGraph(config);
      config.addElementStore(crewStore);
      config.addElementStore(movieStore);
      config.addElementStore(characterStore);
      config.addElementStore(edgeStore);
      config.setDefaultElementStore(edgeStore.getStoreKey());
      DFramedGraphFactory factory = new DFramedGraphFactory(config);

      FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);

      Movie newhopeMovie = framedGraph.getVertex("Star Wars", Movie.class);
      Movie empireMovie = framedGraph.getVertex("The Empire Strikes Back", Movie.class);
      Movie jediMovie = framedGraph.getVertex("Return of the Jedi", Movie.class);
      Movie phantomMovie = framedGraph.getVertex("The Phantom Menace", Movie.class);
      Movie clonesMovie = framedGraph.getVertex("Attack of the Clones", Movie.class);
      Movie revengeMovie = framedGraph.getVertex("Revenge of the Sith", Movie.class);

      System.out.println("***************************");
      System.out.println(
          "Don't miss "
              + newhopeMovie.getTitle()
              + " "
              + newhopeMovie.getDirectedBy().getRating()
              + " stars!");

      List<Starring> starrings = (List) newhopeMovie.getStarring();
      for (Starring starring : starrings) {
        Crew crew = starring.getStar();
        Character character = crew.getPortraysCharacters().iterator().next();
        System.out.println(
            crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
      }

      System.out.println("***************************");
      System.out.println(
          "Don't miss "
              + empireMovie.getTitle()
              + " "
              + empireMovie.getDirectedBy().getRating()
              + " stars!");
      starrings = (List) empireMovie.getStarring();
      for (Starring starring : starrings) {
        Crew crew = starring.getStar();
        Character character = crew.getPortraysCharacters().iterator().next();
        System.out.println(
            crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
      }

      System.out.println("***************************");
      System.out.println(
          "Don't miss "
              + jediMovie.getTitle()
              + " "
              + jediMovie.getDirectedBy().getRating()
              + " stars!");
      starrings = (List) jediMovie.getStarring();
      System.out.println("TEMP DEBUG found " + starrings.size() + " starrings");
      for (Starring starring : starrings) {
        Crew crew = starring.getStar();
        Character character = crew.getPortraysCharacters().iterator().next();
        System.out.println(
            crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName());
      }

    } catch (Throwable t) {
      t.printStackTrace();
    }
  }