text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Test
public void testRemoveBlackMarker() {
System.out.println("removeBlackMarker");
Cell instance = new Cell(0,0);
instance.addBlackMarker(0);
instance.addBlackMarker(1);
instance.addBlackMarker(2);
instance.addBlackMarker(3);
instance.addBlackMarker(4);
... | 0 |
public boolean studentFulfillsDegreeRequirements(int studentId, int degreeId) {
if(!isValidId(studentId) || !isValidId(degreeId)) {
return false;
}
Student student = studentDao.getStudent(studentId);
Degree degree = degreeDao.getDegree(degreeId);
if (student != null && degree != null) {
for (C... | 6 |
private ArrayList<Cell> getVisitedNeighbors(Cell curCell) {
ArrayList<Cell> neighbors = new ArrayList<Cell>();
//Look at top...
if(curCell.getX() - 1 >= 0 && !cellMaze[curCell.getX() - 1][curCell.getY()].isVisited())
neighbors.add(cellMaze[curCell.getX() - 1][curCell.getY()]);
//Look at bottom...
... | 8 |
public void setServeurBd(String serveurBd) {
this.serveurBd = serveurBd;
} | 0 |
@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, TpURL tpURL, Invocation invocation) throws RpcException {
if (invokers == null || invokers.size() == 0) {
return null;
}
if (invokers.size() == 1) {
return invokers.get(0);
}
return doSelect(invokers, tpURL, invocation);
} | 3 |
private boolean patternSame( byte[] pattern )
{
if ( this.pattern != null && this.pattern.length == pattern.length )
{
for ( int i=0;i<pattern.length;i++ )
if ( pattern[i] != this.pattern[i] )
return false;
return true;
}
else
return false;
} | 4 |
@Test
public void testPutTracking()throws Exception{
Tracking tracking = new Tracking("RC328021065CN");
tracking.setSlug("canada-post");
tracking.setTitle("another title");
Tracking tracking2 = connection.putTracking(tracking);
Assert.assertEquals("Should be equals title", "... | 1 |
public void cmdBids(CommandSender sender, String[] args) {
if( args.length < 2 ) {
sender.sendMessage(Conf.colorMain + "Usage:");
sender.sendMessage(Conf.colorAccent + "/ee bids <material name>");
return;
}
Material material = materials.get(args[1]);
if( material == null ) {
sender.sendMessage... | 5 |
public static void main(String[] args) throws IOException,
InstantiationException, IllegalAccessException, InterruptedException, ExecutionException {
System.out.println("Running benchmark. Press any key to continue.");
System.in.read();
Map<Class<?>, Map<String, String>> keyLookupCl... | 4 |
private synchronized static void cleanUpAllExpiredSession() {
Iterator it = sessions.entrySet().iterator();
long currTime = new Date().getTime();
while(it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
Session iSession = (Session)pair.getValue();
if(iSession.isExpired(currTime)) {
it.remove();
... | 2 |
private String sendRequest(String endpoint, Map<String, String> params) {
try {
StringBuffer paramBuffer = new StringBuffer();
Iterator<Map.Entry<String, String>> it = params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> pair = it.next();
paramBuffer.append(URLEncoder.encode... | 8 |
public void Mstep(List<Instance> instances) {
int insIndex = 0;
List <Double> counts = new ArrayList<Double>();
List <FeatureVector> newClusters = new ArrayList<FeatureVector>();
// init the counts and new clusters.
for (int i = 0 ; i < clusters.size() ; i++ ) {
counts.add(0.0);
newClusters.add(new Feat... | 3 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ArrayList<CompRequest> comp = new ArrayList<CompRequest>();
ArrayList<PaidRequest> paid = new ArrayList<PaidRequest>();
response.setContentType("text/html;char... | 7 |
final public CycList nonAtomicSentenceDenotingDenotationalTerm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycList val;
val = nonAtomicDenotationalTerm(false);
eof(requireEOF);
{if (true) return val;}
throw new Error("Missing return statement in fun... | 1 |
Object[] parameterForType(String typeName, String value, Widget widget) {
if (typeName.equals("org.eclipse.swt.widgets.TreeItem")) {
TreeItem item = findItem(value, ((Tree) widget).getItems());
if (item != null) return new Object[] {item};
}
if (typeName.equals("[Lorg.eclipse.swt.widgets.TreeItem;")) {
S... | 5 |
private void initialize() {
this.history = new DefaultComboBoxModel();
// Setup North Panel
JPanel north_panel = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
north_panel.setLayout(gridbag);
LOCATION = "Location"; // GUITreeLoader.reg.... | 0 |
private void moveSnakeHeadToTheOtherSideOfTheWorld(SnakePiece head)
{
int x = head.getX();
int y = head.getY();
if (x < 0)
{
head.setX(width);
}
else if (x > width)
{
head.setX(0);
}
if (y < 0)
{
head.setY(height);
}
else if (y > height)
{
head.setY(0);
}
} | 4 |
public void rotateRight(RBNode x) {
// pushing node x down and to the Right to balance the tree. x's Left child (y)
// replaces x (since x < y), and y's Right child becomes x's Left child
// (since it's < x but > y).
RBNode y = x.getLeft(); // get x's Left node, this becomes y
// set x's... | 5 |
* @Post: Queries the user for what type to upgrade the pawn to, and does so
* @Return: None
*/
private void upgradePawn(Piece thePiece) {
int whatToUpgradeTo=-1;
Object answer = null;
Object[] possibilities = {"Queen", "Knight", "Rook", "Bishop"};
if(isAI(isWhitesTurn()))//then it is the AI of the current... | 8 |
public String toString()
{
return "Employee[name=" + name + ",salary=" + salary + ",hireDay=" + hireDay + "]";
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... | 7 |
public static void main(String[] args) {
int port = 8888;
Socket socket = null;
BufferedReader in = null;
PrintWriter out = null;
try {
socket = new Socket("127.0.0.1", port);
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream()... | 7 |
private String moveCardOntoTopRow(List<Card> from, int boardIndexTo, int listIndexFrom) {
List<Card> pile = topRow.get(boardIndexTo);
Card fromTop = from.get(listIndexFrom);
if (pile.size() == 0) {
if (fromTop.getRank() == Card.Rank.ACE) {
pile.add(from.get(listIndex... | 6 |
public void blackTurn(int sx, int sy, int ex, int ey) {
int piece = board.getPiece(sx, sy);
board.blackTurn(sx, sy, ex, ey);
if (board.getMoveB()) {
setInfo(0);
turns++;
if (cm.canAttackKing(board.getBoard(), piece, ex, ey)) {
... | 5 |
private static final double getPositionNearSource( int amountOfPixelsAway, TextStrategyParameters parameters ) {
double length = parameters.getPath().getTotalLength();
if( length == 0 ) {
return 0;
}
double position = amountOfPixelsAway / length;
return Math.max( 0, Math.min( 0.5, position ) );
} | 1 |
public GameChrono(GameCanvas gc, ProBotGame game) {
this.gc = gc;
this.game = game;
} | 0 |
public Object calculate(GraphModel g) {
ZagrebIndexFunctions zif = new ZagrebIndexFunctions(g);
ZagrebIndexFunctions zifL = new ZagrebIndexFunctions(LineGraph.createLineGraph(g));
RenderTable ret = new RenderTable();
Vector<String> titles = new Vector<>();
titles.add(" p ");
... | 9 |
@Override
public void caseAVetorVar(AVetorVar node)
{
inAVetorVar(node);
if(node.getIdentificador() != null)
{
node.getIdentificador().apply(this);
}
if(node.getColcheteE() != null)
{
node.getColcheteE().apply(this);
}
if(no... | 4 |
public final boolean postSync( Message event ){
int dispatchedCount = 0;
MessageType type = event.getType();
for( MListener listener : ELIST ){
if( listener.isSupported( type ) ){
listener.update( event );
++dispatchedCount;
}
}
if( dispatchedCount == 0 ){
... | 3 |
private void recordActive() {
this.activeSince = new Date().getTime();
} | 0 |
public String diff_toDelta(LinkedList<Diff> diffs) {
StringBuilder text = new StringBuilder();
for (Diff aDiff : diffs) {
switch (aDiff.operation) {
case INSERT:
try {
text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8")
.replace('+', ' ')).append("\t");
} catch (UnsupportedEncod... | 6 |
public void method464(Model model, boolean flag)
{
anInt1626 = model.anInt1626;
anInt1630 = model.anInt1630;
anInt1642 = model.anInt1642;
if(anIntArray1622.length < anInt1626)
{
anIntArray1622 = new int[anInt1626 + 100];
anIntArray1623 = new int[anInt1626 + 100];
anIntArray1624 = new int[anInt1626 +... | 6 |
private String md5Encode(String plainText) {
String re_md5 = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i =... | 4 |
@Override
public void write(File file) throws IOException {
FileOutputStream fout = new FileOutputStream(file);
DataOutputStream dout = new DataOutputStream(fout);
//check if charFrequencies should be stored as a byte, short, or int
byte dataType = 0;
for(int i : charFrequencies) {
if(i > Short.MAX_VAL... | 7 |
public void setCheckinDate(Date checkinDate) {
this.checkinDate = checkinDate;
} | 0 |
public void create(PypAdmAgend pypAdmAgend) {
if (pypAdmAgend.getPypAdmAsistConList() == null) {
pypAdmAgend.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
... | 9 |
public void setText(String s)
{
myText = s;
refresh();
} | 0 |
private File searchOtherFiles(File folder, String searchFile) {
File retVal = null;
for (File file : reverseArray(folder.listFiles())) {
if (file.isDirectory()) {
retVal = searchOtherFiles(file, searchFile);
if (retVal != null) {
return retVal;
}
} else {
if (file.getName().equals(search... | 4 |
public Enumeration listOptions() {
Vector result;
Enumeration enm;
String param;
SelectedTag tag;
int i;
result = new Vector();
enm = super.listOptions();
while (enm.hasMoreElements())
result.addElement(enm.nextElement());
param = "";
for (i = 0; i < TAGS_ALGORITHM... | 7 |
public void loadSound(String fileName)
{
AudioInputStream audioIn = null;
try
{
URL url = Main.class.getResource(fileName);
audioIn = AudioSystem.getAudioInputStream(url);
Clip player = AudioSystem.getClip();
player.open(audioIn);
s... | 3 |
public void limitMaximumSpeed() {
// prevent speed from getting to fast
if (xOffset > MAX_SPEED)
xOffset = MAX_SPEED;
if (xOffset < -MAX_SPEED)
xOffset = -MAX_SPEED;
if (yOffset > MAX_SPEED)
yOffset = MAX_SPEED;
if (yOffset < -MAX_SPEED)
yOffset = -MAX_SPEED;
} | 4 |
public static Quiz[] getQuizzesbyUser(int UserId, boolean Completed)
{
try {
String query = String.format("SELECT * FROM QUIZ\n" +
"where quizid %s in (select quizid from quizresult where \n" +
"userid = %d)", Completed? " " : "not", UserId);
ResultSe... | 3 |
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if (l1 == null)
return l2;
if (l2 == null)
return l1;
ListNode head = new ListNode(0);
ListNode current = head;
ListNode previous = null;
int carry = 0;
while (l1 != null && l2 !=... | 9 |
public static void main(String[] args) {
try {
Tools[] rtss = new Tools[]{new RepositoryTools("repo"), new CLIEntryTools("entry"), new MacroTools("macro"), new CLIRoutineTools("routine"), new CLIUtilityTools("util")};
CLIParams params = getCommandLineParamaters(args);
if (params == null) return;
Strin... | 9 |
@Override
public String toString()
{
StringBuffer ret = new StringBuffer("");
// Do the static stuff
ret.append("#T#" + trackNumber + "~" + title + "~" + lengthInSeconds);
// Do the personnel
Iterator<Artist> pIt = personnel.iterator();
while (pIt.hasNext())
ret.appe... | 2 |
public static void drawBufferedObject(BufferData bd)
{
GL2 gl = RobotPart.gl;
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
if(bd.getTextureId() != -1)
gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
... | 2 |
public DNode getNext(DNode v) throws IllegalStateException{
if(isEmpty()) throw new IllegalStateException("List is empty");
return v.getNext();
} | 1 |
public void getConnected() {
cpds = new ComboPooledDataSource();
try {
cpds.setDriverClass("com.mysqljdbc.Driver");
} catch (PropertyVetoException e) {
e.printStackTrace();
}
cpds.setJdbcUrl("jdbc:mysql://localhost:3456/bw_web");
cpds.setUser("cbw");
cpds.setPassword("test");
cpds.setMinPoolSiz... | 1 |
@Test
public void testSetupFromOpenID() {
CredentialConnection conn = CredentialConnection.getInstance();
conn.setDebug(true);
try {
conn.setupFromOpenID("hasdfttps://asldhlakjhs");
fail("Malformed URL!");
} catch (MalformedURLException e) {
//ok
... | 6 |
private void checkNewPos() {
if (Main.getGamestate().getMonster().awake) {
Main.getGamestate().getMonster().move(Main.getGamestate().getPlayer());
}
for (int i = 0; i <= 4; i++) {
if (Main.getGamestate().getEntities().containsKey(RenderPriority.getRenderPriorityFromId(i))) {
for (Entity entity : Main.ge... | 9 |
public void removeSelected() {
if (getSelectionPath() != null) {
Object o = getSelectionPath().getLastPathComponent();
if (o != null && o instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode n = (DefaultMutableTreeNode) o;
if (n.getUserObject() != null
&& n.getUserObject() instanceof NodeLa... | 5 |
@Override
public void undo() throws CannotUndoException {
super.undo();
if (selectedManipulable instanceof Part) {
Shape shape = selectedManipulable.getShape();
if (shape instanceof TransformableShape) {
TransformableShape s = (TransformableShape) shape;
switch (scaleDirection) {
case 0:
s.s... | 7 |
public void encodeDirectBits(int v, int numTotalBits) throws IOException {
for (int i = numTotalBits - 1; i >= 0; i--) {
Range >>>= 1;
if (((v >>> i) & 1) == 1) {
Low += Range;
}
if ((Range & Encoder.kTopMask) == 0) {
Range <<= 8;
... | 3 |
void checkCommands1()
{
int i;
Entity thnStore;
String strStore=null;
for (i=0;i<vctSide1.size();i++)
{
thnStore = (Entity)vctSide1.elementAt(i);
if (!thnStore.vctCommands.isEmpty())
{
strStore = (String)thnStore.vctCommands.elementAt(0);
thnStore.vctCommands.removeElementAt(0);
if (strS... | 7 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
final int rID = Integer.parseInt(request.getParameter("rID"));
PrintWriter out = response.getWriter();
if (new Control(rID).startPlagiatsSearch(rID))
{
... | 1 |
public void act() {
// This function handles all of an Agents' behavior in
// any given step.
// First, check if the Agent has enough energy to survive
// the step, otherwise remove it.
if (energy < metabolism) {
remove();
} else {
// Let the Agent kn... | 3 |
Shard build(Config config) throws IOException {
NestedShard root = new NestedShard();
for (Map.Entry<String, ConfigValue> entry : config.root().entrySet()) {
String key = entry.getKey();
Shard shard = EMPTY_SHARD;
if (ConfigValueType.STRING.equa... | 3 |
private void updateStateTellCountryFound(List<Keyword> keywords, List<String> terms) {
//We came here due to a jump, so the Ingredient should have been passed, if not there's an error
if (keywords != null && !keywords.isEmpty()) {
for (Keyword kw : keywords) {
if (kw.getKeywordData().getType().equals(KeywordT... | 9 |
static String locDesc(Description descr, Locale l) {
if (l == null) {
return descr.value();
}
if (l.getLanguage().equals("en")) {
return descr.en().isEmpty() ? descr.value() : descr.en();
} else if (l.getLanguage().equals("de")) {
... | 5 |
public Screen createNew() {
try {
Constructor<? extends Screen> c = clazz.getDeclaredConstructor(new Class[] {});
return c.newInstance();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printSta... | 7 |
public static String getBookID(){
try {
ResultSet rs=DB.myConnection().createStatement().executeQuery("select max(BookID) from book");
while(rs.next()){
int ongoingId=(rs.getInt(1));
int nextId=ongoingId+1;
maxid=Integer.toString(nextId);
... | 4 |
public void run() {
/////////////////////////////////////////////////////
// For ease of I/O (since we haven't yet discussed
// binary packet data), convert the distance vector into
// a String so it can be read using a Scanner:
//////////////////////////////////////////////////... | 4 |
public void setjLabel1(JLabel jLabel1) {
this.jLabel1 = jLabel1;
} | 0 |
public void save()
{
if(this.chunkFile == null)
{
log.warning("Chunk file not found. You might want to check that if you want to save anything.");
return;
}
try
{
this.chunks.save(this.chunkFile);
}
catch(IOException ex)
... | 4 |
public void excute(Minecart minecart, MinecartControl mc, String... job) {
if (!(minecart instanceof InventoryHolder) || minecart instanceof PoweredMinecart) {
return;
}
InventoryHolder invMinecart = (InventoryHolder) minecart;
HashSet<ItemStack> itemStacks = mc.getUtils()... | 9 |
@Override
public ReduceOutput call(){
ReduceOutput reduceResult = new ReduceOutput(mapOut.elementAt(0).fileName, in.NC);
for (int i = 0; i < mapOut.size(); i++) {
reduceResult.wordCount += mapOut.elementAt(i).wordCount;
Iterator it = mapOut.elementAt(i).docVector.entrySet().i... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Camion other = (Camion) obj;
if (this.carga != other.carga) {
return false;
}
... | 9 |
public FreebaseUrl(String url){
super(url);
Properties props = new Properties();
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("secrets.properties");
try{
props.load(inputStream);
key = props.getProperty("omnom.freebase.apikey");
}
catch(IOException ex){
ex.printStackTra... | 1 |
private static void testBoundaries() {
int[] boundaries = {
1602,
540,
488,
238,
245,
258,
430,
441,
440,
441,
441,
422,
298,
430,
1000};
int[] histogram = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Hand h;
for(int i = 0; i < 1000000; i++) {
if(i % 10000 == 0... | 6 |
public void render(Screen screen) {
if (getDir() == 0)
sprite = Sprite.zombie_up;
if (getDir() == 1)
sprite = Sprite.zombie_right;
if (getDir() == 2)
sprite = Sprite.zombie_down;
if (getDir() == 3)
sprite = Sprite.zombie_left;
if (dead)
sprite = Sprite.zombie_dead;
screen.renderItem(x - 16, y... | 9 |
public void shrink (int maximumCapacity) {
if (maximumCapacity < 0) throw new IllegalArgumentException("maximumCapacity must be >= 0: " + maximumCapacity);
if (size > maximumCapacity) maximumCapacity = size;
if (capacity <= maximumCapacity) return;
maximumCapacity = ObjectMap.nextPowerOfTwo(maximumCapacity);
... | 3 |
public void initHSLbyRGB( int R, int G, int B )
{
// sets Hue, Sat, Lum
int cMax;
int cMin;
int RDelta;
int GDelta;
int BDelta;
int cMinus;
int cPlus;
pRed = R;
pGreen = G;
pBlue = B;
//Set Max & MinColor Values
cMax = iMax( iMax( R, G ), B );
cMin = iMin( iMin( R, G ), B );
cMinus = c... | 6 |
@Override
public long spawnBoss(String bossData) {
super.spawnBoss(bossData);
GameActor a = Application.get().getLogic().createActor(bossData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
pc.setLocation(x + Display.getWidth() + 100, y + 200);
p... | 1 |
public boolean execute()throws MalformedURLException,IOException,TransactionException{
Transaction tr;
int code;
do{
tr=new Transaction(host,path,port);
if(tr.execute()){
code=tr.getCode();
switch (code){
cas... | 9 |
@Override
public void sawOpcode(int opcodeSeen) {
boolean check = true;
String sigOperand = "";
try
{
sigOperand = getSigConstantOperand().toString();
}
catch(IllegalStateException e)
{
check = false;
}
if (check == true && opcodeSeen == INVOKESTATIC && getClassConstantOperand().equals("java/... | 7 |
@Override
public int getType() { return BuildingType.FARM.ordinal(); } | 0 |
public Animation(BufferedImage step1, BufferedImage step2, BufferedImage step3){
if(step1 == null || step2 == null || step3 == null) {
if(step1 == null) System.err.print("Step 1 was NPE. Address: " + this + "\n");
if(step2 == null) System.err.print("Step 2 was NPE. Address: " + this + "\n");
if(step3 == null... | 6 |
private void updateNeededMoney(int amount) {
int money = this.money + amount;
if(money < 0) {
neededMoney -= money;
} else if(neededMoney > 0) {
neededMoney -= money;
if(neededMoney < 0) {
neededMoney = 0;
}
}
} | 3 |
public void addPredator(Animal animal) {
predators.add(animal);
} | 0 |
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... | 4 |
@Override
public void doTag() throws JspException {
JspWriter out = getJspContext().getOut();
// sorge für Verbindung zur Datenbank
FilmothekModel model = new FilmothekModel();
UserBean borrower;
try {
// gibt das Rückgabedatum aus, falls der Film ausgeliehen is... | 3 |
private void promptForMatchSave() {
int chosenOption = JOptionPane.showConfirmDialog(this, "Save the current game before closing it?", "Quit without saving?",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (chosenOption == JOptionPane.YES_OPTION) {
showSaveDialog();
}
} | 1 |
@Override
public void reactPressed(MouseEvent e) {
if (isPressed)
return;
super.reactPressed(e);
if (StateMachine.getState() == ProgramState.SONG_PLAYING) {
StateMachine.setState(ProgramState.EDITING);
theStaff.stopSong();
} else if (StateMachine.g... | 3 |
public static void listPlayersHomes( BSPlayer player ) throws SQLException {
if ( player.getHomes().isEmpty() ) {
player.sendMessage( Messages.NO_HOMES );
return;
}
boolean empty = true;
for ( String server : player.getHomes().keySet() ) {
String homes... | 5 |
public void checkConnection() throws Exception
{
if (!socket.isConnected())
{
//fixed
if(Server.mapTest.containsKey(socket))
{
Server.mapTest.remove(socket);
}
//fixed
for (Map.Entry<Socket,User> entry: Server.mapTest.entrySet())
{
Socket temp = entry.getKey();
PrintWriter temp... | 3 |
static boolean check(int r, int c) {
return r >= 0 && r < 4 && c >= 0 && c < 4;
} | 3 |
private void tblEmployeeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblEmployeeMouseClicked
int row = tblEmployee.convertRowIndexToModel(tblEmployee.getSelectedRow());
int personeelsnummer = Integer.parseInt(tblEmployee.getModel().getValueAt(row, 0).toString());
selectedEmploy... | 2 |
public CycList deleteDuplicates() {
if (this.isProperList) {
if (this.contains(this.dottedElement)) {
this.setDottedElement(null);
}
}
for (int i = 0; i < this.size(); i++) {
for (int j = i + 1; j < this.size(); j++) {
if (this.get(i).equals(this.get(j))) {
this.r... | 5 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static boolean wordBreak(String s, HashSet<String> dict) {
int len = s.length();
boolean res = false;
//String tmpStr = s;
Iterator<String> iterator=dict.iterator();
String[] str = new String[len*len];
int[] idx = new int[len*len];
int i=0;
int tmpidx;
String repStr = "";
int nextStart = 0;
... | 8 |
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attr) {
if (attr.isRegularFile()) {
String name = "" + file;
if (name.endsWith(".txt")) {
for (JSONArray comments : extractor.extractFromCrawler(file, related)) {
this.docs.addJSONComments(comments);
}
} else if (Characte... | 4 |
@Override
public void initTableModel(JTable table, List<Users> list) {
//Формируем массив пользователей для модели таблицы
Object[][] usersArr = new Object[list.size()][table.getColumnCount()];
int i = 0;
for (Users user : list) {
//Создаем массив для пользователя
... | 4 |
public static <R,T> R reduce(Collection<T> c, Function2<R,T> f, R z) {
for (T e : c) {
z = f.apply(z, e);
}
return z;
} | 1 |
public boolean wordExists(final String word, final List<String> words){
for (final String current : words) {
if( word.equalsIgnoreCase(current) ) {
return true;
}
}
return false;
} | 2 |
private ImageProcessor performWatershedding(List<Point> maximList, List<BoundaryBox> bbs,
int width, int height, double[] hMin, ImageProcessor origImg){
ImageProcessor tempMask = new ByteProcessor(width, height);
for(int i = 0; i < maximList.size(); i++){
BoundaryBox bb = bbs.get(i);
BoundaryBox boundBox ... | 5 |
@Override
public boolean onMouseDown(int mX, int mY, int button) {
if(mX > x && mX < x + width && mY > y && mY < y + height) {
//GameActor toBuy = Application.get().getLogic().getActor(Application.get().getLogic().createActor("assets/data/actors/cannon.xml"));
//Application.get().get... | 4 |
public static void main(String args[]){
int i=0;
int j=0;
addset.add(firstset[0]);
for(i =0 ;i< firstset.length;i++){
for(j=0;j<secondset.length;j++){
if (firstset[i] == secondset[j]){
subsset[i] = 0;
}
if(!addset.contains(secondset[j])){
addset.add(secondset[j]);
}
if(!add... | 7 |
private boolean isObstructed() {
IntPoint[] blocks = fallingPiece.getBlocks();
for(int i = 0; i < 4; i++) {
IntPoint p = blocks[i];
if(!p.inBounds(length, width, height))
return false;
if(cubes[p.getX()][p.getY()][p.getZ()] != Piece.NOTHING) {
return false;
}
}
return true;
} | 3 |
@Override
public void deleteUser(Integer id) {
User user = userDao.findById(id);
if(user==null)
return;
userDao.delete(user);
} | 1 |
public void run(){
requestFocus();
long lastTime = System.nanoTime();
long timer = System.currentTimeMillis();
final double ns = 1000000000.0 / 60.0;
double delta = 0;
int frames = 0;
int updates = 0;
while(running){
long now = System.nanoTime();
delta += (now - lastTime) / ns;
lastTime = now;
... | 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.