• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StringHash类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.util.text.StringHash的典型用法代码示例。如果您正苦于以下问题:Java StringHash类的具体用法?Java StringHash怎么用?Java StringHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StringHash类属于com.intellij.openapi.util.text包,在下文中一共展示了StringHash类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hashFromNameAndLoader

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private static int hashFromNameAndLoader(String name, Loader loader, int n) {
  int hash = StringHash.murmur(name, n);
  int i = loader.getIndex();
  while (i > 0) {
    hash = hash * n + ((i % 10) + '0');
    i /= 10;
  }
  return hash;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ClasspathCache.java


示例2: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int offset, boolean expected) {
    String[] strings = new String[variants.size()];
    long[] hashes = new long[strings.length];
    Arrays.fill(strings, "");
    int count = 0;
    loop: for (Variant variant : expected? variants : unexpected) {
        if (offset == variant.offset) {
            String text = variant.object.toString();
            long hash = StringHash.calc(text);
            for (int i=0; i<count; i++) {
                if (hashes[i] == hash) continue loop;
            }
            hashes[count] = hash;
            strings[count] = text;
            count++;
        }
    }
    Arrays.sort(strings);
    count = 0;
    for (String s : strings) {
        if (s == "") continue;
        if (count++ > 0) {
            if (count > MAX_VARIANTS_TO_DISPLAY) {
                sb.append(" and ...");
                break;
            }
            else {
                sb.append(", ");
            }
        }
        char c = s.charAt(0);
        String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
        sb.append(displayText);
    }
    if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
        int idx = sb.lastIndexOf(", ");
        sb.replace(idx, idx + 1, " or");
    }
    return count > 0;
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:41,代码来源:GeneratedParserUtilBase.java


示例3: getFromPool

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
public static String getFromPool(String value) {
  if (value == null) return null;
  if (value.length() == 0) return EMPTY;

  final long hash = StringHash.calc(value);
  String reused = (String) myReusableStrings.get(hash);
  if (reused != null) return reused;
  // new String() is required because value often is passed as substring which has a reference to original char array
  // see {@link String.substring(int, int} method implementation.
  //noinspection RedundantStringConstructorCall
  reused = new String(value);
  myReusableStrings.put(hash, reused);
  return reused;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:StringsPool.java


示例4: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int offset, boolean expected) {
  String[] strings = new String[variants.size()];
  long[] hashes = new long[strings.length];
  Arrays.fill(strings, "");
  int count = 0;
  loop: for (Variant variant : expected? variants : unexpected) {
    if (offset == variant.offset) {
      String text = variant.object.toString();
      long hash = StringHash.calc(text);
      for (int i=0; i<count; i++) {
        if (hashes[i] == hash) continue loop;
      }
      hashes[count] = hash;
      strings[count] = text;
      count++;
    }
  }
  Arrays.sort(strings);
  count = 0;
  for (String s : strings) {
    if (s == "") continue;
    if (count++ > 0) {
      if (count > MAX_VARIANTS_TO_DISPLAY) {
        sb.append(" and ...");
        break;
      }
      else {
        sb.append(", ");
      }
    }
    char c = s.charAt(0);
    String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
    sb.append(displayText);
  }
  if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
    int idx = sb.lastIndexOf(", ");
    sb.replace(idx, idx + 1, " or");
  }
  return count > 0;
}
 
开发者ID:Ladicek,项目名称:IntelliFrog,代码行数:41,代码来源:GeneratedParserUtilBase.java


示例5: LazyPresentablePattern

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
public LazyPresentablePattern(@NotNull Node node) {
  myNode = node;
  myHashCode = StringHash.calc(toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PatternCompilerImpl.java


示例6: maybeContains

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean maybeContains(String name, Loader loader) {
  int hash = hashFromNameAndLoader(name, loader, StringHash.murmur(name, SEED));
  int hash2 = hashFromNameAndLoader(name, loader, hash);

  return maybeContains(hash, hash2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ClasspathCache.java


示例7: add

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private void add(String name, Loader loader) {
  int hash = hashFromNameAndLoader(name, loader, StringHash.murmur(name, SEED));
  int hash2 = hashFromNameAndLoader(name, loader, hash);

  addIt(hash, hash2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ClasspathCache.java


示例8: getContentPathName

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
@NotNull
public String getContentPathName(@NotNull String id) {
  return Long.toHexString(StringHash.calc(id));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ConsoleRootType.java


示例9: getHistoryPathName

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
@NotNull
public String getHistoryPathName(@NotNull String id) {
  return Long.toHexString(StringHash.calc(id));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ConsoleRootType.java


示例10: getOldHistoryFilePath

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
@NotNull
private String getOldHistoryFilePath(final String id) {
  String pathName = myRootType.getConsoleTypeId() + Long.toHexString(StringHash.calc(id));
  return PathManager.getSystemPath() + File.separator + "userHistory" + File.separator + pathName + ".hist.xml";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ConsoleHistoryController.java


示例11: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int position, boolean expected) {
  MyList<Variant> list = expected ? variants : unexpected;
  String[] strings = new String[list.size()];
  long[] hashes = new long[strings.length];
  Arrays.fill(strings, "");
  int count = 0;
  loop: for (Variant variant : list) {
    if (position == variant.position) {
      String text = variant.object.toString();
      long hash = StringHash.calc(text);
      for (int i=0; i<count; i++) {
        if (hashes[i] == hash) continue loop;
      }
      hashes[count] = hash;
      strings[count] = text;
      count++;
    }
  }
  Arrays.sort(strings);
  count = 0;
  for (String s : strings) {
    if (s.length() == 0) continue;
    if (count++ > 0) {
      if (count > MAX_VARIANTS_TO_DISPLAY) {
        sb.append(" and ...");
        break;
      }
      else {
        sb.append(", ");
      }
    }
    char c = s.charAt(0);
    String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
    sb.append(displayText);
  }
  if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
    int idx = sb.lastIndexOf(", ");
    sb.replace(idx, idx + 1, " or");
  }
  return count > 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:GeneratedParserUtilBase.java


示例12: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int offset, boolean expected) {
  MyList<Variant> list = expected ? variants : unexpected;
  String[] strings = new String[list.size()];
  long[] hashes = new long[strings.length];
  Arrays.fill(strings, "");
  int count = 0;
  loop: for (Variant variant : list) {
    if (offset == variant.offset) {
      String text = variant.object.toString();
      long hash = StringHash.calc(text);
      for (int i=0; i<count; i++) {
        if (hashes[i] == hash) continue loop;
      }
      hashes[count] = hash;
      strings[count] = text;
      count++;
    }
  }
  Arrays.sort(strings);
  count = 0;
  for (String s : strings) {
    if (s.length() == 0) continue;
    if (count++ > 0) {
      if (count > MAX_VARIANTS_TO_DISPLAY) {
        sb.append(" and ...");
        break;
      }
      else {
        sb.append(", ");
      }
    }
    char c = s.charAt(0);
    String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
    sb.append(displayText);
  }
  if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
    int idx = sb.lastIndexOf(", ");
    sb.replace(idx, idx + 1, " or");
  }
  return count > 0;
}
 
开发者ID:hoho,项目名称:coocoo-idea-plugin,代码行数:42,代码来源:GeneratedParserUtilBase.java


示例13: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int position, boolean expected) {
    MyList<Variant> list = expected ? variants : unexpected;
    String[] strings = new String[list.size()];
    long[] hashes = new long[strings.length];
    Arrays.fill(strings, "");
    int count = 0;
    loop: for (Variant variant : list) {
        if (position == variant.position) {
            String text = variant.object.toString();
            long hash = StringHash.calc(text);
            for (int i=0; i<count; i++) {
                if (hashes[i] == hash) continue loop;
            }
            hashes[count] = hash;
            strings[count] = text;
            count++;
        }
    }
    Arrays.sort(strings);
    count = 0;
    for (String s : strings) {
        if (s.length() == 0) continue;
        if (count++ > 0) {
            if (count > MAX_VARIANTS_TO_DISPLAY) {
                sb.append(" and ...");
                break;
            }
            else {
                sb.append(", ");
            }
        }
        char c = s.charAt(0);
        String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
        sb.append(displayText);
    }
    if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
        int idx = sb.lastIndexOf(", ");
        sb.replace(idx, idx + 1, " or");
    }
    return count > 0;
}
 
开发者ID:cr4igo,项目名称:firstspiritlanguagesupport,代码行数:42,代码来源:GeneratedParserUtilBase.java


示例14: LazyPresentablePattern

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
public LazyPresentablePattern(final Node node) {
  myNode = node;
  myHashCode = StringHash.calc(toString());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:PatternCompilerImpl.java


示例15: getHistoryFilePath

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private String getHistoryFilePath(final String id) {
  return PathManager.getSystemPath() + File.separator +
         "userHistory" + File.separator +
         myType + Long.toHexString(StringHash.calc(id)) + ".hist.xml";
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:ConsoleHistoryController.java


示例16: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int position, boolean expected) {
	MyList<Variant> list = expected ? variants : unexpected;
	String[] strings = new String[list.size()];
	long[] hashes = new long[strings.length];
	Arrays.fill(strings, "");
	int count = 0;
	loop: for (Variant variant : list) {
		if (position == variant.position) {
			String text = variant.object.toString();
			long hash = StringHash.calc(text);
			for (int i=0; i<count; i++) {
				if (hashes[i] == hash) continue loop;
			}
			hashes[count] = hash;
			strings[count] = text;
			count++;
		}
	}
	Arrays.sort(strings);
	count = 0;
	for (String s : strings) {
		if (s.length() == 0) continue;
		if (count++ > 0) {
			if (count > MAX_VARIANTS_TO_DISPLAY) {
				sb.append(" and ...");
				break;
			}
			else {
				sb.append(", ");
			}
		}
		char c = s.charAt(0);
		String displayText = c == '<' || StringUtil.isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
		sb.append(displayText);
	}
	if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
		int idx = sb.lastIndexOf(", ");
		sb.replace(idx, idx + 1, " or");
	}
	return count > 0;
}
 
开发者ID:JanTvrdik,项目名称:intellij-latte,代码行数:42,代码来源:GeneratedParserUtilBase.java


示例17: addExpected

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private boolean addExpected(StringBuilder sb, int position, boolean expected) {
    MyList<Variant> list = expected ? variants : unexpected;
    String[] strings = new String[list.size()];
    long[] hashes = new long[strings.length];
    Arrays.fill(strings, "");
    int count = 0;
    loop: for (Variant variant : list) {
        if (position == variant.position) {
            String text = variant.object.toString();
            long hash = StringHash.calc(text);
            for (int i=0; i<count; i++) {
                if (hashes[i] == hash) continue loop;
            }
            hashes[count] = hash;
            strings[count] = text;
            count++;
        }
    }
    Arrays.sort(strings);
    count = 0;
    for (String s : strings) {
        if (s.length() == 0) continue;
        if (count++ > 0) {
            if (count > MAX_VARIANTS_TO_DISPLAY) {
                sb.append(" and ...");
                break;
            }
            else {
                sb.append(", ");
            }
        }
        char c = s.charAt(0);
        String displayText = c == '<' || isJavaIdentifierStart(c) ? s : '\'' + s + '\'';
        sb.append(displayText);
    }
    if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) {
        int idx = sb.lastIndexOf(", ");
        sb.replace(idx, idx + 1, " or");
    }
    return count > 0;
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:42,代码来源:GeneratedParserUtilBase.java


示例18: calcType

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private static String calcType(Object userObject) {
  String name = userObject.getClass().getName();
  return Integer.toHexString(StringHash.murmur(name, 31)) + ":" + StringUtil.getShortName(name);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:TreeState.java


示例19: hashColor

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
private static int hashColor(@Nonnull String name, int colorsCount) {
  return Math.abs(StringHash.murmur(name, 0x55AA)) % colorsCount;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:4,代码来源:UsedColors.java


示例20: getContentPathName

import com.intellij.openapi.util.text.StringHash; //导入依赖的package包/类
@Nonnull
public String getContentPathName(@Nonnull String id) {
  return Long.toHexString(StringHash.calc(id));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ConsoleRootType.java



注:本文中的com.intellij.openapi.util.text.StringHash类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CorbaMessageMediatorImpl类代码示例发布时间:2022-05-22
下一篇:
Java XThrowExpression类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap