text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean searchMatrix(int[][] matrix, int target) {
if (matrix.length == 0) {
return false;
}
int start = 0, end = matrix.length;
while (start < end) {
int mid = (start + end) >>> 1;
int midVal = matrix[mid][0];
if (midVal < target) {
if (end - start > 1) {
start = mid;
} else {
break;
}
} else if (midVal > target) {
end = mid;
} else {
return true;
}
}
//System.out.println("start: " + start);
int[] row = matrix[start];
start = 0;
end = row.length;
int index = -1;
while (start < end) {
int mid = (start + end) >>> 1;
int midValue = row[mid];
if (midValue < target) {
start = mid + 1;
} else if (midValue > target) {
end = mid;
} else {
index = mid;
break;
}
}
return index != -1;
} | 8 |
int insertKeyRehash(float val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look until FREE slot or we start to loop
*/
do {
// Identify first removed slot
if (state == REMOVED && firstRemoved == -1)
firstRemoved = index;
index -= probe;
if (index < 0) {
index += length;
}
state = _states[index];
// A FREE slot stops the search
if (state == FREE) {
if (firstRemoved != -1) {
insertKeyAt(firstRemoved, val);
return firstRemoved;
} else {
consumeFreeSlot = true;
insertKeyAt(index, val);
return index;
}
}
if (state == FULL && _set[index] == val) {
return -index - 1;
}
// Detect loop
} while (index != loopIndex);
// We inspected all reachable slots and did not find a FREE one
// If we found a REMOVED slot we return the first one found
if (firstRemoved != -1) {
insertKeyAt(firstRemoved, val);
return firstRemoved;
}
// Can a resizing strategy be found that resizes the set?
throw new IllegalStateException("No free or removed slots available. Key set full?!!");
} | 9 |
private void scan(boolean target, boolean debug) throws IOException{
System.out.println("stage: scanner");
PrintWriter pw = null;
if (target){
output = new File(this.name + ".scan");
output.createNewFile();
pw = new PrintWriter(new FileWriter(output));
pw.println("LINEA\t\tTIPO\t\t\t\t\t\tVALOR");
if (debug)
System.out.println("Se creo el archivo de salida "+ output.getName());
}
lexer = new Decaf(new ANTLRFileStream(this.source.getPath()));
lexer.removeErrorListeners();
LexerErrorHandler error = new LexerErrorHandler();
lexer.addErrorListener(error);
Token actual = lexer.nextToken();
while (actual.getType() != Token.EOF){
if (target){
String tokenString = "" + actual.getLine();
while (tokenString.length()<10)
tokenString += " ";
tokenString += lexer.actualType;
while (tokenString.length()<40)
tokenString += " ";
tokenString += actual.getText();
pw.println(tokenString);
}
if (debug){
Debug.scannerDebug(lexer.actualType, actual);
}
actual = lexer.nextToken();
}
error.printErrors();
if (error.getNumberOfErrors() > 0)
System.out.println("Se encontraron " + error.getNumberOfErrors() + " errores lexicos.");
else
System.out.println("No se encontraron errores lexicos.");
if (target)
pw.close();
} | 9 |
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof BandsperfestivalId) ) return false;
BandsperfestivalId castOther = ( BandsperfestivalId ) other;
return (this.getFestId()==castOther.getFestId())
&& (this.getBandId()==castOther.getBandId())
&& ( (this.getDatum()==castOther.getDatum()) || ( this.getDatum()!=null && castOther.getDatum()!=null && this.getDatum().equals(castOther.getDatum()) ) );
} | 8 |
public Map<K, V> read(JsonReader in) throws IOException {
JsonToken peek = in.peek();
if (peek == JsonToken.NULL) {
in.nextNull();
return null;
}
Map<K, V> map = constructor.construct();
if (peek == JsonToken.BEGIN_ARRAY) {
in.beginArray();
while (in.hasNext()) {
in.beginArray(); // entry array
K key = keyTypeAdapter.read(in);
V value = valueTypeAdapter.read(in);
V replaced = map.put(key, value);
if (replaced != null) {
throw new JsonSyntaxException("duplicate key: " + key);
}
in.endArray();
}
in.endArray();
} else {
in.beginObject();
while (in.hasNext()) {
JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in);
K key = keyTypeAdapter.read(in);
V value = valueTypeAdapter.read(in);
V replaced = map.put(key, value);
if (replaced != null) {
throw new JsonSyntaxException("duplicate key: " + key);
}
}
in.endObject();
}
return map;
} | 6 |
private boolean fillNumber(char[][] board, int row, int col)
{
int size = board.length;
for(int i=row; i<size; i++)
{
int j=col;
if(i==row+1)j=0;
for(; j<size; j++)
{
if(board[i][j]!='.')
continue;
else
{
for(int k=1; k<10; k++)
{
if(isValidSudoku(board, i, j, k))
{
board[i][j] = String.valueOf(k).charAt(0);
if(fillNumber(board, (j==size-1?i+1:i), (j==size-1?0:j+1))) return true;
board[i][j] = '.';
}
}
return false;
}
}
}
return true;
} | 9 |
public static void main(String[] args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"context/jdbcContext.xml");
// dataSourceはSpringで作成。
DataSource source = (DataSource) ctx.getBean("dataSource");
Connection con = source.getConnection();
Statement stat = con.createStatement();
stat.execute("DELETE FROM TEST");
stat.execute("INSERT INTO TEST VALUES (1,'huge')");
PreparedStatement ps = con.prepareStatement("SELECT * FROM TEST WHERE NAME = ?");
// バインドパラメータの設定
ps.setString(1, "huge");
// クエリ実行
ResultSet resultset = ps.executeQuery();
while (resultset.next()) {
String a = resultset.getString(1);
String b = resultset.getString(2);
SimpleLogger.debug(a + ":" + b);
}
// コミット
con.commit();
resultset.close();
stat.close();
con.close();
} | 1 |
public String toString() {
switch (typecode) {
case TC_LONG:
return "long";
case TC_FLOAT:
return "float";
case TC_DOUBLE:
return "double";
case TC_NULL:
return "null";
case TC_VOID:
return "void";
case TC_UNKNOWN:
return "<unknown>";
case TC_ERROR:
default:
return "<error>";
}
} | 7 |
public List getMessByTimeAndDriver(String beginTme, String endTime,String driver,String rescueStatus) {
if(beginTme!=null&&!beginTme.trim().equals("")){
if(endTime!=null&&!endTime.trim().equals("")){
String hql = "from Rescueapply r where r.applytime >=:beginTime and r.applytime <=:endTime and r.driver=:driver" + rescueStatus;
return this.sessionFactory.getCurrentSession().createQuery(hql).setParameter("beginTime",beginTme).setParameter("endTime",endTime).setParameter("driver", driver).list();
}
else{
String hql = "from Rescueapply r where r.applytime >=:beginTime and r.driver=:driver" + rescueStatus;
return this.sessionFactory.getCurrentSession().createQuery(hql).setParameter("beginTime",beginTme).setParameter("driver", driver).list();
}
}else{
if(endTime!=null&&!endTime.trim().equals("")){
String hql = "from Rescueapply r where r.applytime <=:endTime and r.driver=:driver" + rescueStatus;
return this.sessionFactory.getCurrentSession().createQuery(hql).setParameter("endTime",endTime).setParameter("driver", driver).list();
}else{
return null;
}
}
} | 6 |
public Gezin getGezin(int gezinsNr) {
// inefficiente oplossing
for (Persoon p : personen) {
Iterator<Gezin> it = p.getGezinnen();
while (it.hasNext()) {
Gezin r = it.next();
if (r.getNr() == gezinsNr) {
return r;
}
}
}
return null;
} | 3 |
public <T> ResultSet queryDB(String query, ArrayList<T> sqlParam){
PreparedStatement ps = null;
ResultSet rs = null;
try{
ps = conn.prepareStatement(query);
int i = 1;
for (T a : sqlParam){
//System.out.println(a.getClass());
if (a.getClass() == String.class){
ps.setString(i, (String)a);
//System.out.println(String.format("I'm a String! %d - %s", i, (String) a));
}else if(a.getClass() == Integer.class){
ps.setInt(i, (Integer)a);
//System.out.println(String.format("I'm an Integer! %d - %d", i, (Integer) a));
}else if(a.getClass() == Double.class){
ps.setDouble(i, (Double)a);
//System.out.println(String.format("I'm a Double! %d - %f", i, (Double) a));
}else if (a.getClass() == Timestamp.class){
ps.setTimestamp(i, (Timestamp)a);
//System.out.println(String.format("I'm a DateTime! %d - %s", i, a.toString()));
}else if (a.getClass() == Long.class){
ps.setLong(i, (Long)a);
//System.out.println(String.format("I'm a DateTime! %d - %s", i, a.toString()));
}
i++;
}
rs = ps.executeQuery();
}catch (SQLException e){
e.printStackTrace();
return null;
}
return rs;
} | 7 |
public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
if (!isEntered)
writer.println("// MISSING MONITORENTER");
writer.print("synchronized (");
if (object != null)
object.dumpExpression(writer.EXPL_PAREN, writer);
else
writer.print(local.getName());
writer.print(")");
writer.openBrace();
writer.tab();
bodyBlock.dumpSource(writer);
writer.untab();
writer.closeBrace();
} | 2 |
public JSONObject toJSON() throws JSONException {
JSONObject json = super.toJSON();
json.put("aptitude", aptitude.name());
JSONArray array = new JSONArray();
if(this.subordonnes != null){
for(int i = 0; i < this.subordonnes.size(); i++){
array.put(i, this.subordonnes.get(i).toJSON());
}
}
json.put("subordonnes", array);
return json;
} | 2 |
public static ArrayList<Map<String, String>> loadLabels(String labelsFile) {
if(labelsFile == null)
return null;
ArrayList<Map<String, String>> labels = null;
try{
BufferedReader fi = new BufferedReader(new FileReader(labelsFile));
labels = new ArrayList<Map<String, String>>();
String docLine;
while( (docLine = fi.readLine()) != null){
Map<String, String> docAcronymMap = new HashMap<String, String>();
String acronyms[] = docLine.split(SEPARATOR);
for (int i = 0; i < acronyms.length; i++) {
String singleAcronym = acronyms[i];
if(singleAcronym.isEmpty())
continue;
String parts[] = singleAcronym.split("\t");
if(parts.length != 2){
System.out.println("BAD FORMAT in "+labelsFile+": "+singleAcronym);
}
else{
docAcronymMap.put(parts[0].trim(), parts[1].trim());
}
}
labels.add(docAcronymMap);
}
fi.close();
}
catch(Exception e){
e.printStackTrace();
System.exit(1);
}
return labels;
} | 6 |
private void addBedrock() {
for (int x = 0; x < chunkWidth; x++) {
for (int z = 0; z < chunkWidth; z++) {
world.chunk[x][255][z] = 1;
}
}
} | 2 |
static void removeDup(LinkedListNode n) {
Set<Integer> set = new HashSet<Integer>();
while (n != null) {
int current = n.getValue();
if (set.contains(current)) {
n.pre.next = n.next;
} else {
set.add(current);
}
n = n.next;
}
} | 2 |
private void jButton_VerifyFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_VerifyFilesActionPerformed
OpenTransactionAccount otAccount = new OpenTransactionAccount();
int isSuccess = otAccount.verifyFiles(jTextField_ServerID.getText(), jTextField_NymID.getText(), jTextField_AccountID.getText());
if (isSuccess == 0) {
JOptionPane.showMessageDialog(null, "The intermediary files for this account have all been VERIFIED against the last signed receipt", "Verified", JOptionPane.INFORMATION_MESSAGE);
} else if (isSuccess == 1) {
JOptionPane.showMessageDialog(null, "The intermediary files for this account have FAILED to verify against the last signed receipt", "Error", JOptionPane.ERROR_MESSAGE);
} else if (isSuccess == 2) {
JOptionPane.showMessageDialog(null, "There is no receipt for this account", "Empty", JOptionPane.INFORMATION_MESSAGE);
}
}//GEN-LAST:event_jButton_VerifyFilesActionPerformed | 3 |
public void roadNameCheck() {
for(MyNode n : mg.getNodeArray()) {
for(MyEdge e : n.getFromEdges()) {
if(e.getRoadName().equals(address[0])) {
putEdge(e);
}
}
for(MyEdge e : n.getToEdges()) {
if(e.getRoadName().equals(address[0])) {
putEdge(e);
}
}
}
} | 5 |
private static void showStorage (int indent, Rio500 rio, boolean external)
throws IOException
{
Rio500.MemoryStatus mem;
int temp;
indentLine (indent, external ? "SmartMedia" : "Built-in Memory");
indent += 2;
temp = rio.getFreeMemory (external);
indentLine (indent, "Available Memory in bytes: "
+ (temp / (1024 * 1024))
+ "."
+ ((10 * (temp % (1024 * 1024))) / (1024 * 1024))
+ " MB, "
);
mem = rio.getMemoryStatus (external);
temp = mem.getBlockCount ();
if (temp != 0)
temp = ((temp - mem.getNumUnusedBlocks ()) * 100) / temp;
else
temp = 1000;
indentLine (indent, "Memory status: "
+ mem.getBlockCount () + " Blocks, "
+ mem.getBlockSize () + " bytes each, "
+ mem.getNumUnusedBlocks () + " blocks unused "
+ temp + "% full "
);
indentLine (indent, "First free block at 0x"
+ Integer.toHexString (mem.getFirstFreeBlock ())
);
// dump folders and their contents
Rio500.FolderEntry folders [] = rio.getFolders (external);
for (int i = 0; i < folders.length; i++) {
Rio500.FolderEntry f = folders [i];
indentLine (indent, "Folder # "
+ i
+ ", offset = 0x"
+ Integer.toHexString (f.getOffset ())
+ ", name1 = "
+ f.getName1 ()
// + ", name2 = "
// + f.getName2 ()
+ ", entries = "
+ f.getSongCount ()
);
indent += 2;
try {
Rio500.SongEntry songs [] = f.getSongs ();
for (int j = 0; j < songs.length; j++) {
Rio500.SongEntry s = songs [j];
indentLine (indent, "Song # "
+ j
+ ", offset = 0x"
+ Integer.toHexString (s.getOffset ())
+ ", kbytes = "
+ (s.getLength () / 1024)
);
indentLine (indent + 4, "name1 = "
+ s.getName1 ()
// + ", name2 = "
// + s.getName2 ()
);
}
} catch (Exception e) {
e.printStackTrace ();
}
indent -= 2;
}
} | 5 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
}
} else if (o instanceof Float) {
if (((Float)o).isInfinite() || ((Float)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
}
}
}
} | 7 |
String removeMnemonics (String string) {
/* removes single ampersands and preserves double-ampersands */
char [] chars = new char [string.length ()];
string.getChars (0, chars.length, chars, 0);
int i = 0, j = 0;
for ( ; i < chars.length; i++, j++) {
if (chars[i] == '&') {
if (++i == chars.length) break;
if (chars[i] == '&') {
chars[j++] = chars[i - 1];
}
}
chars[j] = chars[i];
}
if (i == j) return string;
return new String (chars, 0, j);
} | 5 |
static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} | 2 |
public void elSuapDefinitivo(int arr)
{
IVPTabu obj = new IVPTabu();
String url = "jdbc:derby://localhost:1527/PDPIVP";
String selectdatos="SELECT * FROM MatrizSolucion";
int tabu=0;
int notabu=0;
double cambio=0;
int indice1=0;
int indice2=0;
double losmejores[]=new double[5];
int losindices1[]=new int[5];
int losindices2[]=new int[5];
for (int i=0;i<5;i++){
losmejores[i]=0;
losindices1[i]=0;
losindices2[i]=0;
}
try{
Class.forName("org.apache.derby.jdbc.ClientDriver");
//catch SQLException
Connection con = DriverManager.getConnection(url, "Balam", "Balam");
Statement stmt=con.createStatement();
ResultSet rs = stmt.executeQuery(selectdatos);
rs.next();
cambio=Double.parseDouble(rs.getString("Cambio"));
indice1=rs.getInt("Indice1");
indice2=rs.getInt("Indice2");
losmejores[0]=cambio;
losindices1[0]=indice1;
losindices2[0]=indice2;
rs.next();
do{
cambio=Double.parseDouble(rs.getString("Cambio"));
indice1=rs.getInt("Indice1");
indice2=rs.getInt("Indice2");
if(cambio<losmejores[0]){
System.out.println("dentro del if de los mejores");
losmejores[4]=losmejores[3];
losmejores[3]=losmejores[2];
losmejores[2]=losmejores[1];
losmejores[1]=losmejores[0];
losmejores[0]=cambio;
losindices1[4]=losindices1[3];
losindices2[4]=losindices2[3];
losindices1[3]=losindices1[2];
losindices2[3]=losindices2[2];
losindices1[2]=losindices1[1];
losindices2[2]=losindices2[1];
losindices1[1]=losindices1[0];
losindices2[1]=losindices2[0];
losindices1[0]=indice1;
losindices2[0]=indice2;
System.out.println("elSuapDefinitivo: de los 5 el num "+
losmejores[0]+" "+losindices1[0]+" "+
losindices2[0]+"dentrodelif");
}
}while(rs.next()!=false);
do{
tabu=obj.restriccionTabu(losmejores[notabu], losindices1[notabu], losindices2[notabu]);
notabu++;
}while(tabu!=0||notabu==5);
notabu--;
System.out.println("de los 5 mejores fue el: "+notabu);
System.out.println(losindices1[notabu]+" "+losindices2[notabu]);
obj.elSuap1(losindices1[notabu], losindices2[notabu], arr);
obj.registrarCambio(losindices1[notabu], losindices2[notabu]);
}
catch(ClassNotFoundException e){
System.out.println("no se encontro la clase \n"+
"error ClassNotFoundException");
System.out.println(e.toString());
}
catch(SQLException e){
System.out.println("error de conexion \n"+
"error SQLException");
System.out.println(e.toString());
}
} | 7 |
public void printInventory(){
for(Block i : inv){
System.out.print(i.type + " ");
}
System.out.println();
} | 1 |
private void closeConnections() throws Exception {
if (getConnections() == null) return;
while (getConnections().size() > 0) {
ISocketServerConnection ssc = (ISocketServerConnection)getConnections().get(0);
ssc.disconnect();
getConnections().remove(ssc);
}
} | 2 |
private double[][] manRGBArray(BufferedImage image, Hemisphere hemi){
double[][] rgbArray = new double[200][200];
int rgb = 3096;//Don't ask why
int x=0;
int y = 0;
for (x = 0; x < 200; x++) { // loop x axis of the image
for (y = 0; y < 200; y++) {// loop y axis
// remove arrow or text
if (hemi == Hemisphere.NORTH && (x > 389 / 2 && y > 248 / 2)
|| (y > 382 / 2)) {
continue;
} else if (hemi == Hemisphere.SOUTH && x > 389 / 2
&& y < 142 / 2) {
continue;
}
rgb = image.getRGB(2*x, 2*y);
int alpha = ((rgb >> 24) & 0xff);
int red = ((rgb >> 16) & 0xff);
int green = ((rgb >> 8) & 0xff);
int blue = ((rgb ) & 0xff);
// Manipulate the r, g, b, and a values.
//rgb = (alpha << 24) | (red << 16) | (green << 8) | blue;
//imgNorthPX.setRGB(x, y, rgb);
rgbArray[x][y] = getIntensity(alpha, red, green, blue);
}
}
return rgbArray;
} | 9 |
public static void main(String[] args) throws JAXBException, FileNotFoundException {
Company company = new Company();
company.setName("ITCompany");
Departament itDepartament = new Departament();
itDepartament.setName("IT");
Worker worker = new Worker();
worker.setName("Tom");
itDepartament.addWorker(worker);
Worker worker2 = new Worker();
worker2.setName("Nick");
itDepartament.addWorker(worker2);
company.addDepartament(itDepartament);
Departament hrDepartament = new Departament();
hrDepartament.setName("HR");
Worker worker3 = new Worker();
worker3.setName("Tina");
hrDepartament.addWorker(worker3);
Worker worker4 = new Worker();
worker4.setName("Nicka");
hrDepartament.addWorker(worker4);
company.addDepartament(hrDepartament);
JAXBContext jc = JAXBContext.newInstance(Company.class);
File file = new File("files/jaxb.xml");
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(company, file);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Company company2 = (Company)unmarshaller.unmarshal(new FileReader(file));
ArrayList<Departament> departaments2 = company2.getDepartaments();
for(int i = 0; i < departaments2.size(); i++){
ArrayList<Worker> workers2 = departaments2.get(i).getWorkers();
System.out.println(departaments2.get(i).getName());
for(int j = 0; j < workers2.size(); j++){
System.out.println(workers2.get(j).getName());
}
}
} | 2 |
public void kirajzol(){
System.out.println(" 0 1 2 3 4 5 6 7");
for(int i=0; i<8; i++){
System.out.print(i+" ");
for(int j=0; j<8; j++)
System.out.print(sajat[i][j]+" ");
System.out.println();
}
} | 2 |
public static void syncSize() {
// grab the size that's been set
int sizeSet = Preferences.getPreferenceInt(Preferences.RECENT_FILES_LIST_SIZE).cur;
// if it's different than our stored setting ...
if (sizeSet != recentFilesList.currentRecentFilesListSize) {
// store new setting
recentFilesList.currentRecentFilesListSize = sizeSet;
// sync
recentFilesList.syncTreeSet();
recentFilesList.syncMenuItems();
}
} | 1 |
private byte a2b(byte c){
if('0'<=c&&c<='9') return (byte)(c-'0');
if('a'<=c&&c<='z') return (byte)(c-'a'+10);
return (byte)(c-'A'+10);
} | 4 |
@Basic
@Column(name = "FUN_AAAA")
public Integer getFunAaaa() {
return funAaaa;
} | 0 |
public void read(Scanner input) {
emptyGraph();
checking = true;
try {
String line = input.nextLine();
if (!line.equals(version)) {
throw new ParseException(line, -1);
}
GraphType loadedType = GraphType.valueOf(input.nextLine());
int n = Integer.parseInt(input.next()), m = Integer.parseInt(input.next());
for (int i = 0; i < n; i++) {
double x = Double.parseDouble(input.next()), y = Double.parseDouble(input.next());
int ID = Integer.parseInt(input.next());
vertices.add(new Vertex(x, y, ID));
}
for (int i = 0; i < m; i++) {
int f = Integer.parseInt(input.next()), t = Integer.parseInt(input.next());
createEdge(vertices.get(f), vertices.get(t));
}
type = loadedType;
} catch (Exception e) {
System.err.println("Exception while loading graph");
e.printStackTrace();
emptyGraph();
}
checking = false;
edited();
fitToScreen();
GUI.gRepaint();
} | 4 |
public static String getSuperRegionName(int superRegionID){
String out = "";
switch(superRegionID){
case 1:
out = "North America";
break;
case 2:
out = "South America";
break;
case 3:
out = "Europe";
break;
case 4:
out = "Africa";
break;
case 5:
out = "Asia";
break;
case 6:
out = "Australia";
break;
}
return out;
} | 6 |
@Override
public boolean apply(ICreature input) {
if (input == observer) {
return false;
}
double dirAngle = input.directionFormAPoint(observer.getPosition(),
observer.getDirection());
return abs(dirAngle) < (observer.getFieldOfView())
&& observer.distanceFromAPoint(input.getPosition()) <= observer
.getLengthOfView();
} | 2 |
private boolean checkDuplicate(String userID){
if(count > 0){
for (int i = 0; i < clientObj.length; i++) {
if((clientObj[i].getUserID()).equals(userID)){
return false;
}
}
}return true;
} | 3 |
public void run() {
try {
if (logger.isInfoEnabled())
logger.info("Start job schedule launcher at "
+ new Timestamp(System.currentTimeMillis()));
String dateParam = new Date().toString();
JobParameters param = new JobParametersBuilder().addString("date",
dateParam).toJobParameters();
JobExecution execution = jobLauncher.run(loggingJob, param);
if (logger.isInfoEnabled())
logger.info("Job Status : " + execution.getStatus());
} catch (Exception ex) {
logger.error("Start job schedule error", ex);
}
} | 3 |
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
} | 1 |
private List<String> validNegative(List<String> words)
{
List<String> tempNumbers = words;
int negCount = 0;
while(tempNumbers.contains("negative") || tempNumbers.contains("minus"))
{
if(negCount != 0)
{
System.err.println("Only one 'negative' or 'minus' allowed");
System.exit(7);
}
else if(tempNumbers.contains("negative"))
{
if(tempNumbers.indexOf("negative") != 0)
{
System.err.println("negative can only be the first word");
System.exit(7);
}
else
{
tempNumbers.remove("negative");
negCount++;
}
}
else if(tempNumbers.contains("minus"))
{
if(tempNumbers.indexOf("minus") != 0)
{
System.err.println("minus can only be the first word");
System.exit(7);
}
else
{
tempNumbers.remove("minus");
negCount++;
}
}
negCount++;
}
return tempNumbers;
} | 7 |
private void startGame(GameModel m){
if (gameController != null){
gameController.stopThread();
}
if (m == null){
startNewGame();
}
WINDOW.add(new LoadingPanel());
gameController = new GameController(mainModel, this);
mainModel.setGameModel(m);
gameController.init();
WINDOW.add(gameController.getGamePanel());
new Thread(gameController).start();
} | 2 |
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
MediaLibAccessor srcAccessor1 =
new MediaLibAccessor(sources[0], destRect,formatTag);
MediaLibAccessor srcAccessor2 =
new MediaLibAccessor(sources[1], destRect,formatTag);
MediaLibAccessor dstAccessor =
new MediaLibAccessor(dest, destRect, formatTag);
mediaLibImage[] srcML1 = srcAccessor1.getMediaLibImages();
mediaLibImage[] srcML2 = srcAccessor2.getMediaLibImages();
mediaLibImage[] dstML = dstAccessor.getMediaLibImages();
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
for (int i = 0; i < dstML.length; i++) {
Image.MulShift(dstML[i], srcML1[i], srcML2[i], 0);
}
break;
case DataBuffer.TYPE_FLOAT:
case DataBuffer.TYPE_DOUBLE:
for (int i = 0; i < dstML.length; i++) {
Image.Mul_Fp(dstML[i], srcML1[i], srcML2[i]);
}
break;
default:
String className = this.getClass().getName();
throw new RuntimeException(className + JaiI18N.getString("Generic2"));
}
if (dstAccessor.isDataCopy()) {
dstAccessor.clampDataArrays();
dstAccessor.copyDataToRaster();
}
} | 9 |
public boolean update(CreditProgram crProg) {
//Получаем текущий обьект по названию кредитной программы
String crProgName = crProg.getName();
CreditProgram curProgram;
if ((curProgram = get(crProgName)) == null) {
//Если обьекта c таким именем не существует - обновлять нечего
return false;
} else {
//Обновляем запись
Statement statement = null;
ResultSet result = null;
try {
//Создаем обновляемую выборку
statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
//Получаем выборку таблицы
result = statement.executeQuery(allQuery);
//Находим необходимую запись по id
while (result.next()) {
//Если находим запись - выход из цикла
if (result.getString("CREDITNAME").equals(curProgram.getName())) {
break;
}
}
//Обновляем запись
result.updateLong("CREDITMINAMOUNT", crProg.getMinAmount());
result.updateLong("CREDITMAXAMOUNT", crProg.getMaxAmount());
result.updateInt("CREDITDURATION", crProg.getDuration());
result.updateDouble("CREDITSTARTPAY", crProg.getStartPay());
result.updateDouble("CREDITPERCENT", crProg.getPercent());
result.updateString("CREDITDESCRIPTION", crProg.getDescription());
//Фиксируем изменения
result.updateRow();
} catch (SQLException exc) {
System.out.println("Ошибка при обновлении данных");
} finally {
try {
statement.close();
result.close();
} catch (SQLException exc) {
System.out.println("Ошибка при закрытии соединения");
}
}
}
//Обновляем список обьектов
getList().clear();
setList(listAll());
return true;
} | 5 |
public static boolean setGuildHome(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you believe this is in error.");
return false;
}
if(!s.hasPermission("zguilds.powers.sethome")){
//Checking if they have the permission node to proceed
s.sendMessage(ChatColor.RED + "You lack sufficient permissions to set a guild home. Talk to your server admin if you believe this is in error.");
return false;
}
if(!Util.isInGuild(s) == true){
//Checking if they're already in a guild
s.sendMessage(ChatColor.RED + "You need to be in a guild to use this command.");
return false;
}
if(args.length > 2 || args.length == 1){
//Checking if the create command has proper args
s.sendMessage(ChatColor.RED + "Incorrectly formatted guild set home command! Proper syntax is: \"/guild powers sethome\"");
return false;
}
if(Util.isGuildLeader(s.getName()) == false){
//Checking if the player is the guild leader or officer
s.sendMessage(ChatColor.RED + "You need to be the guild leader to use that command.");
return false;
}
if(Main.config.getBoolean("Level_Unlocks.SetHome.Enabled") == false){
s.sendMessage(ChatColor.RED + "That feature is not enabled on your server. Talk to your server admin if you believe this is an error.");
return false;
}
sendersName = s.getName().toLowerCase();
sendersGuild = Main.players.getString("Players." + sendersName + ".Current_Guild");
requiredLevel = Main.config.getInt("Level_Unlocks.SetHome.Level_Unlocked");
currentGuildsLevel = Main.guilds.getInt("Guilds." + sendersGuild + ".Level");
if(currentGuildsLevel < requiredLevel){
s.sendMessage(ChatColor.RED + "Your guild isn't high enough level to access that guild power. Your guild is level " + currentGuildsLevel + ", and that guild power requires level " + requiredLevel + ".");
return false;
}
senderAsPlayer = (Player) s;
sendersLocation = senderAsPlayer.getLocation();
sendersX = (int) sendersLocation.getX();
sendersY = (int) sendersLocation.getY();
sendersZ = (int) sendersLocation.getZ();
sendersWorldAsString = sendersLocation.getWorld().getName();
Main.guilds.set("Guilds." + sendersGuild + ".Home_Location.X_Coordinate", sendersX);
Main.guilds.set("Guilds." + sendersGuild + ".Home_Location.Y_Coordinate", sendersY);
Main.guilds.set("Guilds." + sendersGuild + ".Home_Location.Z_Coordinate", sendersZ);
Main.guilds.set("Guilds." + sendersGuild + ".Home_Location.World", sendersWorldAsString);
s.sendMessage(ChatColor.DARK_GREEN + "You set your guilds home to: " + String.valueOf(sendersX) + "x," + String.valueOf(sendersY) + "y," + String.valueOf(sendersZ) + "z, on the world: " + sendersWorldAsString + ".");
Main.saveYamls();
return true;
} | 8 |
public void enablePayButton(ListSelectionEvent e) {
if (!e.getValueIsAdjusting() && list.getSelectedIndex() != -1) {
pay.setEnabled(list.getSelectedValue().isBookable());
} else {
pay.setEnabled(false);
}
} | 2 |
public void menuFileAsym() {
int choice;
do {
System.out.println("\n");
System.out.println("File Cryption Menu");
System.out.println("Select Asymmetric Cryption Methode");
System.out.println("----------------------------------\n");
System.out.println("1 - RSA");
System.out.println("2 - Back");
System.out.print("Enter Number: ");
while (!scanner.hasNextInt()) {
System.out.print("That's not a number! Enter 1 or 2: ");
scanner.next();
}
choice = scanner.nextInt();
} while (choice < 1 || choice > 2);
switch (choice) {
case 1:
RsaUI.rsaCrypterFile(this);
break;
case 2:
this.menuFileCrypt();
break;
default:
this.menuFileAsym();
}
} | 5 |
private boolean isJavabeanGetter(IMethod method) throws JavaModelException
{
if (method.getNumberOfParameters() == 0 && Flags.isPublic(method.getFlags()))
{
String methodName = method.getElementName();
if (methodName.length() > 3 && methodName.startsWith("get")) //$NON-NLS-1$
{
return true;
}
else if (methodName.length() > 2 && methodName.startsWith("is") //$NON-NLS-1$
&& ("Z".equals(method.getReturnType()) //$NON-NLS-1$
|| "QBoolean;".equals(method.getReturnType()))) //$NON-NLS-1$
{
return true;
}
}
return false;
} | 8 |
public void update() {
Player_down.update();
Player_up.update();
Player_left.update();
Player_right.update();
if(firerate > 0) firerate--;
int xa = 0, ya = 0;
if (input.up)
ya--;
if (input.down)
ya++;
if (input.left)
xa--;
if (input.right)
xa++;
if (xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walking = false;
}
clear();
updateshooting();
} | 7 |
protected void switchChannel(String toReplace, String replacing) {
if (toReplace.equals(replacing.toLowerCase())) { //Nothing to edit, reload the initial picture
this.changePicture(this.getRelURL());
this.revalidateContainer();
reloadChanges();
return;
}
BufferedImage toEdit = null;
try {
toEdit = getOriginalBufferedImage();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
FilteredImageSource filteredSrc = null;
ColorSwapper filter = null;
filter = new ColorSwapper();
int[] redShift = {-1, -1, -1}, greenShift = {-1, -1, -1}, blueShift = {-1, -1, -1};
int redShiftIndex = 0, greenShiftIndex = 0, blueShiftIndex = 0;
boolean[] greenLeftShift = new boolean[3];
boolean[] hideRed = {false, false, false}, hideGreen = {false, false, false}, hideBlue = {false, false, false};
for (int i =0; i < 3; i++ ) {
if (((String)selectors[i].getSelectedItem()).toLowerCase().equals("infrared")) {
redShift[redShiftIndex] = getShift("infrared", labels[i]);
System.out.println("Adding to red shifts: " + redShift[redShiftIndex]);
redShiftIndex++;
} else if (((String)selectors[i].getSelectedItem()).toLowerCase().equals("red")) {
greenShift[greenShiftIndex] = getShift("red", labels[i]);
if (greenShift[greenShiftIndex] == -8) {
greenLeftShift[greenShiftIndex] = true;
greenShift[greenShiftIndex] = 8;
}
System.out.println("Adding to green shifts: " + greenShift[greenShiftIndex] + " " + greenLeftShift[greenShiftIndex]);
greenShiftIndex++;
} else if (((String)selectors[i].getSelectedItem()).toLowerCase().equals("green")) {
blueShift[blueShiftIndex] = getShift("green", labels[i]);
System.out.println("Adding to blue shifts: " + blueShift[blueShiftIndex]);
blueShiftIndex++;
} else {
System.out.println("HIDING A COLOR");
if (labels[i].equals("Infrared")) {
hideRed[redShiftIndex] = true;
redShiftIndex++;
} else if (labels[i].equals("Red")) {
hideGreen[greenShiftIndex]=true;
greenShiftIndex++;
} else {
hideBlue[blueShiftIndex]=true;
blueShiftIndex++;
}
}
}
filter.setBlueColorShift(blueShift);
filter.setGreenColorShift(greenShift);
filter.setRedColorShift(redShift);
filter.setGreenLeftShift(greenLeftShift);
filter.setHideRed(hideRed);
filter.setHideGreen(hideGreen);
filter.setHideBlue(hideBlue);
filteredSrc = new FilteredImageSource(toEdit.getSource(), filter);
Image img = Toolkit.getDefaultToolkit().createImage(filteredSrc);
this.changePicture(img);
} | 9 |
@Override
public String getName() {
return this.name;
} | 0 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if((husbanding==null)||(mob.location()==null))
{
messedUp=true;
unInvoke();
}
for(final MOB husbandM : husbanding)
{
if((husbandM==null)||(mob.location()==null))
{
messedUp=true;
unInvoke();
}
if(!mob.location().isInhabitant(husbandM))
{
messedUp=true;
unInvoke();
}
}
}
return super.tick(ticking,tickID);
} | 9 |
public static void invert(double src[][], double dst[][]) {
gaussian(src, a);
for (int i = 0 ; i < 4 ; i++)
for (int j = 0 ; j < 4 ; j++)
b[i][i] = i == j ? 1 : 0;
for (int i = 0 ; i < 3 ; i++)
for (int j = i + 1 ; j < 4 ; j++)
for (int k = 0 ; k < 4 ; k++)
b[index[j]][k] -= a[index[j]][i] * b[index[i]][k];
for (int i = 0 ; i < 4 ; i++) {
dst[4-1][i] = b[index[4-1]][i] / a[index[4-1]][4-1];
for (int j = 2 ; j >= 0 ; j--) {
dst[j][i] = b[index[j]][i];
for (int k = j + 1 ; k < 4 ; k++)
dst[j][i] -= a[index[j]][k] * dst[k][i];
dst[j][i] /= a[index[j]][j];
}
}
} | 9 |
public void setShopName(String shopName) {
this.shopName = shopName;
} | 0 |
public static boolean transitiveClosureIteratorDnextP(TransitiveClosureIterator self) {
{ Stella_Object node = self.value;
Iterator adjacencyiterator = ((Iterator)(edu.isi.stella.javalib.Native.funcall(self.allocateAdjacencyIteratorFunction, null, new java.lang.Object [] {node})));
if (adjacencyiterator != null) {
self.adjacencyIteratorStack = Cons.cons(adjacencyiterator, self.adjacencyIteratorStack);
}
else {
{
adjacencyiterator = ((Iterator)(self.adjacencyIteratorStack.value));
if (adjacencyiterator == null) {
return (false);
}
}
}
for (;;) {
while (!adjacencyiterator.nextP()) {
self.adjacencyIteratorStack = self.adjacencyIteratorStack.rest;
adjacencyiterator = ((Iterator)(self.adjacencyIteratorStack.value));
if (adjacencyiterator == null) {
return (false);
}
}
node = adjacencyiterator.value;
if ((!self.beenThereList.memberP(node)) &&
((self.filterP == null) ||
((Boolean)(edu.isi.stella.javalib.Native.funcall(self.filterP, null, new java.lang.Object [] {node}))).booleanValue())) {
self.beenThereList = Cons.cons(node, self.beenThereList);
self.value = node;
return (true);
}
}
}
} | 8 |
@Override
public boolean registerParser(Class<? extends IPacketParser> parser) {
Object object = null;
try {
object = parser.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
ParsesPacket annotation = parser.getAnnotation(ParsesPacket.class);
if (annotation != null) {
for (int packetId : annotation.value()) {
parsers.put(packetId, (IPacketParser) object);
}
return true;
}
return false;
} | 5 |
public Stack() {
this.stack = new DynamicArray();
} | 0 |
@Override
public void showGetOptions(ResourceType[] enabledResources) {
getAvailables = enabledResources;
getreload.setVisible(false);
getAmount.setVisible(false);
//Show them all
getwood.setVisible(true);
getbrick.setVisible(true);
getsheep.setVisible(true);
getwheat.setVisible(true);
getore.setVisible(true);
//Disable them all
getwood.setEnabled(false);
getbrick.setEnabled(false);
getsheep.setEnabled(false);
getwheat.setEnabled(false);
getore.setEnabled(false);
//Enable only the ones that are available
for (ResourceType res : enabledResources) {
if (res == ResourceType.WOOD) { getwood.setEnabled(true);}
else if (res == ResourceType.BRICK) {getbrick.setEnabled(true);}
else if (res == ResourceType.SHEEP) {getsheep.setEnabled(true);}
else if (res == ResourceType.WHEAT) {getwheat.setEnabled(true);}
else if (res == ResourceType.ORE) { getore.setEnabled(true);}
}
} | 6 |
public ThreadPoolImpl(int minThreads, int maxThreads, int maxIdleTime)
throws IllegalArgumentException {
if (maxThreads < 1) {
throw new IllegalArgumentException(
"maxThreads must be an integral value greater than 0");
}
_maxThreads = maxThreads;
if (minThreads < 0) {
throw new IllegalArgumentException(
"minThreads must be an integral " +
"value greater than or equal to 0");
}
if (minThreads > _maxThreads) {
throw new IllegalArgumentException(
"minThreads cannot be greater than maxThreads");
}
_minThreads = minThreads;
if (maxIdleTime < 1) {
throw new IllegalArgumentException(
"maxIdleTime must be an integral value greater than 0");
}
_maxIdleTime = maxIdleTime;
} | 4 |
public void addFace(Face face) {
if (!mesh.isDynamic() && !mesh.needsRenderUpdate) return;
if (face == null) return;
if (faces.contains(face)) return;
faces.add(face);
face.mesh = mesh;
face.reg = this;
mesh.needsRenderUpdate = true;
} | 4 |
public ArrayList<ArrayList<Double>> vectorsCompletionForMaintenance(ArrayList<String> newWordsArray, StatisticData[][] sd, int numOfComments, String articleId) throws SQLException{
ArrayList<String> wordArray = HelperFunctions.addNewWordsToOldWords(newWordsArray, articleId);
DatabaseOperations.setArticleWords(articleId, wordArray);
ArrayList<ArrayList<Double>> commentsVectors = new ArrayList<ArrayList<Double>>();
ArrayList<Double> vector;
boolean flag = false;
int wordsArraySize = wordArray.size();
int newWordsSize = sd[0].length;
for(int i = 0; i < numOfComments; i++){
vector = new ArrayList<Double>();
for(int j = 0; j < wordsArraySize; j++){
flag=false;
Vector<Integer> vectorOfTheComment;
for(int t = 0; t < newWordsSize; t++){
if(sd[0][t].getTerm().equals(wordArray.get(j))){
vectorOfTheComment = sd[0][t].getListOfSentenceIndeces();
int sizeOfVector = vectorOfTheComment.size();
for(int k = 0; k < sizeOfVector; k++)
if(vectorOfTheComment.get(k) == i){
flag =true;
break;
}
}
}
if(flag == true)
vector.add((double)1);
else
vector.add((double)0);
}
vector.add((double)1);
commentsVectors.add(vector);
}
return commentsVectors;
} | 7 |
public int getColumnCount() {
return entries[0].length;
} | 0 |
public synchronized Player getPlayer(int index)
throws IndexOutOfBoundsException {
if (index > players.length)
throw new IndexOutOfBoundsException(
"The max number of players is four.");
return players[index];
} | 1 |
public static XSDDatatype getXSDDatetime() {
return (new XSDDateTime(Calendar.getInstance())).getNarrowedDatatype();
} | 0 |
private static void loadUnpackedNPCBonuses() {
Logger.log("NPCBonuses", "Packing npc bonuses...");
try {
DataOutputStream out = new DataOutputStream(new FileOutputStream(
PACKED_PATH));
BufferedReader in = new BufferedReader(new FileReader(
"data/npcs/unpackedBonuses.txt"));
while (true) {
String line = in.readLine();
if (line == null)
break;
if (line.startsWith("//"))
continue;
String[] splitedLine = line.split(" - ", 2);
if (splitedLine.length != 2)
throw new RuntimeException("Invalid NPC Bonuses line: "
+ line);
int npcId = Integer.parseInt(splitedLine[0]);
String[] splitedLine2 = splitedLine[1].split(" ", 10);
if (splitedLine2.length != 10)
throw new RuntimeException("Invalid NPC Bonuses line: "
+ line);
int[] bonuses = new int[10];
out.writeShort(npcId);
for (int i = 0; i < bonuses.length; i++) {
bonuses[i] = Integer.parseInt(splitedLine2[i]);
out.writeShort(bonuses[i]);
}
npcBonuses.put(npcId, bonuses);
}
in.close();
out.close();
} catch (Throwable e) {
Logger.handle(e);
}
} | 7 |
public static BencodeParser getResponsibleParserByFirstChar(char firstChar) throws InvalidFormatException {
for (BencodeParser parser : AVAILABLE_PARSERS) {
if(parser.isResponsible(firstChar)){
return parser;
}
}
throw new InvalidFormatException();
} | 2 |
public void registroAlArchivo(General atributos, String archivo, String n, int c,
String m, double nota) throws FileNotFoundException{
//Se llama al metodo datosEstudiante
datosEstudiante(atributos, n, c, m, nota);
//Se crea el archivo y se le guarda la informacio
File f = new File(archivo);
PrintWriter guardarTxt = new PrintWriter(f);
guardarTxt.println("Nombre: "+atributos.nombre);
guardarTxt.println("Codigo: "+atributos.codigo);
guardarTxt.println("Materia: "+atributos.materia);
guardarTxt.println("Nota: "+atributos.nota);
guardarTxt.close();
} | 0 |
public Material dropPicker() {
int next = gen.nextInt(10);
switch (next) {
case 1:
return getHelmet();
case 2:
return getChestPlate();
case 3:
return getLeggings();
case 4:
return getBoots();
case 5:
return getHoe();
case 6:
return getPickaxe();
case 7:
return getAxe();
case 8:
return getSpade();
case 9:
return Material.BOW;
default:
return getSword();
}
} | 9 |
@Test
public void testSearchxPath() throws Exception {
MyUnit.testFindFieldsbyXpath();
} | 0 |
private int getMatrix(int i, int j) {
if (i >= 0 && i < size && j >= 0 && j < size)
return array[i][j];
else
return -1;
} | 4 |
@Override
public void buttonStateCheck(Input input) {
int mX = input.getMouseX();
int mY = input.getMouseY();
int farX = getX() + getStoredImage().getImage().getWidth();
int farY = getY() + getStoredImage().getImage().getHeight();
if (pointContains(getX(), mX, farX) && pointContains(getY(), mY, farY)) {
hovered = true;
setState(STATE_HOVER);
isRevealed = true;
for (int i = 0; i < dList.getDisplayLength(); i++) {
dList.getBgButton(i).setState(STATE_IDLE);
}
} else {
hovered = false;
setState(STATE_IDLE);
if (isRevealed
&& pointContains(farX, mX, farX
+ dList.getBgButton().getStoredImage().getImage()
.getWidth())
&& pointContains(getY(), mY, getY() + dList.getBgButton()
.getStoredImage().getImage().getHeight()
* dList.getDisplayLength())) {
for (int i = 0; i < dList.getDisplayLength(); i++) {
if (pointContains(getY()
+ dList.getBgButton().getStoredImage().getImage()
.getHeight() * i, mY, getY()
+ dList.getBgButton().getStoredImage().getImage()
.getHeight() * (i + 1))) {
if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
dList.getBgButton(i).setState(STATE_PRESSED);
dList.getBgButton(i).setClicked(true);
} else {
dList.getBgButton(i).setState(STATE_HOVER);
}
}else{
dList.getBgButton(i).setState(STATE_IDLE);
dList.getBgButton(i).setClicked(false);
}
}
} else {
isRevealed = false;
}
}
} | 9 |
public static double deltaVectors(
double[] vec1,
double[] vec2 )
{
double[] test = Vector.sub(vec1, vec2);
double delta = 0.0;
int m = vec1.length;
for ( int i = 0; i < m; ++i )
delta += Math.abs(test[i]);
return(delta / m);
} | 1 |
public static void main(String[] args)
{
Map<String,String> map = new HashMap<String,String>();
map.put("10", "aaa");
map.put("12", "dafg");
map.put("14", "gaswde");
map.put("15", "gasde");
Set<String> set = map.keySet();
for(Iterator<String> iter = set.iterator();iter.hasNext();){
String key = iter.next();
String value = map.get(key);
System.out.println(key + "="+ value);
}
System.out.println("---------------------------------");
Set<Map.Entry<String, String>> set2 = map.entrySet();
for(Iterator<Map.Entry<String, String>> iter = set2.iterator();iter.hasNext();){
Map.Entry<String, String> entry = iter.next();
String key = entry.getKey();
String value = entry.getValue();
System.out.println("key:" + key +" value:" + value);
}
} | 2 |
Item newNameTypeItem(final String name, final String desc) {
key2.set(NAME_TYPE, name, desc, null);
Item result = get(key2);
if (result == null) {
put122(NAME_TYPE, newUTF8(name), newUTF8(desc));
result = new Item(index++, key2);
put(result);
}
return result;
} | 1 |
public void printExceptionList() {
for (Iterator<Throwable> it = exceptions.iterator(); it.hasNext();) {
Throwable throwable = it.next();
if (throwable != null) throwable.printStackTrace();
}
} | 2 |
public long binIsBlack(){
return binIsBlack;
} | 0 |
private Vector<Vector<Object>> getContenidoTabla(int perfil){
//r_con.Connection();
Tareas t=new Tareas(r_con);
Permisos p=new Permisos(r_con);
Vector<Vector<String>> v = p.getContenidoTablaPermisos(perfil);
Vector<Vector<String>>tareas = t.getDescripcionTareas();
Vector<Vector<Object>>matriz = new Vector();
Vector<Object>fila;
int id_modulo,id_tarea;id_modulo=-1;id_tarea=-1;
r_con.Connection();
ResultSet rs;
try{
for(Vector<String>modulos:v){
fila=new Vector();
fila.add(modulos.elementAt(0));// guardo en la primera posicion el nombre del MODULO
rs=r_con.Consultar("select mod_id_modulo from modulo where mod_descripcion='"+modulos.elementAt(0)+"'");
while(rs.next())
id_modulo=rs.getInt(1);
for(Vector<String>tarea:tareas){
rs=r_con.Consultar("select tar_id_tarea from tarea where tar_descripcion='"+tarea.elementAt(0)+"'");
while(rs.next())
id_tarea=rs.getInt(1);
rs=r_con.Consultar("select per_id_perfil,mod_descripcion,tar_descripcion "
+"from permiso,modulo,tarea "
+"where mod_id_modulo=per_id_modulo and tar_id_tarea=per_id_tarea and "
+"per_id_modulo="+id_modulo+" and per_id_tarea="+id_tarea +" and per_id_perfil="+perfil);
if(rs.next())
fila.add(true);
else
fila.add(false);
}
rs.close();
matriz.add(fila);
}
r_con.cierraConexion();
}catch(Exception e){r_con.cierraConexion();}
return matriz;
} | 6 |
@Override
protected void onReceive(int clientId, String message) {
System.out.println("Received message from client " + clientId + ": \"" + message + "\"");
Message msg = Message.parse(message);
switch(msg.getType()) {
case ID_REQUEST:
//TODO send id response, send spawn messages to client, send spawn message to all clients
break;
case MOVE:
//TODO decide whether to move, bump, or sync
break;
}
} | 2 |
@Before
public void setUp() throws Exception {
} | 0 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
progress = new javax.swing.JProgressBar();
jLabel1 = new javax.swing.JLabel();
okButton = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(262, 123));
jLabel1.setText("傳送 ");
okButton.setText("完成");
okButton.setEnabled(false);
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
jLabel2.setText("已完成 0 bytes / 0 bytes");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
.addComponent(progress, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGap(96, 96, 96)
.addComponent(okButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(2, 2, 2)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progress, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(okButton)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents | 0 |
String multiplyHelper(String str1,int digit,int zeros){
if(digit==1){
for(int i=0;i<zeros;i++){
str1+="0";
}
return str1;
}
if(digit==0||str1.equals("0")){
return "0";
}
String str="";
int advance=0;
for(int i=str1.length()-1;i>=0;i--){
int temp=(str1.charAt(i)-'0')*digit+advance;
advance=temp/10;
str=Integer.toString(temp%10)+str;
}
while(advance>0){
str=Integer.toString(advance%10)+str;
advance/=10;
}
for(int i=0;i<zeros;i++){
str+="0";
}
return str;
} | 7 |
protected void initParts() {
assert this.composite1 == null: "This is a bug.";
assert this.implem_composite1 == null: "This is a bug.";
this.implem_composite1 = this.implementation.make_composite1();
if (this.implem_composite1 == null) {
throw new RuntimeException("make_composite1() in compClientDefQ5.Root should not return null.");
}
this.composite1 = this.implem_composite1._newComponent(new BridgeImpl_composite1(), false);
assert this.composite2 == null: "This is a bug.";
assert this.implem_composite2 == null: "This is a bug.";
this.implem_composite2 = this.implementation.make_composite2();
if (this.implem_composite2 == null) {
throw new RuntimeException("make_composite2() in compClientDefQ5.Root should not return null.");
}
this.composite2 = this.implem_composite2._newComponent(new BridgeImpl_composite2(), false);
assert this.idEvalThenStore == null: "This is a bug.";
assert this.implem_idEvalThenStore == null: "This is a bug.";
this.implem_idEvalThenStore = this.implementation.make_idEvalThenStore();
if (this.implem_idEvalThenStore == null) {
throw new RuntimeException("make_idEvalThenStore() in compClientDefQ5.Root should not return null.");
}
this.idEvalThenStore = this.implem_idEvalThenStore._newComponent(new BridgeImpl_idEvalThenStore(), false);
assert this.strEval == null: "This is a bug.";
assert this.implem_strEval == null: "This is a bug.";
this.implem_strEval = this.implementation.make_strEval();
if (this.implem_strEval == null) {
throw new RuntimeException("make_strEval() in compClientDefQ5.Root should not return null.");
}
this.strEval = this.implem_strEval._newComponent(new BridgeImpl_strEval(), false);
assert this.cmpEval == null: "This is a bug.";
assert this.implem_cmpEval == null: "This is a bug.";
this.implem_cmpEval = this.implementation.make_cmpEval();
if (this.implem_cmpEval == null) {
throw new RuntimeException("make_cmpEval() in compClientDefQ5.Root should not return null.");
}
this.cmpEval = this.implem_cmpEval._newComponent(new BridgeImpl_cmpEval(), false);
assert this.ident == null: "This is a bug.";
assert this.implem_ident == null: "This is a bug.";
this.implem_ident = this.implementation.make_ident();
if (this.implem_ident == null) {
throw new RuntimeException("make_ident() in compClientDefQ5.Root should not return null.");
}
this.ident = this.implem_ident._newComponent(new BridgeImpl_ident(), false);
} | 6 |
private void updateScreenActvCopyAllComponentValsToTxtFlds(){
for (int i = 0; i < currentlyShownActivityRowsNum; i++) {
int actvCompType = jLabelsActvArr[i].getCompType();
if( actvCompType != COMPONENT_TYPE_TEXTFIELD ){
String txtFldVal1;
String txtFldVal2;
String txtFldVal3;
if( actvCompType == COMPONENT_TYPE_CHECKBOX ){
txtFldVal1 = jCheckBoxesCol1[i].isSelected() ? ACTV_CB_CHECKED_VAL : ACTV_CB_UNCHECKED_VAL;
txtFldVal2 = jCheckBoxesCol2[i].isSelected() ? ACTV_CB_CHECKED_VAL : ACTV_CB_UNCHECKED_VAL;
txtFldVal3 = jCheckBoxesCol3[i].isSelected() ? ACTV_CB_CHECKED_VAL : ACTV_CB_UNCHECKED_VAL;
}else if( actvCompType == COMPONENT_TYPE_SLIDER ){
txtFldVal1 = String.valueOf( jSlidersCol1[i].getValue() );
txtFldVal2 = String.valueOf( jSlidersCol2[i].getValue() );
txtFldVal3 = String.valueOf( jSlidersCol3[i].getValue() );
}else{
//never gonna happen?
continue;
}
jTextFieldsCol1[i].setText( txtFldVal1 );
jTextFieldsCol2[i].setText( txtFldVal2 );
jTextFieldsCol3[i].setText( txtFldVal3 );
}
}
} | 7 |
@Override
public void execute() {
Variables.status = "Summoning";
Walking.walk(new Tile(3658, 5094, 0));
Task.sleep(500, 600);
if(Skills.getRealLevel(Skills.SUMMONING) >= 83) {
if(Summoning.getPoints() > 8 && Inventory.getItem(Variables.LAVA_TITAN_POUCH_ID) != null) {
Summoning.summonFamiliar(Summoning.Familiar.LAVA_TITAN);
Task.sleep(1000, 1500);
} else {
Item potion = Inventory.getItem(Variables.SUMMONING_POTION_ID);
if(potion != null) {
potion.getWidgetChild().click(true);
Task.sleep(1200, 1600);
while(Players.getLocal().getAnimation() != -1) {
Task.sleep(50, 60);
}
} else {
Variables.usingSummoning = false;
}
}
} else {
if(Summoning.getPoints() > 7 && Inventory.getItem(Variables.OBSIDIAN_GOLEM_POUCH_ID) != null) {
Summoning.summonFamiliar(Summoning.Familiar.OBSIDIAN_GOLEM);
Task.sleep(1000, 1500);
} else {
Item potion = Inventory.getItem(Variables.SUMMONING_POTION_ID);
if(potion != null) {
potion.getWidgetChild().click(true);
Task.sleep(1200, 1600);
while(Players.getLocal().getAnimation() != -1) {
Task.sleep(50, 60);
}
} else {
Variables.usingSummoning = false;
}
}
}
} | 9 |
public PegsHash( PegsBoardType type, boolean[][] board )
{
hashes = new int[(type.places.length >> 5) + 1];
int hashIndex = 0;
int k = 0;
for (PegsPoint p : type.places)
{
hashes[hashIndex] |= (board[p.y][p.x] ? 1 : 0) << k;
if (++k == 32)
{
k = 0;
hashIndex++;
}
}
hash = hashes[0];
for (int i = 1; i < hashes.length; i++)
{
hash ^= hashes[i];
}
} | 4 |
@Override
public double getVariance() throws VarianceException {
if (nu <= 1) {
throw new VarianceException("t variance nu > 1.");
} else if (1 < nu && nu <= 2) {
return Double.POSITIVE_INFINITY;
} else {
return (double) nu / (nu - 2);
}
} | 3 |
private void seeParse(ArrayList<ObjInfo> seeArray, String[] splitPacket) {
for(int i = 2; i < splitPacket.length; i += 4)
{
// Split up the ObjName
String[] splitName = (splitPacket[i].split(" "));
String[] splitInfo = (splitPacket[i+1].split(" "));
// Determine type of object:
// - Flag -
if(splitName[0].compareTo("f") == 0) {
ObjFlag newFlag = new ObjFlag(splitPacket[i].replaceAll(" ", ""));
seeFlagParse(splitName, splitInfo, newFlag);
seeArray.add(newFlag);
}
// - Ball -
else if(splitName[0].compareTo("b") == 0) {
ObjBall newBall = new ObjBall();
seeBallParse(splitInfo, newBall);
seeArray.add(newBall);
}
// - Player -
else if(splitName[0].compareTo("p") == 0) {
ObjPlayer newPlayer = new ObjPlayer();
seePlayerParse(splitName, splitInfo, newPlayer);
seeArray.add(newPlayer);
}
// - Goal -
else if(splitName[0].compareTo("g") == 0) {
ObjGoal newGoal = new ObjGoal();
seeGoalParse(splitName, splitInfo, newGoal);
seeArray.add(newGoal);
}
// - Line -
else if(splitName[0].compareTo("l") == 0) {
ObjLine newLine = new ObjLine();
seeLineParse(splitName, splitInfo, newLine);
seeArray.add(newLine);
}
}
} | 6 |
void setCellForeground () {
if (!instance.startup) {
table1.getItem (0).setForeground (1, cellForegroundColor);
}
/* Set the foreground color item's image to match the foreground color of the cell. */
Color color = cellForegroundColor;
if (color == null) color = table1.getItem (0).getForeground (1);
TableItem item = colorAndFontTable.getItem(CELL_FOREGROUND_COLOR);
Image oldImage = item.getImage();
if (oldImage != null) oldImage.dispose();
item.setImage (colorImage(color));
} | 3 |
public void goTop()
{
nNode = Idx[I].top;
sRecno = 0;
found = false;
nKey = 0;
for(;;)
{
goNode();
readPage();
if(left_page>0) nNode=left_page;
else
{
for(;;)
{
if(key_cnt>0 || right_page<0) break;
nNode = right_page;
goNode();
readPage();
}
nKey = 0;
if(LEAF)
{
found = true;
sRecno = pgR[nKey];
break;
}
else nNode = pgP[nKey]; // go deeper in child node
}
}
updidx();
} | 6 |
public Memento saveToMemento() {
// TODO erstellen
MementoBoard memento = new MementoBoard(this.numOfColumns(), this.numOfRows());
// FIXME richtige reihenfolge? oder rows zuerst?
// FIXME passt das sonst?
for (int row = 0; row < this.numOfRows(); ++row) {
for (int col = 0; col < this.numOfColumns(); ++col) {
memento.putCell(board[col][row]);
}
}
memento.seal();
return memento;
} | 2 |
public static void main(String[] args) {
setIsPrime();
//asn is [a, b, count]
int[] ans = new int[]{-1000, -1000, -1};
for(int a = -999; a < 1000; a++)
for(int b = -999; b < 1000; b++) {
int x = 0;
int count = 0;
int f = x*x + a*x + b;
while( f >= 0 && isPrime[f] ) {
count++;
x++;
f = x*x + a*x + b;
}
if(count > ans[2])
ans = new int[]{a, b, count};
}
System.out.println(ans[0] +" * "+ ans[1] +" = "+ ans[0]*ans[1]);
} | 5 |
@Override
public int compareTo(final MethodStatistics o) {
return (time < o.time ? -1 : (time == o.time ? 0 : 1));
} | 2 |
private NodeDouble<E> getIndex(int index){
if (index == 0){
return _head;
}
else if(index == _lenght-1){
return _tail;
}
else if (0< index && index < _lenght-1){
int calculo = (_lenght/2) - index;
NodeDouble<E> actual;
if(calculo <= 0){
calculo = _lenght - index-1;
actual = _tail;
for(int i = 0; i< calculo; i++){
actual = actual.getPrev();
}
}
else{
actual = _head;
for(int i = 0; i< index; i++){
actual = actual.getNext();
}
}
return actual;
}
else{
throw new IndexOutOfBoundsException("Fuera del rango: " + index);
}
} | 7 |
public CheckResultMessage check21(int day) {
return checkReport.check21(day);
} | 0 |
@Override
public final int getId(final Path path) throws InterruptedException {
@SuppressWarnings("hiding")
final Integer id;
synchronized (Deserializer_0.this.idMapOut) {
id = Deserializer_0.this.idMapOut.get(path);
if (id == null) {
Deserializer_0.this.idMapOut.put(path, -1);
}
}
if (id == null) {
return -1;
}
if (id.intValue() == -1) {
synchronized (Deserializer_0.this.idMapOut) {
while (Deserializer_0.this.idMapOut.get(path) == -1) {
Deserializer_0.this.idMapOut.wait();
}
return getId(path);
}
}
return id.intValue();
} | 4 |
public static Properties toProperties(JSONObject jo) throws JSONException {
Properties properties = new Properties();
if (jo != null) {
Iterator keys = jo.keys();
while (keys.hasNext()) {
String name = keys.next().toString();
properties.put(name, jo.getString(name));
}
}
return properties;
} | 2 |
public static void main(String[] args) {
long ntscIncrementAsLong = 0x3F9111109E88C1B0L; // 0.0166666666
double ntscIncrement = Double.longBitsToDouble(ntscIncrementAsLong);
long palIncrementAsLong = 0x3F9485CD701C02FCL; // 0.020041666
double palIncrement = Double.longBitsToDouble(palIncrementAsLong);
float ntscTime = 0;
float palTime = 0;
int ntscHundredths = 0;
int palHundredths = 0;
float oldNtscTime = 0;
for (int i = 0; i < 50000000; i++) {
oldNtscTime = ntscTime;
ntscTime = (float) ( ((double) ntscTime) + ntscIncrement );
palTime = (float) ( ((double) palTime) + palIncrement );
ntscHundredths = (int) (((float) 100.0) * ntscTime);
palHundredths = (int) (((float) 100.0) * palTime);
if (ntscTime > 2048 && ntscTime < 2049) {
System.out.println(ntscIncrement * (1<<11));
System.out.println((((double) ntscTime) - ((double) oldNtscTime))*(1<<11));
}
if (i % 2 == 1 && (i/2 + 1) % 10000 == 0) {
//System.out.println((i/2+1) + "\t" + ntscTime + "\t" + ntscHundredths + "\t" + palTime + "\t" + palHundredths);
}
}
} | 5 |
@EventHandler
public void onPlayerInventoryClose(InventoryCloseEvent e)
{
String title;
Player p;
ItemStack[] stack;
title = e.getInventory().getTitle();
if (!title.contains("Armor"))
return;
p = Bukkit.getPlayer(title.substring(0, title.indexOf("'s") - 1));
if (p == null)
return;
stack = new ItemStack[4];
for (int i = 0; i < 4; i++)
stack[i] = e.getInventory().getContents()[i] == null ? null : e.getInventory().getContents()[i].clone();
p.getInventory().setArmorContents(stack);
} | 4 |
public void get()
{
System.out.print(value);
} | 0 |
public static boolean isPrimitiveWrapper(Class type) {
return (
// (type == Boolean.class) ||
(type == Integer.class) ||
(type == Long.class) ||
// (type == Short.class) ||
(type == Float.class) ||
(type == Double.class)); // ||
//(type == Byte.class) ||
//(type == Character.class));
} | 3 |
Object getProperty(String property, int index) {
//Logger.debug("Measures.getProperty(" +property + "," + index +")");
if ("count".equals(property))
{ return new Integer(measurementCount); }
if ("countPlusIndices".equals(property)) {
return index < measurementCount
? measurements[index].countPlusIndices : null;
}
if ("stringValue".equals(property)) {
return index < measurementCount
? measurements[index].strMeasurement : null;
}
if ("info".equals(property)) {
return getAllInfo();
}
if ("infostring".equals(property)) {
return getAllInfoAsString();
}
return null;
} | 7 |
public CloseProgram() {
setIconImage(Toolkit.getDefaultToolkit().getImage(CloseProgram.class.getResource("/InterfazGrafica/Images/Warning.png")));
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setModal(true);
setTitle("BOLSA DE EMPLEOS REP.DOM");
setBounds(100, 100, 450, 300);
setLocationRelativeTo(rootPane);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackground(new Color(248, 248, 255));
contentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
getContentPane().add(contentPanel, BorderLayout.CENTER);
setModal(true);
contentPanel.setLayout(null);
{
JLabel lblEstSeguroQue = new JLabel("\u00BFEst\u00E1 seguro que desea salir de Bolsa de Empleos Rep.Dom?");
lblEstSeguroQue.setBounds(10, 25, 414, 31);
lblEstSeguroQue.setHorizontalAlignment(SwingConstants.CENTER);
lblEstSeguroQue.setFont(new Font("Tahoma", Font.BOLD, 12));
contentPanel.add(lblEstSeguroQue);
}
{
JLabel lblBolsaDeEmpleos = new JLabel("Bolsa de Empleos Rep. Dom");
lblBolsaDeEmpleos.setBounds(170, 95, 165, 14);
lblBolsaDeEmpleos.setHorizontalAlignment(SwingConstants.CENTER);
contentPanel.add(lblBolsaDeEmpleos);
}
{
JLabel lblSystem = new JLabel("System 3M's 2014");
lblSystem.setBounds(170, 120, 165, 14);
lblSystem.setHorizontalAlignment(SwingConstants.CENTER);
contentPanel.add(lblSystem);
}
{
JLabel lblVersin = new JLabel("Versi\u00F3n 1.0");
lblVersin.setBounds(170, 145, 165, 14);
lblVersin.setHorizontalAlignment(SwingConstants.CENTER);
contentPanel.add(lblVersin);
}
separator.setBounds(0, 224, 434, 38);
contentPanel.add(separator);
JLabel lblNewLabel = new JLabel("New label");
lblNewLabel.setIcon(new ImageIcon(CloseProgram.class.getResource("/InterfazGrafica/Images/Encontrar-Trabajo1.jpg")));
lblNewLabel.setBounds(73, 88, 63, 79);
contentPanel.add(lblNewLabel);
{
JPanel buttonPane = new JPanel();
buttonPane.setBorder(new LineBorder(new Color(0, 0, 0)));
buttonPane.setBackground(new Color(248, 248, 255));
buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
SiButton = new JButton("Aceptar");
SiButton.setRequestFocusEnabled(false);
SiButton.setIcon(new ImageIcon(CloseProgram.class.getResource("/InterfazGrafica/Images/botonsi.png")));
SiButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
SiButton.setActionCommand("Aceptar");
buttonPane.add(SiButton);
getRootPane().setDefaultButton(SiButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.setIcon(new ImageIcon(CloseProgram.class.getResource("/InterfazGrafica/Images/Delete32.png")));
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
setVisible(false);
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
} | 0 |
public void assignVariables(String host, int port) {
hostName = host;
portNumber = port;
try {
echoSocket = new Socket(host, port);
} catch (UnknownHostException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
try {
out = new PrintWriter(echoSocket.getOutputStream(), true);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
stdIn = new BufferedReader(new InputStreamReader(System.in));
} | 4 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.