Examples of Segment


Examples of org.nutz.lang.segment.Segment

    assertEquals("-HH-", seg.toString());
  }

  @Test
  public void testAddPP2() {
    Segment seg = Segments.create("-${A}-${B}-");
    seg.add("A", "A");
    seg.add("A", "B");
    seg.add("A", "C");
    seg.add("B", "H");
    seg.add("B", "M");
    assertEquals("-ABC-HM-", seg.toString());
    seg.set("B", "ZZH");
    assertEquals("-ABC-ZZH-", seg.toString());
  }
View Full Code Here

Examples of org.nutz.lang.segment.Segment

    assertEquals("-ABC-ZZH-", seg.toString());
  }

  @Test
  public void testAddPP3() {
    Segment seg = Segments.create("-${A}-${B}-");
    Segment sub = Segments.create("[${V}]");
    Segment sub2 = Segments.create("%${V}%");
    seg.add("A", sub);
    seg.add("A", sub2);
    seg.set("B", "***");
    sub.set("V", "#");
    sub2.set("V", "@");
    assertEquals("-[#]%@%-***-", seg.toString());
    seg.set("B", "ZZH");
    assertEquals("-[#]%@%-ZZH-", seg.toString());
  }
View Full Code Here

Examples of org.nutz.lang.segment.Segment

  }

  @Test
  public void testChineseChar() {
    String s = new StringBuilder().append((char) Integer.parseInt("6211", 16)).toString();
    Segment seg = Segments.create(s);
    assertTrue(s.equals(seg.toString()));
  }
View Full Code Here

Examples of org.nutz.lang.segment.Segment

    Segment seg = Segments.create(s);
    assertTrue(s.equals(seg.toString()));
  }

  public void test_blankKeys() {
    Segment seg = Segments.create("1${A}2${B}3${C}4${D}5");
    // assertEquals(4, seg.blankKeys().size());

    seg.set("A", 34);
    seg.set("D", "GG");
    // assertEquals(2, seg.blankKeys().size());
  }
View Full Code Here

Examples of org.nutz.lang.segment.Segment

          }

          // 将本地化字符串增加到当前语言
          for (String key : p.keySet()) {
            String str = p.get(key);
            Segment seg = (new CharSegment()).valueOf(str);
            if (seg.keys().isEmpty())
              msgs.put(key, str);
            else
              msgs.put(key, seg);
          }
View Full Code Here

Examples of org.w3c.jigsaw.ssi.Segment

    public Object unpickle(DataInputStream in)
  throws IOException
    {
  int n = in.readInt() ;
 
  Segment segs[] = new Segment [n] ;

  for(int i=0;i<n;i++)
      segs[i] = Segment.unpickle(in) ;
 
  return segs ;
View Full Code Here

Examples of ru.dubov.primitives.Segment

            p2 = new Point(evt.getX(), evt.getY());
        } else if (c == 2) {
            p3 = new Point(evt.getX(), evt.getY());
        } else if (c == 3) {
            p4 = new Point(evt.getX(), evt.getY());
            Segment s1 = new Segment(p1, p2);
            Segment s2 = new Segment(p3, p4);
            intersection = SegmentsIntersect.two(s1, s2);
        }
       
        c++;
       
View Full Code Here

Examples of systole.domain.signals.Segment

     *
     * @param segments list of segment selected
     * @return the final segment
     */
    public Segment process(Collection<SelectedSegment> segments) {
        Segment finalSegment = new Segment();
        int amountOfSements = segments.size();
         Iterator<SelectedSegment> it = segments.iterator();
         int minAmount = Integer.MAX_VALUE;
         while(it.hasNext()){
         int current = it.next().getSegment().size();
         minAmount = (minAmount>current)?current:minAmount;
         }
        int j = 0;
        BigDecimal prom;
        while ((minAmount>j)) {
            prom = BigDecimal.ZERO;
            Iterator<SelectedSegment> itSegments = segments.iterator();
            while (itSegments.hasNext()) {
                SelectedSegment selectedSegment = itSegments.next();
                if ((selectedSegment.getSegment().size() > j)) {
                    prom = prom.add(selectedSegment.getSegment().elementAt(j));
                }
            }
            finalSegment.add(prom.divide(new BigDecimal(amountOfSements),MathUtils.CONTEXT));
            j++;
        }
        finalSegment = finalSegment.removeTrend();
        return finalSegment;
    }
View Full Code Here

Examples of tool.editors.ToolContentOutlinePage.Segment

        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = attributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("attribute", sig.group(1))));
        }
        region = frAdapter.find(offset+length, ATTRIBUTE_REGEX, true, false, false, true);
      }
      // do the virtual attributes
      region = frAdapter.find(0, VIRTUAL_ATTRIBUTE_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = virtualAttributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("virtual", sig.group(1))));
        }
        region = frAdapter.find(offset+length, VIRTUAL_ATTRIBUTE_REGEX, true, false, false, true);
      }
      // do the window attributes
      region = frAdapter.find(0, WINDOW_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = windowAttributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(1);
          fContent.add(new Segment(attributeLabel, p, "icons/window_attribute.gif"));
        }
        region = frAdapter.find(offset+length, WINDOW_REGEX, true, false, false, true);
      }
      // do the class constants
      region = frAdapter.find(0, CONSTANT_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = constantPattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("constant", sig.group(1))));
        }
        region = frAdapter.find(offset+length, CONSTANT_REGEX, true, false, false, true);
      }
      // do the method implementations
      region = frAdapter.find(0, CEX_SIGNATURE_REGEX, true, false, false, true);
      String methodSignature = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        methodSignature = document.get(region.getOffset(), region.getLength());
        Matcher sig = cexSignaturePattern.matcher(methodSignature);
        if (sig.find()){
          methodSignature = sig.group(1);
          fContent.add(new Segment(makeLabel(methodSignature), p, "icons/private_method.gif"));
        }
        region = frAdapter.find(offset+length, CEX_SIGNATURE_REGEX, true, false, false, true);
      }
//      // do the event handlers
//      region = frAdapter.find(0, ToolEventHandler.CEX_SIGNATURE_REGEX, true, false, false, true);
View Full Code Here

Examples of vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment

      particleAge = -(int) (length * speed);

      boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
      boundingBox.setBB(AxisAlignedBB.getBoundingBox(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2));

      segments.add(new Segment(start, end));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.