id
stringlengths
7
14
text
stringlengths
1
106k
1263661_2
@Override public boolean isValid() { byte[] verify = this.capability.getVerificationKey(); byte[] fromServer = this.getPublicKeyHash(); int n = fromServer.length; if (verify.length != fromServer.length) { return false; } for (int i = 0; i < n; i++) { if (verify[i] != fromServer[i]) { return false; } } ...
1263661_3
public CSVFolder getShareFolder() { return this.sharedfolder; }
1263661_4
public CSVFile uploadFile(CSVFile file) throws ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException { return (CSVFile) uploadObject(file); }
1263661_5
public CSVFile downloadFile(CSVFile file) throws ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException, RemoteFileDoesNotExistException, FailedToVerifySignatureException { return (CSVFile) downloadObject(file); }
1263661_6
public CSVFolder uploadFolder(CSVFolder folder) throws ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException { return (CSVFolder) uploadObject(folder); }
1263661_7
public CSVFolder downloadFolder(CSVFolder folder) throws ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException, RemoteFileDoesNotExistException, FailedToVerifySignatureException { return (CSVFolder) downloadObject(folder); }
1263661_8
public CSVFolder cd(String alias) throws ServerCommunicationException, RemoteFileDoesNotExistException, NoSuchAliasException, FailedToVerifySignatureException { if (alias.equals("..")) { this.location.pop(); return this.location.peek(); } if (!this.location.peek().getContents().containsKey(alias)) { throw ...
1263661_9
public CSVFile downloadFile(CSVFile file) throws ServerCommunicationException, InvalidWriteEnablerException, ImmutableFileExistsException, RemoteFileDoesNotExistException, FailedToVerifySignatureException { return (CSVFile) downloadObject(file); }
1269176_0
public static String formatMemorySize(long memorySizeBytes) { StringBuilder builder = new StringBuilder(); MemSize best = MemSize.getBestMemSize(memorySizeBytes); double value = MemSize.getBestMemSizeValue(memorySizeBytes, best); DecimalFormat df = new DecimalFormat("##.#"); builder.append(df.f...
1269176_1
public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) ...
1269176_2
public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) ...
1269176_3
public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) ...
1269176_4
public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) ...
1269176_5
public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) ...
1269176_6
public static int figureAngle(Point2D end1, Point2D end2) { return figureAngle(end2.getX() - end1.getX(), end2.getY() - end1.getY()); }
1269176_7
}
1269176_8
}
1269176_9
public static boolean isSmallInt(long v) { return ((v - MIN_SMALL_COORD) & Integer.MIN_VALUE) == 0; }
1273791_1
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_2
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_3
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_4
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_5
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_6
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_7
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_8
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1273791_9
@Override public List<Token> tokenize(String text) { return createTokenList(text); }
1274071_0
public PreorderNodeListGenerator resolve(String coordinate, List<RemoteRepository> repositories) throws MavenResolverException { try { Dependency project = new Dependency(new DefaultArtifact(coordinate), "compile"); CollectRequest collectRequest = new CollectRequest(); collectRequest...
1274071_1
public static Result execute(List<AdaptationCommand> cmds) { Result result = new Result(); for (AdaptationCommand cmd : cmds) { try { cmd.execute(); result.executedCmds.add(cmd); } catch (KevoreeAdaptationException e) { result.error = e; return res...
1274071_2
public static Result execute(List<AdaptationCommand> cmds) { Result result = new Result(); for (AdaptationCommand cmd : cmds) { try { cmd.execute(); result.executedCmds.add(cmd); } catch (KevoreeAdaptationException e) { result.error = e; return res...
1274071_3
public static Result execute(List<AdaptationCommand> cmds) { Result result = new Result(); for (AdaptationCommand cmd : cmds) { try { cmd.execute(); result.executedCmds.add(cmd); } catch (KevoreeAdaptationException e) { result.error = e; return res...
1274071_4
public static Result execute(List<AdaptationCommand> cmds) { Result result = new Result(); for (AdaptationCommand cmd : cmds) { try { cmd.execute(); result.executedCmds.add(cmd); } catch (KevoreeAdaptationException e) { result.error = e; return res...
1274332_0
public boolean simpleBind (String dn, String password) { Hashtable<String, String> env = new Hashtable<String, String>(); // Set up environment properties needed for binding. env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, _uri); env.put(Co...
1274332_1
public boolean simpleBind (String dn, String password) { Hashtable<String, String> env = new Hashtable<String, String>(); // Set up environment properties needed for binding. env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, _uri); env.put(Co...
1274332_2
public boolean simpleBind (String dn, String password) { Hashtable<String, String> env = new Hashtable<String, String>(); // Set up environment properties needed for binding. env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, _uri); env.put(Co...
1274332_3
public boolean simpleBind (String dn, String password) { Hashtable<String, String> env = new Hashtable<String, String>(); // Set up environment properties needed for binding. env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, _uri); env.put(Co...
1274332_4
public boolean unbind () { // Can't unbind if we never got bound in the first place! if (_ctx == null) { return false; } try { _ctx.close(); } catch (NamingException e) { //e.printStackTrace(); return false; } return true; }
1274332_5
public static BooleanValue ldap_bind (LdapLinkResource linkIdentifier, @Optional String bindRdn, @Optional String bindPassword) { boolean success = linkIdentifier.simpleBind(bindRdn, bindPassword); return BooleanValue.create(success); }
1274332_6
public static BooleanValue ldap_bind (LdapLinkResource linkIdentifier, @Optional String bindRdn, @Optional String bindPassword) { boolean success = linkIdentifier.simpleBind(bindRdn, bindPassword); return BooleanValue.create(success); }
1274332_7
public static BooleanValue ldap_bind (LdapLinkResource linkIdentifier, @Optional String bindRdn, @Optional String bindPassword) { boolean success = linkIdentifier.simpleBind(bindRdn, bindPassword); return BooleanValue.create(success); }
1274332_8
public static BooleanValue ldap_bind (LdapLinkResource linkIdentifier, @Optional String bindRdn, @Optional String bindPassword) { boolean success = linkIdentifier.simpleBind(bindRdn, bindPassword); return BooleanValue.create(success); }
1274332_9
public static BooleanValue ldap_unbind (LdapLinkResource linkIdentifier) { // Avoid NPEs from this being called on non-existent linkIdentifiers. if (linkIdentifier == null) { return BooleanValue.create(false); } boolean success = linkIdentifier.unbind(); return BooleanValue.create(success); ...
1287669_0
@Override public <T> T read(String path, Predicate... filters) { notEmpty(path, "path can not be null or empty"); return read(pathFromCache(path, filters)); }
1287669_1
boolean isUpstreamDefinite() { if (upstreamDefinite == null) { upstreamDefinite = isRoot() || prev.isTokenDefinite() && prev.isUpstreamDefinite(); } return upstreamDefinite; }
1287669_2
boolean isUpstreamDefinite() { if (upstreamDefinite == null) { upstreamDefinite = isRoot() || prev.isTokenDefinite() && prev.isUpstreamDefinite(); } return upstreamDefinite; }
1287669_3
public static String join(String delimiter, String wrap, Iterable<?> objs) { Iterator<?> iter = objs.iterator(); if (!iter.hasNext()) { return ""; } StringBuilder buffer = new StringBuilder(); buffer.append(wrap).append(iter.next()).append(wrap); while (iter.hasNext()) { buffer.a...
1287669_4
public static String concat(CharSequence... strings) { if (strings.length == 0) { return ""; } if (strings.length == 1) { return strings[0].toString(); } int length = 0; // -1 = no result, -2 = multiple results int indexOfSingleNonEmptyString = -1; for (int i = 0; i < str...
1287669_5
public static String escape(String str, boolean escapeSingleQuote) { if (str == null) { return null; } int len = str.length(); StringWriter writer = new StringWriter(len * 2); for (int i = 0; i < len; i++) { char ch = str.charAt(i); // handle unicode if (ch > 0xfff) {...
1287669_6
public static String unescape(String str) { if (str == null) { return null; } int len = str.length(); StringWriter writer = new StringWriter(len); StringBuilder unicode = new StringBuilder(4); boolean hadSlash = false; boolean inUnicode = false; for (int i = 0; i < len; i++) { ...
1287669_7
public static String unescape(String str) { if (str == null) { return null; } int len = str.length(); StringWriter writer = new StringWriter(len); StringBuilder unicode = new StringBuilder(4); boolean hadSlash = false; boolean inUnicode = false; for (int i = 0; i < len; i++) { ...
1287669_8
public static String hex(char ch) { return Integer.toHexString(ch).toUpperCase(); }
1287669_9
public static boolean isEmpty(CharSequence cs) { return cs == null || cs.length() == 0; }
1290826_0
boolean verify_otp(String userName, String otp) { try { String authString = userName + ":" + otp; String authStringEnc = Base64.encodeBase64URLSafeString(authString.getBytes()); BufferedReader in = attemptAuthentication(authStringEnc); String inputLine; while ((inputLine = in.readLine()) != null) { if (in...
1290826_1
boolean verify_otp(String userName, String otp) { try { String authString = userName + ":" + otp; String authStringEnc = Base64.encodeBase64URLSafeString(authString.getBytes()); BufferedReader in = attemptAuthentication(authStringEnc); String inputLine; while ((inputLine = in.readLine()) != null) { if (in...
1290826_2
;
1290826_3
;
1290826_4
public static boolean isValidOTPFormat(String otp) { if (otp == null){ return false; } int len = otp.length(); for (char c : otp.toCharArray()) { if (c < 0x20 || c > 0x7E) { return false; } } return OTP_MIN_LEN <= len && len <= OTP_MAX_LEN; }
1290826_5
public static boolean isValidOTPFormat(String otp) { if (otp == null){ return false; } int len = otp.length(); for (char c : otp.toCharArray()) { if (c < 0x20 || c > 0x7E) { return false; } } return OTP_MIN_LEN <= len && len <= OTP_MAX_LEN; }
1290826_6
public static boolean isValidOTPFormat(String otp) { if (otp == null){ return false; } int len = otp.length(); for (char c : otp.toCharArray()) { if (c < 0x20 || c > 0x7E) { return false; } } return OTP_MIN_LEN <= len && len <= OTP_MAX_LEN; }
1290826_7
;
1290826_8
public static String getPublicId(String otp) { if ((otp == null) || (otp.length() < OTP_MIN_LEN)){ //not a valid OTP format, throw an exception throw new IllegalArgumentException("The OTP is too short to be valid"); } Integer len = otp.length(); /* The OTP part is always the last 32 bytes of otp. Whatever is ...
1290826_9
public static String getPublicId(String otp) { if ((otp == null) || (otp.length() < OTP_MIN_LEN)){ //not a valid OTP format, throw an exception throw new IllegalArgumentException("The OTP is too short to be valid"); } Integer len = otp.length(); /* The OTP part is always the last 32 bytes of otp. Whatever is ...
1293378_0
public float getCrossover() { return crossover; }
1293378_1
public float getElitism() { return elitism; }
1293378_2
public float getMutation() { return mutation; }
1293378_3
public Chromosome[] getPopulation() { Chromosome[] arr = new Chromosome[popArr.length]; System.arraycopy(popArr, 0, arr, 0, popArr.length); return arr; }
1293378_4
public void evolve() { // Create a buffer for the new generation Chromosome[] buffer = new Chromosome[popArr.length]; // Copy over a portion of the population unchanged, based on // the elitism ratio. int idx = Math.round(popArr.length * elitism); System.arraycopy(popArr, 0, buffer, 0, idx); // Iterate over t...
1293378_5
public int getFitness() { return fitness; }
1293378_6
public Chromosome mutate() { char[] arr = gene.toCharArray(); int idx = rand.nextInt(arr.length); int delta = (rand.nextInt() % 90) + 32; arr[idx] = (char) ((arr[idx] + delta) % 122); return new Chromosome(String.valueOf(arr)); }
1293378_7
public Chromosome[] mate(Chromosome mate) { // Convert the genes to arrays to make thing easier. char[] arr1 = gene.toCharArray(); char[] arr2 = mate.gene.toCharArray(); // Select a random pivot point for the mating int pivot = rand.nextInt(arr1.length); // Provide a container for the child gene data ch...
1293378_8
@Override public int compareTo(Chromosome c) { if (fitness < c.fitness) { return -1; } else if (fitness > c.fitness) { return 1; } return 0; }
1293378_9
@Override public boolean equals(Object o) { if (!(o instanceof Chromosome)) { return false; } Chromosome c = (Chromosome) o; return (gene.equals(c.gene) && fitness == c.fitness); }
1294371_2
public Set<K> keySet() { return new KeySet(); }
1294371_3
public void advance(int offset) throws IllegalArgumentException { if (offset == 0) { return; } int newStart = myStart + offset; if (newStart < 0) { throw new IllegalArgumentException(String.format( "Can't apply given offset (%d) to the current text change object (%s). Reason: new start index becom...
1294371_4
public void advance(int offset) throws IllegalArgumentException { if (offset == 0) { return; } int newStart = myStart + offset; if (newStart < 0) { throw new IllegalArgumentException(String.format( "Can't apply given offset (%d) to the current text change object (%s). Reason: new start index becom...
1294371_5
@NotNull public List<IncrementalCacheUpdateEvent> getEvents() { return myEvents; }
1294371_6
@NotNull public List<IncrementalCacheUpdateEvent> getEvents() { return myEvents; }
1294371_7
@NotNull public List<IncrementalCacheUpdateEvent> getEvents() { return myEvents; }
1294371_8
@NotNull public List<IncrementalCacheUpdateEvent> getEvents() { return myEvents; }
1294371_9
@NotNull public List<IncrementalCacheUpdateEvent> getEvents() { return myEvents; }
1302098_0
public boolean setBit(long index, boolean value) { boolean answer = false; BitArray ba = getBitArray(index); if (ba != null) { int offset = getOffset(index); if (offset >= 0) { answer = ba.set(offset, value); } } return answer; }
1302098_1
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc...
1302098_2
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc...
1302098_3
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc...
1302098_4
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc...
1302098_5
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc...
1302098_6
public static boolean checkParenthesis(String str) { boolean result = true; if (str != null) { int open = 0; int closed = 0; int i = 0; while ((i = str.indexOf('(', i)) >= 0) { i++; open++; } i = 0; while ((i = str.indexOf(')', i)) ...
1302098_7
static public <T> T decode(Class<T> clazz, URL url) throws IOException, XMLStreamException, JAXBException, SAXException { return decode(clazz, url, null); }
1302098_8
static public void encode(Object in, OutputStream os, boolean format) throws JAXBException { ClassLoader original = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(ClassFinder.class_loader()); Marshaller marshaller = context().createMarshaller()...
1307005_0
public File newFolder(String folder) throws IOException { return newFolder(new String[]{folder}); }
1307005_1
public File newFile() throws IOException { return File.createTempFile("junit", null, getRoot()); }
1307227_0
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_1
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_2
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_3
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_4
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_5
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_6
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_7
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...
1307227_8
public static LoggerStore createLoggerStore(final String configuratorType, final String resource) { final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory(); final Map<String, Object> data = new HashMap<String, Object>(); data.put(INITIAL_FACTORY, getFactoryClassName(configuratorType)); ...