text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void drawPoint(Graphics2D g2, Pair pr, int id) {
/*if (p.owner==-1) {
g2.setPaint(Color.BLACK);
}
else {
g2.setPaint(Color.WHITE);
}*/
if (id == 0)
g2.setPaint(Color.WHITE);
else if (id == 1)
... | 4 |
public void saveState(int difficulty, int time, int hints,
boolean[][] editableArray) throws IOException {
File save = new File("save.txt");
save.createNewFile();
FileWriter writer = new FileWriter(save);
Integer timeInteger = (Integer)time;
writer.write(timeInteger.toString());
writer.write("\n");
Int... | 5 |
public void clickEvent(double mouseX, double mouseY){
double x1 = this.getX1();
double x2 = this.getX2();
double y1 = this.getY1();
double y2 = this.getY2();
if(x1 <= mouseX && x2 >= mouseX && y1 <= mouseY && y2 >= mouseY)
{
double relMouseX = mouseX - x1;
//System.out.println("X: " + ... | 5 |
public void render(final Graphics g, final int x, final int y) {
if (!solid || c == '9')
return;
if (img != null) {
g.drawImage(img, x, y);
} else {
if (Game.getInstance().getCurrentLevel().getLevelType() == Level.LEVEL_MID)
g.drawImage(ImageLoader.tile_glass_black, x, y);
else
g.g().fillRect... | 4 |
@Override//toString method that prints the whole array
public String toString ()
{
String message = "";
for (int index = 0; index < data.length; index++){
message = message + data[index] + " ";
}
return message;
} | 1 |
private static void lineBorderLimitedMean (int radius, float[] cache, float[] pixels, int writeFrom, int writeTo,
int pixel0, int pointInc) {
double sum = 0;
int length = cache.length;
int sumFrom = (writeFrom-radius>0) ? writeFrom-radius : 0;
int sumTo = (writeFrom+radius<le... | 6 |
public String getCurrentDirec() {
int val = droid.getCurDirec();
String retString = "";
switch (val) {
case 0:
retString = "North";
break;
case 1:
retString = "East";
break;
case 2:
... | 4 |
public Color elementAt(Coords coords) {
Integer col = coords.getCol();
Integer row = Math.abs(coords.getRow());
if (col < 0 || row > 4 || row + col > 8) {
return Color.INVALID;
}
Ball ball = new Ball(Color.WHITE, coords);
if (this.balls.contains(ball)) {
return Colo... | 5 |
public String getStatusDesc() {
if (status.equals("1")) {
return "Em Andamento";
} else if (status.equals("2")) {
return "Aguardando Retorno";
} else if (status.equals("3")) {
return "Finalizada";
} else if (status.equals("4")) {
return "Ca... | 4 |
private void putChecker(int player, int column) {
if ((column < -1) || (column > NUM_POINTS)) {
System.err.println("Error, out of range.");
} else {
int p_type = pType(player);
if (column==-1 || column==NUM_POINTS) {
in_home[player]++;
} el... | 6 |
void extendLeft( FragList prev, String mergedCell, short base )
{
// find the next space in the merged cell
String token = getToPrevBreakPoint( mergedCell );
if ( !doubledUp(token,mergedCell,prev) && token.length() > 0
&& fragments.size()>0 )
{
Atom first = t... | 8 |
public void showHelp(CommandSender sender) {
returnMessage(sender, "&f----- &6MCNSA Ranks Help &f-----");
for(String command: plugin.commands.keySet()) {
boolean hasPermission = true;
if(sender instanceof Player) {
hasPermission = plugin.hasPermission((Player)sender, plugin.commands.get(command).requiredP... | 3 |
protected void doEditing() {} | 0 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 7 |
public synchronized void unRegisterConnection(Socket socket) {
openConnections.remove(socket);
} | 0 |
public static void placeBeeper(int x, int y)
{
if (WorldBackend.getCurrent() == null) {
Display.openDefaultWorld();
}
if (isDead())
return;
WorldBackend.getCurrent().putBeepers(x, y, 1);
WorldPanel.getCurrent().repaint();
} | 2 |
private static String getStateString(MinimizeTreeNode node) {
State[] states = (State[]) node.getUserObject();
int[] ids = new int[states.length];
for (int i = 0; i < ids.length; i++)
ids[i] = states[i].getID();
Arrays.sort(ids);
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < ids.length; i... | 3 |
public void reSync()
{
reSynced = false;
//track the number of time this function is called, even if a resync is not
//successful - this will track the number of sync errors
reSyncCount++;
try{
while (byteIn.available() > 0) {
byteIn.read(inBuffer, 0, 1);
if (inBuf... | 3 |
public int predict(_Doc doc) {
_SparseFeature[] fv = doc.getSparse();
double maxScore = Utils.dotProduct(m_pWeight, fv, 0);
if (m_classNo==2) {
return maxScore>0?1:0;
} else {//we will have k classes for multi-class classification
double score;
int pred = 0;
for(int i = 1; i < m_classNo; i++) {... | 4 |
public HashSet<Tile> getTileRadius(Tile center, int radius)
{
HashSet<Tile> innerTiles = new HashSet<Tile>(); //"Visited" tiles in range.
HashSet<Tile> outerTiles = new HashSet<Tile>(); //"Found" tiles on the edge of our current range.
outerTiles.add(center);
while (radius > 0) {
HashSet<Tile> newOuterTile... | 5 |
@Override
public void restore() throws PersistenceException
{
isRestoring=true;
if(myobj instanceof Intermud)
{
try
{
final CMFile F=new CMFile("resources/ppeer."+myID,null);
if(!F.exists())
return;
final ObjectInputStream in=new ObjectInputStream(new ByteArrayInputStream(F.raw()));
... | 8 |
private Image drawCell(int index)
{
IMazeStructure mazeStructure = DataModel.getInstance().getMazeStructure();
BufferedImage result = new BufferedImage(CELL_WIDTH,
CELL_HEIGHT,
BufferedImage.TYPE_INT_A... | 4 |
public static void mapinit() throws SlickException{
if(mapControl==0)
land = new Image("resources/images/ToxicWasteland.png");
if(mapControl==1)
land = new Image("resources/images/paradise.png");
if(mapControl==2)
land = new Image("resources/images/LavaPit.png");
if(mapControl==3)
land = new Image("resour... | 5 |
public static void main(String[] args) throws IOException {
System.out.println("The Processing server handles source connection on port 7007 and sink connections on port 7008");
//source socket
final ServerSocket source_Socket = new ServerSocket(7007);
//sink socket
final ServerS... | 4 |
@Override
public void selectAll() {
TreeRow[] oldSelection = mSelectedRows.toArray(new TreeRow[mSelectedRows.size()]);
boolean added = false;
mAnchorRow = null;
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (mAnchorRow == null) {
mAnchorRow = row;
}
if (mSelectedRows.... | 4 |
void hookCustomListener (final String eventName) {
if (eventName == "ExtendedModifyListener") {
styledText.addExtendedModifyListener (new ExtendedModifyListener() {
public void modifyText(ExtendedModifyEvent event) {
log (eventName, event);
}
});
}
if (eventName == "BidiSegmentListener") {
s... | 8 |
void showstudent() {
try {
expr = xpath.compile("//student/@regno");
result = expr.evaluate(doc, XPathConstants.NODESET);
nodes = (NodeList) result;
String tr;
boolean fr=false;
for(int i=0;i<nodes.getLength();i++) {
tr=nodes.item(i).getNod... | 7 |
private void fireMouseEvent(MouseEvent e) {
TextMouseEvent textMouseEvent = null;
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TextMouseListener.class) {
if (textMouseEvent == null)
... | 6 |
@Override
public void run() {
try {
try {
output = new ObjectOutputStream(connection.getSocket().getOutputStream());
} catch (IOException ioe) {
connection.sendMessage(new SocketDiscon... | 8 |
private void idCmbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idCmbxActionPerformed
String id = "";
if (idCmbx.getSelectedItem() != null && idCmbx.getSelectedIndex() != 0) {
id = idCmbx.getSelectedItem().toString();
try {
Student student = ... | 5 |
public void unlock(){
if (isDoor[0]){
rooms[currentY - 1][currentX].unlock();
isLocked[0] = false;
}
if (isDoor[1]){
rooms[currentY][currentX + 1].unlock();
isLocked[1] = false;
}
if (isDoor[2]){
rooms[currentY + 1][currentX].unlock();
isLocked[2] = false;
}
if (isDoor[3]){
rooms[curr... | 4 |
public void moveMonster(){
//xPos,yPos is the position the monster is going to move to
int gridWidth, gridHeight, xPos, yPos;
int[] direction = new int[2];
Monster mon[][] = logicHandler.getMonsters();
gridHeight = canvas.getGridHeight();
gridWidth = canvas.getGridWidth();
/* loops through all the monste... | 9 |
@Override
public ArrayList<String> getQuestAnswer() {
// TODO Auto-generated method stub
return answerList;
} | 0 |
@Override
public void update() {
if (delay > 0) delay--;
if (play.isPressedLeft() && delay == 0) {
delay = 20;
load();
}
if (about.isPressedLeft() && delay == 0) {
delay = 20;
screen.setMenu(screen.getAboutMenu());
}
if (custom.isPressedLeft() && delay == 0) {
delay = 20;
screen.setMenu((... | 8 |
public List findBySampleOutput(Object sampleOutput) {
return findByProperty(SAMPLE_OUTPUT, sampleOutput);
} | 0 |
public void collision(PhysicsCollisionEvent event) {
if (event != null) {
Spatial a = event.getNodeA();
Spatial b = event.getNodeB();
if (b != null && a != null) {
final String nameA = a.getName();
final String nameB = b.getName();
... | 6 |
@Override
public void detach(Observer observer) {
observerVector.remove(observer);
} | 0 |
private void processReplicaDelivery(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] data = (Object[]) ev.get_data();
if (data == null) {
return;
}
String filename = (String) data[0]; // get file name
Integer rcID = (Integer) ... | 3 |
public void multiply(Polynomials p){
Polynomials p1 = new Polynomials("");
Polynomials p2 = new Polynomials("");
ListIterator lIt1 = polynomial.listIterator();
if(lIt1.hasNext()){
Term t1 = new Term((Term)lIt1.next());
ListIterator lIt2 = p.polynomial.listIterator... | 4 |
protected void decode(final byte[] data,
final int offset,
final int len)
throws StreamCorruptedException
{
int i;
short val;
int outputSize = 0;
/* read packet bytes into bitstream */
bits.read_from(data, offset, len);
for (int frame=0; fram... | 7 |
public void InputAll(float delta)
{
Input(delta);
for(GameObject child : m_children)
child.InputAll(delta);
} | 1 |
private void jPasswordFieldMdpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordFieldMdpActionPerformed
//Récupération de la méthode contrôleur 'valider'
this.ctrl.valider();
}//GEN-LAST:event_jPasswordFieldMdpActionPerformed | 0 |
public void timeoutTimer(SpotTimer timeout) throws IOException
{
//switch states
switch(this.currentState.getIdName())
{
case READY_ST_NUM://ready status
break;
case WAIT_ST_NUM://wait response
//control to be sure that the PID of the Timer is the ID of the FSM
if(timeout.getPID().compareTo(th... | 7 |
public void render(GameContainer gc, Graphics g) throws SlickException {
if(frame == Frames.MAIN){
mainRender(gc, g);
}
if(frame == Frames.NEWGAME){
newGameRender(gc, g);
}
if(frame == Frames.CREDITS){
creditsRender(gc, g);
}
if(frame == Frames.OPTIONS){
optionsRender(gc, g);
}
if(frame ... | 5 |
@Override
public void Play(PlayerResponse response) {
// Send trump to players
Map<Position,Integer> playersMeldServer = getPlayersMeld(Position.South);
mP.setTeam1Score(playersMeldServer.get(Position.North) + playersMeldServer.get(Position.South));
mP.setTeam2Score(playersMeldServer.get(Position.East) + playe... | 3 |
@Override
public AbilityMapper.AbilityMapping modifyAllQualifyEntry(MOB mob, String eachOrAll, Ability me, int showFlag) throws IOException
{
if((showFlag == -1) && (CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0))
showFlag=-999;
final Map<String,Map<String,AbilityMapper.AbilityMapping>> map=CMLib.ableMapper().ge... | 7 |
public String toStringWithoutSupport() {
String itemSetContents = "";
int num = this.itemSet.size();
for (int i = 0; i < this.itemSet.size(); i++) {
itemSetContents = itemSetContents + this.itemSet.get(i).toString();
if (i < num - 1) {
itemSetContents = itemSetContents + " AND ";
}
}
return itemS... | 2 |
public static void main(String[] args)
{
int average = 0;
average = average + 2;
for (int i=12; i>1; i--)
{
if (i%2 == 0)
{
System.out.println(average);
average = (average + i);
}
}
System.out.println(average);
System.out.println(average);
average=average*10+1;
int inv... | 3 |
public TrapTransitionTool(AutomatonPane view, AutomatonDrawer drawer,
AddTrapStateController controller) {
super(view, drawer);
myController = controller;
} | 0 |
private void initListeners(){
/*
* Just moves towards next step of question modification
*/
btnNextPart.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
cardsQPanel.show(pnlQuestionEdit, STEP_2);
}
});
btnNewQBack.addActionListener(new ... | 7 |
private void createBrickImages(int size)
{
Graphics g;
try
{
standardBricks[0] = ImageIO.read(new File("src" + separator + "images" + separator + "brick1.jpg"));
}
catch (IOException e)
{
e.printStackTrace();
System.... | 8 |
@Override
public void run() {
try (ServerSocket server = new ServerSocket(6666);) {
while (true) {
try {
Socket socket = server.accept();
OutgoingThread outThread = new OutgoingThread(socket.getOutputStream());
new Thread(outThread).start();
new Thread(new IncomingThread(socket.getInputStr... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nCase = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
size = Integer.parseInt(line.trim())... | 6 |
public void initialize() throws SlickException {
arrow = new Image("res/arrow.png");
for(int i = 1; i < 10; i++) {
{
rogueMoveImages[i-1] = new Image("res/roguewalkframe" + i + ".png");
rogueMoveImages[i-1] = rogueMoveImages[i-1].getScaledCopy((float) .5);
rogueMoveImagesFlipped[i-1] = rogueMoveI... | 9 |
public void setValue(int x, int y, int z, int value)
{
if (x >= getWidth() || y >= getHeight() || z >= getDepth() || x < 0 || y < 0 || z < 0)
{
return;
}
rawData[x][y][z] = value;
/*
Stack<Integer> stack = rawData[x][y][z];
if (stack.peek() != -3 || value == -4)
stack.push(value);*/
} | 6 |
public ServerSocket getSocketListen() {
return socketListen;
} | 0 |
public void lastUpdateDetail() {
loggerMainClass.entry();
long BLANK_LINES = DetailObject.getTOTAL_BLANK_LINES();
long CODE_LINES = DetailObject.getTOTAL_LINES_OF_CODE();
long COMMENT_LINES = DetailObject.getTOTAL_COMMENT_LINES();
long NUMBER_OF_FILES = DetailObject.getTOTAL_NUMBER_OF_FILES();
long TOTAL_LI... | 1 |
@EventHandler(priority=EventPriority.NORMAL)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
String[] split = event.getMessage().split("\\s+");
String command = split[0].substring(1);
if ((command.equalsIgnoreCase("kill"))) {
event.getPlayer().sendMessage("Unknown command. Type ... | 2 |
private void refreshForms() {
String name = settings.getProperty("name");
String port = settings.getProperty("port");
Boolean minimizeToTray = Boolean.parseBoolean(settings.getProperty("minimizeToTray"));
String language = settings.getProperty("language");
System.out.println("language: " + language);
lan... | 0 |
@Override
public void windowDeactivated(WindowEvent arg0)
{
} | 0 |
public void run(ImageProcessor ip) {
int w = ip.getWidth();
int h = ip.getHeight();
for (int x = 1; x < w - 2; x++) {
for (int y = 1; y < h - 2; y++) {
int[] rgb = new int[3];
ip.getPixel(x, y, rgb);
if (rgb[0] < threshold && rgb[1] < threshold && rgb[2] < threshold) {
ip.set(x, y, Color.BLA... | 5 |
public void save()
{
try
{
if (file.getParentFile() != null)
{
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile())
{
return;
}
if (file.canWrite())
... | 6 |
public static Balance create(){
if(balanceClass == null)
balanceClass = new Balance();
return balanceClass;
} | 1 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... | 6 |
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String uri = getURI(request);
request.setCharacterEncoding("UTF-8");
// Room 관련
if ("/comm/getAllRooms".equals(uri)) {
getAllRooms(request, respons... | 8 |
private static void findCardIntersections() {
for (Pair p1 : values) {
Card[] c1 = p1.cards;
int i1 = p1.ordinal;
for (Card c2 : Card.values()) {
int i2 = c2.ordinal;
intersectsCard[i1][i2] = false;
if(c1[0] == c2) intersectsCard[i1][i2] = true;
if(c1[1] == c2) intersectsCard[i1][i2] = true;
... | 4 |
private void checkGuess() {
//Runs through the turnRecord array and checks to see if each one
//has compatibility with the last guess.
//Returns true if each one does and false if there is a conflict.
goodRecords = 0;
i = 0;
whileloop:
while(true) {
if (turnRecord[i].hasInput()==false) {
if (fi... | 6 |
public static void deikstr_sort(Comparable[] a, int lo, int hi) {
if (hi <= lo) return;
int lt = lo, gt = hi;
Comparable v = a[lo];
int i = lo;
while (i <= gt) {
int cmp = a[i].compareTo(v);
if (cmp < 0) {
exch(a, lt++, i++);
... | 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 void setRate(int rate) {
this.rate = rate;
} | 0 |
@Override
public void Input(float delta)
{
Vector2f centerPosition = new Vector2f(Window.GetWidth()/2, Window.GetHeight()/2);
if(Input.GetKey(m_unlockMouseKey))
{
Input.SetCursor(true);
m_mouseLocked = false;
}
if(Input.GetMouseDown(0))
{
Input.SetMousePosition(centerPosition);
Input.SetCurso... | 7 |
public GuessingScreen(final CLayout layout, final JPanel panelContainer) {
addMouseListener(this);
this.setLayout(null);
this.layout = layout;
this.cl = layout.cl;
this.panelContainer = panelContainer;
// Path to the background image
background = Toolkit.getDefau... | 2 |
public Boolean isOnceJob() {
if(daily || weekly || monthly || atStart) {
return false;
} else {
return true;
}
} | 4 |
public void removeVersion( int version )
{
Node n = start;
while ( n != end )
{
Arc a = n.pickOutgoingArc( version );
// get next n before a.to becomes null
n = a.to;
if ( a.versions.cardinality()==1 )
{
a.from.removeOutgoing( a );
a.to.removeIncoming( a );
// is it a child arc?
... | 4 |
public Hash[] readHash(long hash) throws IOException {
processQueue();
Hash RAMHash = RAMMap.get(hash);
if (RAMHash != null) {
Hash[] single = new Hash[1];
single[0] = RAMHash;
return single;
}
int fileId = FAT.get(hash);
if (fileId == -1) {
return null;
}
fileSync.lock();
try {
File f ... | 9 |
@Override
public void startGame(String playername, Strategy strategy, int startinground) {
try {
if (inGame) {
playermanager.sendErrorPacket(playername, "Game already running!", ErrorReason.NOT_ENOUGH_PLAYERS);
LOG.warn(String.format("%s tried to start an already ... | 4 |
public int getId() {
return this.id;
} | 0 |
public final void hideLayer(GameLayer layer) {
if (!gameLayers.containsValue(layer)) {
logger.error(new NullPointerException(),
"Tried to hide a game layer that isn't registered to the GameScreen :: ", this);
} else {
layer.hide();
}
} | 1 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nCase = 1;
while ((line = in.readLine()) != null) {
String first = line;
String second = in.readLine();
... | 6 |
private void updateBN(Matrice iDansB)
{
int colB = 0;
int colN = 0;
boolean estDansB = false;
for(int j = 0; j<iDansB.getNbLines(); j++)
{
copyColumn((int)iDansB.getValueAt(j, 0), colB, this.Abarre, this.B);
colB++;
}
... | 5 |
@Override
public List<IApplicationPortForwarding> startPortForwarding()
throws OpenShiftSSHOperationException {
if (!hasSSHSession()) {
throw new OpenShiftSSHOperationException(
"SSH session for application \"{0}\" is closed or null. Cannot start port forwarding",
getName());
}
for (IApplicationP... | 4 |
@Override
public void handleStateChangeNotification(StateChangeNotification scn) {
System.out.println(scn.getType());
if (scn.getType() == StateChangeNotification.Type.BEFORE_START) {
stage.hide();
}
} | 1 |
@Override
public void run() {
TableManager tableManager = new TableManager("tables.dat");
TableBoundary tableBoundary = new TableBoundary(tableManager);
StaffManager staffManager = new StaffManager("staffs.dat");
StaffBoundary staffBoundary = new StaffBoundary(staffManager);
MenuManager menuManager = new ... | 9 |
public void message(String msg, LoggingLevel severity) {
if ((severity.getCode() & logMask) != 0) { //True only if all logMask bits are set in severity
writeMessage(msg);
}
if (next != null) {
next.message(msg, severity);
}
} | 2 |
public void testBinaryCycAccess9() {
System.out.println("\n**** testBinaryCycAccess 9 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CO... | 4 |
public String getCountry() {
return Address.getCountry();
} | 0 |
private static void solve(int[] moves, int k) {
if (k==9) {
if (isTwelve(clocks)) {
int val = 0;
for (int i=0; i<9; i++)
val += moves[i];
if (bestMovesVal == 0 || val < bestMovesVal) {
bestMovesVal = val;
for (int i=0; i<9; i++)
bestMoves[i] = moves[i];
}
}
return;
}
... | 9 |
public Entity init(){
setVelocity(new Vector2f(-0.6f,0f));
try {
AddComponent( new ImageRenderComponent("BoardRender", new Image("assets/board.png")) );
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... | 2 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} | 0 |
public void layoutContainer(Container target) {
//Let's make a local copy of components to avoid concurrent modification
//which could happen if someone adds something to the layout outside
//of the EDT. This is faster than do any synchronization or brute force
//exception catching
... | 9 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof College)) {
return false;
}
College other = (College) object;
if ((this.id == null && other.id != null) || (thi... | 5 |
private void searchAndReplaceFor(File directory)
{
File[] directories = directory.listFiles(dirFilter);
for (int i = 0; i < directories.length; i++)
{
searchAndReplaceFor(directories[i]);
}
File[] files = directory.listFiles(fileFilter);
System.out.println("*");
System.out.println("* MODIFYING FILES... | 5 |
public void saveToDB() {
if (!changed) {
return;
}
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE storages SET slots = ?, meso = ? WHERE storageid = ?");
ps.setInt(1, slots);
ps.setInt(2, meso);
ps.setInt(3, id);
ps.e... | 5 |
@Override
public TwoPhaseIterator twoPhaseIterator() {
final float matchCost = matchCost(reqApproximation, reqTwoPhaseIterator, exclApproximation, exclTwoPhaseIterator);
if (reqTwoPhaseIterator == null
|| (exclTwoPhaseIterator != null && reqTwoPhaseIterator.matchCost() <= exclTwoPhaseIterator.matchCo... | 9 |
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object o) {
if (!(o instanceof Tree)) {
return false;
}
if (o == this) {
return true;
}
Tree<T> tr = (Tree<T>) o;
if (size() != tr.size()) {
return false;
}
Iterator<Node<T>> it1 = iterator();
Iterator<Node<T>> it2 = tr.iterator... | 5 |
public Vec3D track(float s, float v) {
// s = sight, v = view/2
Vec3D vec = new Vec3D();
float count = 0.0f;
neighbours = p5.manager.pheroKDTree.getNearestNeighbors(this, 150, true);
if (neighbours != null) {
for (int i = 0; i < neighbours.length; i++) {
Phero cur = (Phero) neighbours[i].point(... | 6 |
public void initialize() throws SyslogRuntimeException {
super.initialize();
final SSLTCPNetSyslogConfigIF sslTcpNetSyslogConfig = (SSLTCPNetSyslogConfigIF) this.tcpNetSyslogConfig;
final String keyStore = sslTcpNetSyslogConfig.getKeyStore();
if (keyStore != null && !"".equals(keyStore.trim())) {
Syste... | 8 |
public ResultSet getList(String whereString){
StringBuffer sql=new StringBuffer("");
sql.append("SELECT AnswerID,QuestionID,AnswerContentText");
sql.append(" FROM `FIBAnswer`");
if (whereString.trim()!="") {
sql.append(" where "+whereString);
}
SQLHel... | 1 |
private String getBooleanValue(final Field field, final Object object) {
String resValue = null;
Object value = getRawValue(field, object);
if (value != null && value instanceof Boolean) {
resValue = ((Boolean) value).booleanValue() ? "1" : "0";
}
return resValue;
} | 3 |
private String appendNumberOfComponents() {
int i = 0;
StringBuilder field = new StringBuilder();
for (Integer key : cardInFieldGame.keySet()) {
if (!listeofcontains.contains(key)) {
int fehlt = LEGHTFORSTRING - 1;
int me = fehlt / 2;
fehlt = fehlt - me;
field.append("|");
for (int loop = 0... | 5 |
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.