text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Sun(){
setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
setColor(ColorRGBA.White.set(1.6f, 1.6f, 1f, 0f));
this.setName("Sun");
} | 0 |
public void stop() {
for (Player p : players) {
if (p != null) {
p.disconnect();
}
}
if (discoveryThread.isAlive()) {
discovery.close();
}
if (server != null && !server.isClosed()) {
try {
server.close();
} catch (IOException e) {
}
}
} | 6 |
private SocketFace getSocket(byte[] data, int off, int len)
throws SocketException
{
if (mSocket != null) {
return mSocket;
}
if (mClosed) {
throw new SocketException("Socket is closed");
}
long timeout = mTimeout;
long start;
... | 9 |
public void verify() throws VerifyException {
try {
doVerify();
} catch (VerifyException ex) {
for (Iterator i = bi.getInstructions().iterator(); i.hasNext();) {
Instruction instr = (Instruction) i.next();
VerifyInfo info = (VerifyInfo) instr.getTmpInfo();
if (info != null)
GlobalOptions.err.... | 3 |
public void updateControls()
{
if(pModel.getProperty(PRP_MODE).equals(CMD_PLAYBACK_MODE))
{
massInput.setEnabled(false);
radiusInput.setEnabled(false);
xCord.setEnabled(false);
yCord.setEnabled(false);
vx.setEnabled(false);
vy.... | 3 |
public static HTTPRequest mergeRoomFields(final HTTPRequest httpReq, Pair<String,String> setPairs[], Room R)
{
final Hashtable<String,String> mergeParams=new XHashtable<String,String>(httpReq.getUrlParametersCopy());
final HTTPRequest mergeReq=new HTTPRequest()
{
public final Hashtable<String,String> params=m... | 9 |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
int quantity = 1;
Player target;
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "/spawnhead [username] <quantity> <player>");
return true;
}
if (!args[... | 9 |
public void close() throws IOException {
if (!this.stack.empty()) {
throw new InvalidObjectException("Tags are not all closed. " +
"Possibly, " + this.stack.pop() + " is unclosed. ");
}
if (thisIsWriterOwner)
{
this.writer.flush();
... | 2 |
@Override
public void setAccounting(Accounting accounting) {
accounts=accounting==null?null:accounting.getAccounts();
accountTypes=accounting==null?null:accounting.getAccountTypes();
projects=accounting==null?null:accounting.getProjects();
} | 3 |
public StartRenderer()
{
try
{
Start3 = ImageIO.read(new File(Main.loc + "/Textures/Game.png"));
}
catch (Exception e1)
{
JOptionPane.showMessageDialog(null, new File(Main.loc + "Textures/Game.png").getAbsolutePath(), "UNABLE TO LOAD IMAGES",JOptionPane.ERROR_MESSAGE);
}
} | 1 |
private ArrayList<Sentence> caseOne(String endGoto,int startIndex,HashMap<String,String> cases){
ArrayList<Sentence> ls = new ArrayList<Sentence>();
for (int i = startIndex; i < this.senList.size();) {
Sentence s = this.senList.get(i);
//if (s.getName().equals("goto") || s.getName().equals("switch_goto")) ... | 9 |
private BoundingBox calculateBoundingBox(Cluster center, Direction direction) {
if (Direction.CENTER == direction) {
return center.getBoundingBox();
}
BoundingBox oldBoundingBox = center.getBoundingBox();
double oldWidth = oldBoundingBox.getWidth();
double oldHeight = oldBoundingBox.getHeight();
GeoPo... | 6 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Vertex))
return false;
Vertex other = (Vertex) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
r... | 6 |
private GameState gunnerDay(GameState state, Card card, boolean output)
{
Color faction = card.getFaction();
String log = "";
//First, we pay the gunner
log = log + Faction.getPirateName(faction) + " paid ";
int payment = 0;
if(state.getPlayer(faction).getGold() > 3)
{
payment = 3;
}
... | 6 |
@Test
public void test() {
Question1 it = new Question1();
for (int b = 0; b < 10; b++) {
Question1NumGenerator g = new Question1NumGenerator(1, b);
for (int i = 1; i < 10000; i++) {
int aa = g.next();
int bb = it.largestLable(i, b);
... | 2 |
public Card(String cardRank, String cardSuit, int cardPointValue) {
rank = cardRank;
suit = cardSuit;
pointValue = cardPointValue;
} | 0 |
private int addNeighbours(Point target, List<Point> list){
int count = 0;
if (target.y - 2 >= 0) if (this.maze[target.x][target.y - 2] == true) {list.add(new Point(target.x, target.y - 1));count++;}
if (target.y + 2 <= this.length - 2) if (this.maze[target.x][target.y + 2] == ... | 8 |
public LogisticClassifier() {
// option value for gradient descent
gd_iteration = 20;
if (CommandLineUtilities.hasArg("gd_iterations"))
gd_iteration = CommandLineUtilities.getOptionValueAsInt("gd_iterations");
gd_eta = .01;
if (CommandLineUtilities.hasArg("gd_eta"))
gd_eta = CommandLineUtilities.g... | 3 |
public List<Effect> getEffectsOnPosition(Position position) {
if (!validPosition(position))
throw new IllegalArgumentException("The given position isn't valid!");
List<Effect> posElements = new ArrayList<Effect>();
for (Effect effect : effects) {
if (effect.getPosition().equals(position))
posElement... | 3 |
public static MobilityEnumeration fromValue(String v) {
for (MobilityEnumeration c: MobilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
@Test
public void popsByHeapRules()
{
for (int i = 1; i < 16; i++)
heap.insert(i);
heap.pop();
int[] ar = new int[heap.size()];
for (int i = 0; i < heap.size(); i++)
ar[i] = i + 1;
ar[0] = 2;
ar[1] = 4;
ar[3] = 8;
ar[7] = 15... | 4 |
public Boolean isStaff( Player p )
{
if ( isAdmin( p ) || p.hasPermission( "iNations.staff" ) )
return true;
return false;
} | 2 |
public int lengthOfLastWord(String s) {
int i =0;
if(s==null || s.length() == 0)
return 0;
while(s.charAt(s.length()-1) == ' '){
if(s.length()-1 <= 0)
break;
s = s.substring(0, s.length()-1);
}
while(i<s.length()){
i... | 6 |
public String[] compileAssembler(String text) {
opcodeTable.clear();
addOpcode();
String[] lines = text.split("\\r?\\n");
String[] maschin = new String[lines.length];
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
String[] args = line.split(" ");
if (args.length == 0) continue;
i... | 8 |
public static void loadModelTowers(){
File file = new File("resources/saves/towersSave.txt");
GameData.modelTowers = new ArrayList<Tower>();
try{
Scanner loadScanner = new Scanner(file);
while(loadScanner.hasNext() && GameData.modelTowers.size() < 7){
Tower tower = new Tower();
String barrel... | 9 |
public void push(QWidget widget)
{
if (layout.currentWidget() == null || layout.currentWidget().getClass() != widget.getClass()) {
layout.addWidget(widget);
layout.setCurrentIndex(layout.count()-1);
}
} | 2 |
public void onBlockRemoval(World var1, int var2, int var3, int var4) {
byte var5 = 2;
for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) {
for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) {
for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) {
var1.not... | 3 |
public void setGravity(boolean gravity) {
GRAVITY = gravity;
if(gravity) {
if(gravityThread == null) {
Runnable gravityJob = new GravityJob(this);
gravityThread = new Thread(gravityJob);
gravityThread.start();
}
} else {
gravityThread = null;
}
} | 2 |
public void act()
{
if(isAtEdge() && checkLoadingState()){
//MiniGame2 w = (MiniGame2) getWorld();
//w.removeFromList(index);
getWorld().removeObject(this);
return;
}
if(atTruckStop())
{
return;
}
... | 6 |
Arc[] split( int offset ) throws MVDException
{
Arc[] arcs=null;
// handle simple cases first
if ( offset == 0 || offset == dataLen())
{
arcs = new Arc[1];
arcs[0] = this;
}
else if ( parent == null )
{
if ( children == null )
arcs = splitDataArc( offset );
else
arcs = splitParent( of... | 4 |
public void clickUpdate(Point p) { //bit messy but C'est la vie.
if (p.y >= (pickY-20) && p.y <= (pickY+20) ) { //kinda near the axis?
if (Math.abs(pick1 - p.x) < Math.abs(pick2 - p.x)) { //move picker 1, it's closer
if (21 > p.x) {
pick1 = 21;
}
else if ((20+256) < p.x) {
pick1 = (20+256);
... | 9 |
private ArrayList<MapTile> CalculateTowerRange(int x, int y, int radius) {
ArrayList<MapTile> area = new ArrayList<>();
Comparator<MapTile> compareDistance = new TileRangeComparator(x + 0.5, y + 0.5);
for (int i = Math.max(x - radius, 0); i < Math.min(x + radius + 2, map.getPixels().length); i++... | 4 |
public String getDirectionTowards(Location otherLoc) {
int xDist = x - otherLoc.getX();
int yDist = y - otherLoc.getY();
if(xDist > 0) {
if(yDist > 0) {
return SOUTH + WEST;
} else if(yDist < 0) {
return NORTH + WEST;
} else {
return WEST;
}
} else if(xDist < 0) {
if(yDist > 0) {
... | 9 |
public Map<String, Double> splitWord(String line) throws IOException{
Map<String, Double> fileMap = new HashMap<String, Double>();
Analyzer analyzer = new IKAnalyzer(true);
StringReader reader = new StringReader(line);
TokenStream ts = analyzer.tokenStream("", reader);
CharTermAttribute term = ts.getAttribute... | 2 |
public static Tile GRASS() {
if (random.nextInt(100) == 0) {
return GRASS_FLOWER;
} else if (random.nextInt(100) == 0) {
return GRASS_POPPY;
} else if (random.nextInt(6) == 0) {
return GRASS2;
} else if (random.nextInt(6) == 0) {
return GRASS3;
} else if (random.nextInt(6) == 0) {
return GRASS... | 6 |
public void simpleCornerElimination() {
int size = _smooth_path.size();
Path new_path = new Path();
new_path.add(_smooth_path.start());
for (int i = 1; i < size - 1; i++) {
Point p1 = _smooth_path.get(i - 1);
Point p2 = _smooth_path.get(i + 1);
//System.out.println("DIST from " + p1 + " to " + p2 + " =... | 2 |
public static void Abstractor(){
while(myList.size() > 37){
double minSigValue = Double.MAX_VALUE;
PointStorage minSigPoint = null;
int index;
ListIterator iterator = myList.listIterator();
// Saves the points of the ... | 7 |
final int[][] getTriangleGroups() {
anInt1854++;
int[] groupCount = new int[256];
int maximumGroup = 0;
for (int triangle = 0; ((Model) this).polygons.length > triangle; triangle++) {
int group = (((ModelPolygon) ((Model) this).polygons[triangle]).tGroup);
if (group >= 0) {
groupCount[group]++;
if (ma... | 6 |
@Override
public int hashCode() {
int tId;
if (userId == 0) {
tId = 33;
}
else {
tId = userId;
}
int tFirst;
if (firstName == null) {
tFirst = 41;
}
else {
tFirst = firstName.length();
... | 5 |
protected void addCommandJournalsVar(final HTTPRequest httpReq, final String index, final StringBuilder str)
{
final String name=httpReq.getUrlParameter("COMMANDJOURNAL_"+index+"_NAME");
final String mask=httpReq.getUrlParameter("COMMANDJOURNAL_"+index+"_MASK");
if((name!=null)&&(name.trim().length()>0)
&&(!na... | 8 |
public XMLOrderImporter(File XMLFile){
MesController myController = new MesController();
ProductDAO proDAO = new ProductDAO();
OrderDAO ordDAO = new OrderDAO();
Order myOrder = new Order();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = null;
try {
... | 6 |
public void preInit(FMLPreInitializationEvent event)
{
} | 0 |
@Override
public void hoistDepthChanged(OutlinerDocumentEvent e) {
if (e.getOutlinerDocument() == Outliner.documents.getMostRecentDocumentTouched()) {
calculateEnabledState(e.getOutlinerDocument());
}
} | 1 |
public boolean isVariableLocked(int index) {
for (Transaction t: locks.keySet()) {
ArrayList<Lock> lockListT = locks.get(t);
for (Lock lock: lockListT) {
if(lock.getIndex()==index) {
return true;
}
}
}
return false;
} | 3 |
public void keepItem3() {
for(int i = 0; i < playerItems.length; i++) {
int highest = 0;
int value = (int)Math.floor(GetItemShopValue(playerItems[i]-1, 0, i));
if(value > highest && playerItems[i]-1 != keepItem && playerItems[i]-1 != keepItem2 && playerItems[i]-1 != -1) {
highest = value;
keepItem3 =... | 5 |
public static void runMainMenu() {
// Track the menu start time so that buttons aren't clicked accidentally
menuStartTime = Sys.getTime();
try {
// While the program isn't told to leave the main menu
while (!exit && !goToCouchMenu && !goToInstructions && !goToAbout) {
// If the display is not visible (... | 7 |
@Test
public void testDraw()
{
// first its assumed to be default:
assertNotNull(_underTest.draw());
// set the draw-output, test changed draw-functionality:
_underTest.setDrawOutput(Output.Paper);
assertEquals(Output.Paper, _underTest.draw());
_underTest.setDra... | 0 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result
+ ((facebook == null) ? 0 : facebook.hashCode());
result = prime * ... | 9 |
@Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Game ID";
case 1:
return "Map size";
case 2:
return "Turn time";
case 3:
return "Extra turn";
case 4:
return "Pl... | 6 |
public static boolean isSubstring(String a, String b) {
if(a == null || b == null || a == "" || b == "")
return false;
String temp = a + a;
if(temp.contains(b))
return true;
return false;
} | 5 |
private void showMainMenu() {
System.out.println("\n---------------------------------------");
System.out.println("Please select an option :");
System.out.println("1. Library contents overview.");
System.out.println("2. Add a new item.");
System.out.println("3. Stop the applicati... | 3 |
boolean valid(Graph G)
{
return G.getEdgeWeight(1, 0) == 1&&
G.getEdgeWeight(1, 2) == 3 &&
G.getEdgeWeight(2,4) == 1 &&
G.getEdgeWeight(3, 4)== 2 &&
G.getEdgeWeight(3, 6) == 3 &&
G.getEdgeWeight(7, 6) == 2 &&
G.getEdgeWeight(7, 8) == 4 &&
G.getEdgeWeight(4, 5) == 3;
} | 7 |
public String getColor() {
return myColor;
} | 0 |
public void broadcastMessage()
{
Player[] players = Bukkit.getOnlinePlayers();
Random rand = new Random();
ConfigurationSection conf = getConfig().getConfigurationSection( "messages" );
Map<String, Object> msgs = conf.getValues( true );
String broadcast = "";
if ( msgs.size() > 0 )
{
int choi... | 9 |
@Override
public void putAll(Map<? extends K, ? extends V> m) {
for(Map.Entry<? extends K, ? extends V> me : m.entrySet()) {
this.put(me.getKey(), me.getValue());
}
} | 5 |
@Override
public Void doInBackground() {
String response;
try {
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
try {
... | 5 |
private List<Integer> findSharedUsers(int movie1, int movie2) {
List<Integer> sharedUsers = new ArrayList<Integer>();
HashSet<Integer> movie1Raters = usersByMovie.get(movie1);
HashSet<Integer> movie2Raters = usersByMovie.get(movie2);
// Return empty list if one user didn't rate any movies
if (movie1Raters ==... | 4 |
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 lo... | 6 |
public void saveConfig() {
FileConfiguration c = this.gm.getConfig();
String orderString = "";
Level lvl = this.level;
while (lvl != null)
{
orderString = orderString + lvl.Name;
c.set(this.arenaName + ".level." + lvl.Name + ".neededPoints", Integer.valueOf(lvl.neededPoints));
c.se... | 4 |
private int resolveUnit(String unit) {
if(unit.equalsIgnoreCase("second")) {
return TimeAxisUnit.SECOND;
}
else if(unit.equalsIgnoreCase("minute")) {
return TimeAxisUnit.MINUTE;
}
else if(unit.equalsIgnoreCase("hour")) {
return TimeAxisUnit.HOUR;
}
else if(unit.equalsIgnoreCase("day")) {
retur... | 7 |
public boolean equals(Object other) {
if (!(other instanceof Resource) || (other == null))
return (false);
return (compareTo((Resource) other) == 0);
} | 2 |
public void softDrop() {
Boolean ableToMove = true;
for (Block b : currentTetromino.getBlocks()) {
if ((b.getMapIndexY() == boardSizeY)
|| (tetrisMap[b.getMapIndexX()][b.getMapIndexY() + 1] == 1)) {
ableToMove = false;
}
}
if (ableToMove) {
for (Block b : currentTetromino.getBlocks()) {
... | 6 |
@Override
int afterName() throws IOException {
int n = in.next();
switch (n) {
case ' ':
case '\t':
case '\r':
case '\n':
in.back();
String ws = parseWhitespace(in);
if (!isIgnoreWhitespace()) {
set(JSONEventType.WHITESPACE, ws, false);
}
return AFTER_NAME;
case '/':
in.back();
S... | 9 |
@SuppressWarnings("unchecked")
public void addResource(Object arg) {
if (arg == null) {
throw new ComponentException("No resource string provided.");
}
if (arg.getClass() == String.class) {
l.add((String) arg);
} else if (arg instanceof Collection) {
... | 3 |
public ArrayList<Integer> spiralOrder(int[][] matrix) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<Integer> res = new ArrayList<Integer>();
int m = matrix.length;
if (m < 1)
return res;
int n = matrix[0].length;
if (n < 1)
return res;
int round = Math.min((m... | 9 |
@Override
public String getEmail() {
return super.getEmail();
} | 0 |
public HashMap<Team, List<Player>> getPlayers(){
HashMap<Team, List<Player>> players = new HashMap<Team, List<Player>>();
players.put(Team.RED, new ArrayList<Player>());
players.put(Team.BLUE, new ArrayList<Player>());
for(Player p : Bukkit.getOnlinePlayers()){
if(p.getLocation().distance(point) <= radius... | 5 |
public void simulatePeer() {
Random random = new Random();
int selectedFileId = random.nextInt(Main.MAX_NO_OF_FILES) + 1;
int selectedActionIndex = random.nextInt(Main.MAX_NO_OF_ACTIONS);
PeerAction selectedPeerAction = PeerAction.values()[selectedActionIndex];
String selectedAc... | 7 |
private boolean DL(String palabra){
switch(palabra){
case "(":
return true;
case ")":
return true;
case "[":
return true;
case "]":
return true;
case "{":
return true;
... | 6 |
void flip() {
Vertex temporary = this.start;
this.start = end;
this.end = temporary;
} | 0 |
private boolean jj_2_49(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_49(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(48, xla); }
} | 1 |
@Override
public void mouseReleased(MouseEvent e) {
// Make sure zoom area isn't a ridiculously small size
if (zoomArea != null) {
// Make sure zoom area isn't a ridiculously small size
Dimension size = zoomArea.getSize();
... | 2 |
public String getStepThrough()
{
return stepThrough;
} | 0 |
@Override
public boolean isInWilderness(Physical P)
{
if(P instanceof MOB)
return isInWilderness(((MOB)P).location());
else
if(P instanceof Item)
return isInWilderness(((Item)P).owner());
else
if(P instanceof Room)
{
return (((Room)P).domainType()!=Room.DOMAIN_OUTDOORS_CITY)
&&(((Room)P).dom... | 7 |
public boolean displayModesMatch(DisplayMode m1, DisplayMode m2) {
//resolution, bitdepth, refreshrate
if (m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()){
return false;
}
if (m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m2.getBitDepth() != DisplayM... | 8 |
private Collection<? extends Long> notIn(FiniteSequence<Long> factors, List<Long> result) {
List<Long> copy = new LinkedList<Long>(result);
List<Long> toAdd = new LinkedList<Long>();
while (factors.hasNext()) {
Long x = factors.next();
if (!copy.remove(x)) {
... | 3 |
public void setDescription(String description) {
this.description = description;
} | 0 |
public int getCostByDemand(int demand) {
int result = CostFunction.MAX_COST;
if(costByDemandMap.containsKey(demand)){
result = costByDemandMap.get(demand);
} else {
int[] demands = getDemands();
int i = 0;
while(i < demands.length){
if(demands[i] < 0 && demands[i] > demand){
result = costByDe... | 8 |
public String flagsToString() {
String s = "[";
s += (isSyn()) ? "SYN " : " ";
s += (isPsh()) ? "PSH " : " ";
s += (isFin()) ? "FIN " : " ";
s += (isRst()) ? "RST " : " ";
s += (isAck()) ? "ACK " : " ";
return s.trim() + "]";
} | 5 |
private void checkBoardDimension(int row, int col) {
rowBoard=row;
colBoard=col;
if (row>10)rowBoard=10;
if (row<6)rowBoard=6;
if (col>10)colBoard=10;
if (col<4)colBoard=4;
} | 4 |
private boolean skipTo(String toFind) throws IOException {
outer:
for (; pos + toFind.length() <= limit || fillBuffer(toFind.length()); pos++) {
if (buffer[pos] == '\n') {
lineNumber++;
lineStart = pos + 1;
continue;
}
for (int c = 0; c < toFind.length(); c++) {
... | 5 |
public static void drawFilledAlphaPixels(int x, int y, int w, int h, int color, int alpha) {
if (x < startX) {
w -= startX - x;
x = startX;
}
if (y < startY) {
h -= startY - y;
y = startY;
}
if (x + w > endX) {
w = endX - x;
}
if (y + h > endY) {
h = endY - y;
}
int alphaValue = 256 ... | 6 |
@Test
public void testClientQueueCounts() throws LuaScriptException {
String jid1 = addJob();
String jid2 = addJob();
String jid3 = addJob(UUID.randomUUID().toString(), "another-queue");
// Pop job to simulate worker
popJob();
List<Map<String, Object>> queueDetails = _clientQueues.counts();
for (Map<S... | 2 |
protected void initVerifiers(int currVerSet) {
int currVerifierSet ;
if (currVerSet >=0 && currVerSet < NO_OF_LANGUAGES ) {
currVerifierSet = currVerSet ;
}
else {
currVerifierSet = nsPSMDetector.ALL ;
}
mVerifier = null ;
mStatisticsData = null ;
if ( currVerifierSet == nsPSMDetector.TRADITI... | 8 |
public void lanchFrame(){
initial();
this.setLocation(400,300);
this.setSize(GAME_WIDTH,GAME_HEIGHT);
this.setBackground(Color.GREEN);
this.setTitle("TankWar");
this.addWindowListener(new WindowAdapter(){
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
this.s... | 0 |
private Monitor() {
JFrame guiFrame = new JFrame();
//make sure the program exits when the frame closes
guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
guiFrame.setTitle("ThermRonStat GUI");
guiFrame.setSize(300, 250);
//This will center the JFrame in the midd... | 8 |
public void testSearchForColony() {
Game game = getStandardGame();
Map map = getCoastTestMap(plainsType, true);
game.setMap(map);
Player dutchPlayer = game.getPlayer("model.nation.dutch");
Player frenchPlayer = game.getPlayer("model.nation.french");
Tile unitTile = map.g... | 6 |
private static void addToMap(File file, HashMap<String, HashMap<String, Integer>> countMap,
String level)
throws Exception
{
String name = file.getName().replace("standardReport_for_Sample_", "").replace(".txt", "")
.replace("_to16S", "").replace("standardReport_for_", "");
String[] splits = name.split(... | 9 |
@Override
public void parse() throws IllegalArgumentException
{
try
{
setEncoding(Encoding.getEncoding(buffer[0]));
}
catch (IllegalArgumentException ex)
{ // ignore the bad value and set it to ISO-8859-1 so we can continue parsing the tag
setEncoding(Encoding.ISO_... | 3 |
@Override
public String toString()
{
return "This is OverrideTest !";
} | 0 |
public EntradaBean get(EntradaBean oEntradaBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
HiloBean oHiloBean = new HiloBean();
UsuarioBean oUsuarioBean = new UsuarioBean();
oEntradaBean.setTitulo(oMysql.getOne("entrada", "titulo", oEntradaBean... | 2 |
private ZuseBinaryFloatingPoint24Bit divisor(ZuseBinaryFloatingPoint24Bit A, ZuseBinaryFloatingPoint24Bit B, boolean[] s) {
boolean[] Af = A.getExp().getCopiedBoolArr();
boolean[] Ag = B.getExp().getCopiedBoolArr();
boolean[] Bf = A.getMan().getCopiedBoolArr();
boolean[] Bg = B.getMan().getCopiedBoolArr();
... | 9 |
@Override
public void changedUpdate(DocumentEvent arg0) {
try{
if(Integer.parseInt(textRow.getText()) < 1){
JOptionPane.showMessageDialog(this, "Rows need to be higher than 0!");
textRow.setText("10");
}
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(this, "All Fields need to... | 7 |
@Override
public Class<?> getColumnClass(int columnIndex){
Class type = String.class;
switch (columnIndex){
case 0:
type = Integer.class;
break;
case 1:
type = String.class;
break;
case 2:
type = String.class;
break;
case 3:
type = String.class;
break;
case 4:
typ... | 6 |
public boolean movimientoCorrecto(Movimiento m, int color) {
boolean correcto = true;
if (tablero[m.fila][m.columna] != 0)
correcto = false;
else {
return (direccionCorrecta(m.fila, m.columna, -1,-1,color) ||
direccionCorrecta(m.fila, m.columna, -1,0,... | 8 |
public static int createTexture(String name, BufferedImage image) {
if (!ProjUtils.isPowerOf2(image.getWidth()) || !ProjUtils.isPowerOf2(image.getHeight())) {
System.out.println(name + " texture must have dimension values of a power of 2");
System.exit(1);
}
int[] pixels ... | 3 |
public String able(int a, int b, int c, int d) {
LinkedList<Integer> queue = new LinkedList<Integer>();
int s = a * 10000 + b;
queue.add(s);
while (!queue.isEmpty()) {
int ss = queue.removeFirst();
int aa = ss / 10000;
int bb = ss % 10000;
... | 7 |
@SuppressWarnings("unchecked")
public void setPackages(List<Package> packages) {
String serverAddress = "localhost";
Element packagesElement = root.getChild("packages");
if (packagesElement == null )
{
packagesElement = new Element("packages");
root.... | 5 |
public static boolean isNeeded(String entryText) {
/*
* If 'stack' is zero at the end of the method: * The lastTime point to
* the end of "Nituach Dikduki" section. * The open curly bracket equals
* to the close curly bracket.
*/
int stack = 0;
NituachDikduki.... | 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.