當前位置: 首頁>>代碼示例>>Java>>正文


Java CacheUtil類代碼示例

本文整理匯總了Java中xdean.jex.util.cache.CacheUtil的典型用法代碼示例。如果您正苦於以下問題:Java CacheUtil類的具體用法?Java CacheUtil怎麽用?Java CacheUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CacheUtil類屬於xdean.jex.util.cache包,在下文中一共展示了CacheUtil類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTasks

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public List<Function<String, Paint>> getTasks() {
  return CacheUtil.cache(CSSPaintPaser.class, () -> Arrays.asList(
      text -> Color.web(text, 1),
      text -> LinearGradient.valueOf(text),
      text -> RadialGradient.valueOf(text),
      text -> context.lookup(text),
      text -> DeriveColorConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> LadderConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> LinearGradientConverter.getInstance().convert(factory.apply(text), Font.getDefault()),
      text -> RadialGradientConverter.getInstance().convert(factory.apply(text), Font.getDefault())
      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:13,代碼來源:CSSPaintPaser.java

示例2: nestListProp

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public static <F, T> ListProperty<T> nestListProp(ObservableValue<F> pf, Function<F, ListProperty<T>> func) {
  ListProperty<T> current = func.apply(pf.getValue());
  ListProperty<T> nestProp = new SimpleListProperty<>();
  CacheUtil.set(BeanUtil.class, nestProp, current);
  nestProp.bindBidirectional(current);
  pf.addListener((ob, o, n) -> {
    CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContentBidirectional(p));
    ListProperty<T> pt = func.apply(n);
    CacheUtil.set(BeanUtil.class, nestProp, pt);
    nestProp.bindContentBidirectional(pt);
  });
  return nestProp;
}
 
開發者ID:XDean,項目名稱:JavaFX-EX,代碼行數:14,代碼來源:BeanUtil.java

示例3: nestListValue

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public static <F, T> ObservableList<T> nestListValue(ObservableValue<F> pf, Function<F, ObservableList<T>> func) {
  ObservableList<T> current = func.apply(pf.getValue());
  ListProperty<T> nestProp = new SimpleListProperty<>();
  CacheUtil.set(BeanUtil.class, nestProp, current);
  nestProp.bindContent(current);
  pf.addListener((ob, o, n) -> {
    CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContent(p));
    ObservableList<T> pt = func.apply(n);
    CacheUtil.set(BeanUtil.class, nestProp, pt);
    nestProp.bindContent(pt);
  });
  return nestProp;
}
 
開發者ID:XDean,項目名稱:JavaFX-EX,代碼行數:14,代碼來源:BeanUtil.java

示例4: seriesTimeThen

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
/**
 * @param uniqueKey unique key
 * @param r the task
 * @param then (this time, total time) -&#62; {...}
 */
public static void seriesTimeThen(Object uniqueKey, Runnable r, BiConsumer<Long, Long> then) {
  Stopwatch total = CacheUtil.cache(TimingUtil.class, uniqueKey, () -> Stopwatch.createUnstarted());
  Stopwatch temp = getShareStopwatch();
  temp.reset();
  temp.start();
  total.start();
  r.run();
  temp.stop();
  total.stop();
  if (then != null) {
    then.accept(temp.elapsed(TimeUnit.MILLISECONDS), total.elapsed(TimeUnit.MILLISECONDS));
  }
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:19,代碼來源:TimingUtil.java

示例5: initKey

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private void initKey() {
    commandColumn.setCellValueFactory(cdf -> new SimpleStringProperty(cdf.getValue().getDescribe()));
    bindingColumn.setCellValueFactory(cdf -> CacheUtil.cache(OptionsController.this,
        cdf.getValue(), () -> new SimpleObjectProperty<>(cdf.getValue().get())));
//    bindingColumn.setCellValueFactory(cdf -> new SimpleObjectProperty<>(cdf.getValue().get()));

    bindingColumn.setEditable(true);
    bindingColumn.setCellFactory(column -> new KeyEditField());

    keyTable.getItems().setAll(Options.KEY.getChildren(KeyCombination.class));
    onSubmit.add(() -> keyTable.getItems().forEach(key -> key.set(bindingColumn.getCellData(key))));
  }
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:13,代碼來源:OptionsController.java

示例6: TabEntity

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
TabEntity() {
  this.tab = new Tab();
  this.manager = new CodeAreaManager(new CodeArea());
  this.codeArea = manager.getCodeArea();
  this.file = new SimpleObjectProperty<>();
  this.name = new SimpleStringProperty();
  this.icon = new FontAwesomeIconView();
  this.order = new SimpleIntegerProperty(nameOrder.next());

  init();

  CacheUtil.cache(MainFrameController.this, tab, () -> this);
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:14,代碼來源:MainFrameController.java

示例7: init

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private void init() {
  // name
  name.bind(Bindings.when(file.isNull())
      .then(Bindings.createStringBinding(() -> "new" + order.get(), order))
      .otherwise(toStringBinding(map(file, f -> f.getName()))));

  // graphics
  tab.setGraphic(icon);
  icon.setStyleClass("tab-icon");
  icon.setIcon(FontAwesomeIcon.SAVE);
  // Hold the object in cache to avoid gc
  StringBinding state = CacheUtil.cache(this, "state",
      () -> Bindings.when(Bindings.equal(toObjectBinding(currentTabEntity()), this))
          .then(Bindings.when(manager.modifiedProperty())
              .then("selected-modified")
              .otherwise("selected"))
          .otherwise(Bindings.when(manager.modifiedProperty())
              .then("modified")
              .otherwise("")));
  state.addListener((ob, o, n) -> {
    uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(o), false));
    uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(n), true));
  });

  // recent
  file.addListener((ob, o, n) -> todoAll(
      () -> ifThat(n != null).todo(() -> recentSupport.setLastFile(n)),
      () -> ifThat(o == null && n != null).todo(() -> releaseName())
      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:31,代碼來源:MainFrameController.java

示例8: currentTabEntity

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private ObservableValue<TabEntity> currentTabEntity() {
  return CacheUtil.cache(this, "currentTabEntity", () -> {
    ObjectProperty<TabEntity> op = new SimpleObjectProperty<>();
    op.bind(map(tabPane.getSelectionModel().selectedIndexProperty(),
        i -> uncatch(() -> tabList.get(i.intValue()))));
    return op;
  });
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:9,代碼來源:MainFrameController.java

示例9: currentCodeArea

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private ObservableValue<CodeArea> currentCodeArea() {
  return CacheUtil.cache(this, "currentCodeArea", () -> {
    ObjectProperty<CodeArea> op = new SimpleObjectProperty<CodeArea>();
    op.bind(map(currentManager(), m -> uncatch(() -> m.getCodeArea())));
    return op;
  });
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:8,代碼來源:MainFrameController.java

示例10: indexOfIgnoreCase

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public static int indexOfIgnoreCase(String str, String target, int startIndex) {
  return CacheUtil.cache(str, "lowerCase", () -> str.toLowerCase())
      .indexOf(CacheUtil.cache(target, "lowerCase", () -> target.toLowerCase()), startIndex);
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:5,代碼來源:StringUtil.java

示例11: getShareStopwatch

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private static Stopwatch getShareStopwatch() {
  Stopwatch share = CacheUtil.cache(TimingUtil.class, Thread.currentThread(), () -> Stopwatch.createUnstarted());
  return share.isRunning() ? Stopwatch.createUnstarted() : share;
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:5,代碼來源:TimingUtil.java

示例12: getTasks

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public List<Function<String, Border>> getTasks() {
  return CacheUtil.cache(CSSPaintPaser.class, () -> Arrays.asList(

      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:6,代碼來源:CSSBorderPaser.java

示例13: CSSPaintPaser

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
public CSSPaintPaser(CSSContext context) {
  this.context = context;
  this.inlineNode = new Group();
  this.factory = text -> context.resolve(CacheUtil.cache(this, text, () -> getParsedValue(text)));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:6,代碼來源:CSSPaintPaser.java

示例14: modifiedProperty

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
private ObservableValue<Boolean> modifiedProperty() {
  return CacheUtil.cache(this, "modified", () -> nestValue(currentManager(), m -> m.modifiedProperty()));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:MainFrameController.java

示例15: findEntity

import xdean.jex.util.cache.CacheUtil; //導入依賴的package包/類
Optional<TabEntity> findEntity(Tab t) {
  return CacheUtil.get(MainFrameController.this, t);
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:4,代碼來源:MainFrameController.java


注:本文中的xdean.jex.util.cache.CacheUtil類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。