text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static boolean isLocked(int roomId) {
if(keyRequired[roomId-1] != 0) {
return true;
} else {
return false;
}
} | 1 |
@Override
public int getMask(int plane, int localX, int localY) {
int currentChunkX = localX / 8;
int currentChunkY = localY / 8;
int rotation = regionCoords[plane][currentChunkX][currentChunkY][3];
int realChunkX = regionCoords[plane][currentChunkX][currentChunkY][0];
int realChunkY = regionCoords[plane][cu... | 7 |
@Override
public void spring(MOB target)
{
if(target.location()!=null)
{
if((!invoker().mayIFight(target))
||(isLocalExempt(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
||(target==invoker())
||(doesSaveVsTraps(target)))
target.location().show(target,null,null,CMMs... | 7 |
private static List<Class<?>> classListFromJar(final String name, List<String> classpath) {
final List<Class<?>> results = new ArrayList<Class<?>>();
try (final JarFile jf = new JarFile(name)) {
final File jFile = new File(name);
ClassLoader cl =
new URLClassLoader(new URL[]{makeFileURL(jFile.getAbsolute... | 7 |
public static void asm_addwf(Integer akt_Befehl, Prozessor cpu) {
// Komponenten auslesen
Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6);
Integer w = cpu.getW();
Integer result = cpu.getSpeicherzellenWert(f) + w;
// Speicherort abfragen
if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) {
// in f Register... | 1 |
public Image getImage(String key) {
if(loadedImages.containsKey(key))
return loadedImages.get(key);
else
return null;
} | 1 |
private void visitObjectLiteral(Node node, Node child)
{
Object[] properties = (Object[])node.getProp(Node.OBJECT_IDS_PROP);
int count = properties.length;
// load array with property ids
addNewObjectArray(count);
for (int i = 0; i != count; ++i) {
cfw.add(ByteCo... | 8 |
private String[][] parseText(String textFile){
FileReader input = null;
try {
input = new FileReader(textFile);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
BufferedReader bufRead = new BufferedReader(input);
String myLine = null;
String[][] arra... | 4 |
public void run()
{
FileInputStream fis = null;
ZipInputStream zis = null;
try
{
try
{
File directory = new File(this.outputParentDirectory + File.separatorChar + this.zipFilePath.substring(this.zipFilePath.lastIndexOf(File.separatorChar)));
if(directory.exists())directory.delete();
directory... | 6 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// BufferedReader br = new BufferedReader(new FileReader("input.in"));
StringBuilder sb = new StringBuilder();
String line = "";
d: do {
line = br.readLine();
if (line == ... | 4 |
static Object[][] subtract(Object[][] x, Object[][] y) {
Object[][] ret = new Object[x.length][];
for (int i = 0; i < x.length; i++) {
ret[i] = new Object[x[i].length];
for (int j = 0; j < x[i].length; j++) {
Object a = x[i][j];
... | 6 |
public Value execute(Interpreter machine) throws MyException {
if (_operands != null && _operands.size() >= 3
&& _operands.get(0).isSymbol()
&& _operands.get(1).execute(machine).isNumber()
&& _operands.get(2).execute(machine).isNumber()) {
Symbol I = (... | 9 |
public boolean canShoot(Placeable currentObj) {
for (GameAction currentGameAction : getGameActions()) {
if (currentGameAction.canShoot(currentObj)) {
return true;
}
}
return false;
} | 2 |
private Point getTargetBlock(Point cur){
int cnt = 0;
if (this.maze[cur.x][cur.y + 1] == false) {cnt++;}
if (this.maze[cur.x][cur.y - 1] == false) {cnt++;}
if (this.maze[cur.x + 1][cur.y] == false) {cnt++;}
if (this.maze[cur.x - 1][cur.y] == false) {cnt++;}
if (... | 9 |
public void checkingDataBasedOnDateSelected() {
String datafromDisplay = dataFromLabel;
System.out.println("datafromDisplay: " + dataFromLabel);
try {
file_Grouping = new File(SelectingLogFileToReadXml.PathOfFileUsedInDateBasedGrouping,
"FileWithBlockDate.txt");
fwSeek = new FileWriter... | 7 |
public static Rectangle transform(Rectangle rectangle,
Direction direction,
boolean horizontalFlip,
boolean verticalFlip,
int width,
int hei... | 7 |
public void update(long elapsedTime) {
// select the correct Animation
Animation newAnim = anim;
if (getVelocityX() < 0) {
newAnim = left;
}
else if (getVelocityX() > 0) {
newAnim = right;
}
if (state == STATE_DYING && newAnim == left) {
... | 9 |
@Override
public boolean equals(Object object){
if(this.x == ((Coordinate)object).x && this.y == ((Coordinate)object).y)
return true;
else
return false;
} | 2 |
public boolean type(char key, java.awt.event.KeyEvent ev) {
if (key == 27) {
if (justclose)
ui.destroy(this);
else
wdgmsg("close");
return (true);
}
return (super.type(key, ev));
} | 2 |
public void useSurf()
{
surfing=true;
messageBox=new ErrorWindow();
messageBox.addMessage("You ride on your Pokemon!","Hidden Move: Surf");
messageBox.repaint();
while(messageBox.isVisible())
{
try
{
repaint();
Thread.sleep(10);
}
catch(Exception ignored){}
}
bgm.stop();
bikeSon... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TimeSheetPK other = (TimeSheetPK) obj;
if (emp_ID != other.emp_ID)
return... | 7 |
private void addLeavesToList(ArrayList<AreaObject> list) {
for (int i = 0; i < mStorageCount; i++) {
if (mLeafNode) {
list.add(mStorage[i]);
} else {
((AreaNode) mStorage[i]).addLeavesToList(list);
}
mStorage[i] = null;
}
mStorageCount = 0;
mLeafNode = true;
} | 2 |
public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
// top triangle
Path path = new Path(device);
path.moveTo(width/2, 0);
path.lineTo(width/2+100, 173);
path.lineTo(width/2-100, 173);
path.lineTo(width/2, 0);
// bottom ... | 4 |
@Around(" call(void de.codecentric.performance.Demo.method* (..)) ")
public void aroundDemoMethodCall(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
long cpuStart = threadMXBean.getCurrentThreadCpuTime();
long start = System.nanoTime();
thisJoinPoint.proceed();
long end = System.nanoTime();
lo... | 2 |
* @return Returns the parsed response. Index 0 is response, Index 1 is confidence score
*/
private void parseResponse(String rawResponse, GoogleResponse googleResponse) {
if (!rawResponse.contains("utterance"))
return;
String array = substringBetween(rawResponse, "[", "]");
... | 6 |
public void wiggleSort(int[] nums) {
int[] sorted=Arrays.copyOfRange(nums,0,nums.length);
Arrays.sort(sorted);
int minEnd=(nums.length-1)/2 , maxEnd=nums.length-1;
for(int i=0;i<nums.length;++i){
if(i%2==0){
nums[i]=sorted[minEnd--];
}else{
... | 2 |
public static void testStdIO(){
//Reading standard input
InputStreamReader cin=null;
try{
cin = new InputStreamReader(System.in);
println("Enter characters. 'q' to quit");
char c;
do{
c = (char) cin.read();
println(c);
}while(c!='q');
}
catch(IOException ioe){
println("IOException... | 4 |
public List<Integer> getRWinfo() {
if(type.equals(Type.READ) || type.equals(Type.WRITE)) {
return getNumericList(operation);
}
return null;
} | 2 |
public int getSubsampleFrequency() {
String freq = (String)subsampleFreqBox.getSelectedItem();
if (freq.equals(ALL)) {
return 1;
}
if (freq.equals(HALF)) {
return 2;
}
if (freq.equals(THIRD)) {
return 3;
}
if (freq.equals(QUARTER)) {
return 4;
}
if (freq.equals(TENTH)) {
return 10;
... | 7 |
private int readRemaining( ByteBuffer dst ) throws SSLException {
if( inData.hasRemaining() ) {
return transfereTo( inData, dst );
}
if( !inData.hasRemaining() )
inData.clear();
// test if some bytes left from last read (e.g. BUFFER_UNDERFLOW)
if( inCrypt.hasRemaining() ) {
unwrap();
int amount = ... | 4 |
private String translateIndexToQuery(String ruleSymbol, boolean translatedFlag) {
if (ruleSymbol.equals("Default") || translatedFlag)
return ruleSymbol;
String ruleString;
if (ruleSymbol.equals("."))
ruleString = "intersect";
else if (ruleSymbol.equals("+"))
ruleString = "union";
else if (domconfB... | 5 |
public static Arena getArena(int id) {
for (Arena a : SuperBaseBattle.arenaList)
if (a.getArenaId() == id)
return a;
return null;
} | 2 |
public void showSplash() {
setBackground(Color.white);
JLabel label = new JLabel(createImageIcon(image1));
add(label, BorderLayout.CENTER);
pack();
centerScreen();
setVisible(true);
} | 0 |
@Override
protected void paintComponent(Graphics gc) {
Insets insets = getInsets();
int x = insets.left;
int y = insets.top;
int width = getWidth() - (insets.left + insets.right);
int height = getHeight() - (insets.top + insets.bottom);
if (mInMouseDown && mPressed) {
gc.setColor(Colors.adjustBrightness... | 4 |
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if(action.equals("Exit")){
ui.exit();
}
else if(action.equals("New grid..")){
ui.kaynnista();
}
else if(action.equals("About")){
u... | 8 |
private Tuple<Float, HeuristicData> min(LongBoard state, HeuristicData data, float alpha,
float beta, int action, int depth) {
statesChecked++;
Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MAX_VALUE, data);
Winner win = gameFinished(sta... | 7 |
public boolean setStartPosition(int length) {
if (length < 5 || length > 50)
return false;
int row = 0;
int col = 0;
Color c = null;
do {
row = 0 + (int) (Math.random() * length);
col = 0 + (int) (Math.random() * length);
c = map.grid[row][col];
} while (c != Color.GREEN);
start_pos = new P... | 5 |
public String getLetters(String str)
{
int breakPos = 0;
for(int i = 0; i < str.length(); i++) //get the first letters in the string
{
char ch = str.charAt(i);
if(!Character.isLetter(ch))
{
breakPos = i;
break;
}
if(i == str.length()-1)
breakPos = i+1;
}
return str.substring(0,... | 3 |
@Override
public void run() {
if (file == null)
return;
try {
BufferedReader br = new BufferedReader(new FileReader(file));
br.readLine();
String line;
ItemCatDao icDao = new ItemCatDao();
while ((line = br.readLine()) != null) {
String[] values = line.split(",");
ItemCat ic = new ItemCat... | 6 |
private void loadSector(File sectorFile) {
try {
Scanner scanner = new Scanner(sectorFile);
Sector sector = new Sector();
while (scanner.hasNext()) {
String line = scanner.nextLine();
if (line.startsWith("TRIANGLE")) {
Strin... | 6 |
public void method293(int z, int x, int y) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile == null) {
return;
}
for (int j1 = 0; j1 < groundTile.anInt1317; j1++) {
InteractiveObject interactiveObject = groundTile.interactiveObjects[j1];
if ((interactiveObject.uid >> 29 & 3) == 2 && inter... | 5 |
@Override
public boolean test(String value) {
// TODO Auto-generated method stub
if (value == null || value.length() == 0) {
return false;
}
int len = value.length();
if (!Character.isUpperCase(value.charAt(0))) {
return false;
}
for (int i = 1; i < len; i++) {
char c = value.charAt(i);
if (!... | 7 |
public void handleInteraction(Automaton automaton,
AutomatonSimulator simulator, Configuration[] configurations,
Object initialInput) {
SimulatorPane simpane = new SimulatorPane(automaton, simulator,
configurations, environment, false);
if (initialInput instanceof String[])
initialInput = java.util.Arr... | 1 |
@EventHandler(priority = EventPriority.HIGH)
public void EntityTargetEvent (final Entity entity, final Entity target,
final TargetReason reason) {
if (entity instanceof Bat) {
Bat wisp = (Bat) entity;
if (MMWisp.isWisp(wisp)) {
plugi... | 2 |
String getValue(int i, int j) {
if (j >= columns.size()) return null;
ArrayList<String> col = columns.get(j);
if (i >= col.size()) return null;
return col.get(i);
} | 2 |
public static Complex[] fft(Complex[] x) {
int N = x.length;
// base case
if (N == 1) return new Complex[] { x[0] };
// radix 2 Cooley-Tukey FFT
if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); }
// fft of even terms
Complex[] even = new C... | 6 |
public static void main(String[] args) {
// Using Sieve of Eratosthenes to mark all non-primes as false
boolean[] nums = new boolean[200000];
for (int i = 2; i < nums.length; i++)
nums[i] = true;
int nextPrime = 2;
while (nextPrime < nums.length / 2) {
int i = nextPrime;
for (; i < nums.length; i += ... | 7 |
private SortedSet<Schema> readSchemas() throws IOException,
CubeXmlFileNotExistsException, DocumentException,
CorrespondingDimensionNotExistsException {
Configuration conf = CubeConfiguration.getConfiguration();
FileSystem hdfs = FileSystem.get(conf);
Path schemaXmlFile =... | 7 |
public int getScore() {
return score;
} | 0 |
private RequestType parseRequest(BufferedReader input, StringBuilder arg) {
String query;
try {
query = input.readLine();
} catch (IOException e) {
System.out.println("\t\tMaster.parseRequest():\tError! I/O exception happened in readLine().");
return RequestType.EXCEPTION;
}
if (query == null || q... | 7 |
@Override
public void doSharpen() {
if (imageManager.getBufferedImage() == null) return;
WritableRaster raster = imageManager.getBufferedImage().getRaster();
double[][] newPixels = new double[raster.getWidth()][raster.getHeight()];
for (int x = 1; x < raster.getWidth() - 1; x++) {
for (int y = 1; y < raster... | 7 |
private void updateMovement(double time) {
if (atDestinationNode()) {
location = getLocFromMapLoc(currentDestinationX, currentDestinationY);
if (isFinalDestination()) {
updateFinalLoc();
} else {
updateNextLoc();
}
} else {
gunAngle = bodyAngle = getLocFromMapLoc(currentDestinationX, currentD... | 2 |
public setNow() {
this.info = "adjust the server time";
this.addParamConstraint("timestamp", ApiHandler.ParamCons.INTEGER,"the new timestamp of 'now', in ms");
} | 0 |
public static Item[] getSortedInventoryList() {
Item[] inventoryList
= Survivalist.getCurrentGame().getInventory();
Item tempItem;
for (int i = 0; i < inventoryList.length - 1; i++) {
for (int j = 0; j < inventoryList.length - 1 - i; j++) {
if (inven... | 3 |
@EventHandler
public void MagmaCubeWeakness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getMagmaCubeConfig().getDouble("MagmaCu... | 6 |
public void bufferMap(){
// Pre-buffer map image
// System.out.println("Buffering map");
int xLoc, yLoc;
mapImage = new BufferedImage(maxX, maxY, BufferedImage.TYPE_4BYTE_ABGR);
Graphics g = mapImage.getGraphics();
for (int y = 0; y < maxY/TILEWIDTH; y++) {
for (int x = 0; x < maxX/TILEWIDTH; x++) {
... | 4 |
public static Transmission parse (DataInputStream dis) {
Transmission trans = null;
try {
while (dis.available() <= 0)
Thread.sleep(10); // spin waiting for data
trans = new Transmission();
trans.role = PlayerRole.lookupRole(dis.readInt());
ignore(dis);
trans.startingCorner = StartCorner.... | 5 |
public static void GAMING() throws IOException{
int timeblock = 1;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (timeblock > 0){
System.out.println("What would Damon like to play right now?");
{
System.out.println("1. League of Legends");
System.out.println("... | 5 |
public void paintComponent(Graphics g)
{
mxGraph graph = graphComponent.getGraph();
Rectangle clip = g.getClipBounds();
updateIncrementAndUnits();
// Fills clipping area with background.
if (activelength > 0 && inactiveBackground != null)
{
g.setColor(inactiveBackground);
}
else
{
g.setColor(g... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StudentAttendance other = (StudentAttendance) obj;
if (internalID == null) {
if (other.internalID != null)
return false;
} else if (!int... | 6 |
public String getQuery() {
return query;
} | 0 |
public String getWrong() {
return wrong;
} | 0 |
private void listaVariaveis(boolean varLocal) {
// <lista_variaveis> ::= <variavel> <lista_variaveis> | “}”
// <variavel>::= <tipo_primitivo> <id> <compl_declaracao_var>| <id><id> “;”
// <compl_declaracao_var> ::= “=” <valor> “;” | <definição_matriz>
// <definição_matriz> ::= “[” <inteiro> “... | 8 |
public void Download10KbyCIK(String symbol, boolean isCurrent) {
GetURL gURL = new GetURL();
ArrayList<String> URLs = gURL.Get10kURLwithCIK(symbol, isCurrent);
Iterator<String> it = URLs.iterator();
while(it.hasNext()) {
String str = it.next();
int index0 = str.indexOf("data");
... | 9 |
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (this.record != null) {
if (qName.equals(this.className)) {
// окончание чтения записи
this.records.put(this.record.getUnique(), this.record);
thi... | 3 |
public void setSizeField() {
boolean fault = true;
while (fault) {
System.out.print("Введите размерность игрового поля: ");
Scanner scanner = new Scanner(System.in);
try {
this.field.sizeField = scanner.nextInt();
fault = false;
... | 2 |
@Override
public Set<AndroidMethod> parse() throws IOException {
Set<AndroidMethod> methodList = new HashSet<AndroidMethod>(INITIAL_SET_SIZE);
BufferedReader rdr = readFile();
String line = null;
Pattern p = Pattern.compile(regex);
String currentPermission = null;
while ((line = rdr.readLine()) != nu... | 9 |
public void setExtractMode(String extractMode) {
if( !extractMode.equals(EXTRACT_MODE_TRUST) && !extractMode.equals(EXTRACT_MODE_INFER) )
{
throw new RuntimeException("Invalid setting " + extractMode + " for parameter extractMode");
}
this.extractMode = extractMode;
} | 2 |
public double findMedianSortedArrays(int A[], int B[]) {
int m = A.length, n = B.length;
assert (m + n > 0);
if (m == 0) {
return n % 2 == 1 ? B[n / 2] : (double) (B[n / 2 - 1] + B[n / 2]) / 2.;
}
if (n == 0) {
return m % 2 == 1 ? A[m / 2] : (double) (A[... | 7 |
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... | 3 |
private HttpHandler createContext() {
return new HttpHandler() {
@Override
public void handle(HttpExchange he) throws IOException {
he.getResponseHeaders().add("Access-Control-Allow-Origin", "*");
String path = he.getRequestURI().getPath()... | 8 |
private void disp(int[] bowl) {
String str = "|";
for (int i = 0; i < bowl.length; i++) {
str += " " + bowl[i] + " |";
}
str += "\n";
System.out.println(str);
} | 1 |
public void printReport(ArrayList<Diff> aDiffL) throws Exception {
ArrayList<Diff> firstL, secondL;
String report;
String newL = System.getProperty("line.separator");
//separating the diffs depending on their schema
firstL = new ArrayList();
secondL = new ArrayList();
... | 7 |
@SuppressWarnings("unchecked")
private void thursdayCheckActionPerformed(java.awt.event.ActionEvent evt) {
if(this.dayChecks[4].isSelected()) {
this.numSelected++;
if(this.firstSelection) {
stretch();
}
... | 4 |
public static boolean resizeVideo(Rectangle newVideoBounds)
{
try
{
Player player = null;
ServiceContext serviceContext = ServiceContextFactory.getInstance().getServiceContexts()[0];
if (serviceContext != null && serviceContext.getService() != null && serviceConte... | 8 |
public V valAt(K key) {
if (key == null) return getNullVal();
V val = map.get(key);
if (val != null) return val;
val = lookup.valAt(key);
if (val != null) map.putIfAbsent(key, val);
return val;
} | 3 |
public static Vector<Caddie> getContenuCaddie () throws BDException {
Vector<Caddie> res = new Vector<Caddie>();
String requete = "select idr, nomS, TO_CHAR(DATEREP, 'DD/MM/YYYY HH24:MI') AS DATEREP, lecaddie.numS, lecaddie.numZ, nomC, qt from lesspectacles, lecaddie, leszones where lesspectacles.numS=lecaddie.nums... | 2 |
public int uniquePaths(int m, int n) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
int[][] grid = new int[m][n];
for (int i = m - 1; i >= 0; --i) {
grid[i][n - 1] = 1;
}
for (int j = n - 1; j >= 0; --j) {
grid[m - 1][j] = 1;
}
for (int i = m - 2; i >=... | 4 |
public static int countPageHtmlCode(final String filePath) throws IOException{
File file = new File(filePath);
FileReader leavesFileReader = new FileReader(file);
BufferedReader br = new BufferedReader(leavesFileReader);
int count = 0;
String line;
while((line = br.readLine()) != null){
if(line.contains(... | 2 |
private boolean processConjunction(List<Boolean> values,
Conjunction conjuntion) {
boolean retVal = true;
if (conjuntion.equals(Conjunction.Or)) {
retVal = false;
}
for (Boolean bool : values) {
if (conjuntion.equals(Conjunction.And)) {
retVal = retVal && bool;
}
if (conjuntion.equals(Conju... | 6 |
private int scoreBowl(int[] bowl) {
int score = 0;
for (int i = 0; i < preferences.length; i++) {
score += bowl[i] * preferences[i];
}
return score;
} | 1 |
private void refreshClassList() {
selectClassContainer.clear();
// first show all classes
for (Image img : selectClassImageList) {
selectClassContainer.add(img);
}
// then set visibility of classbuttons depending on classes taken
int i = 1;
if (DDOCharacter.getTakenClasses().size() >= 3) {
s... | 4 |
public void testBuild00(){
TrieBuilder builder = DoubleArrayTrieImpl.createBuilder();
try {
builder.build(null);
fail("");
} catch (IllegalArgumentException e){
assertEquals("The list of keys is null.", e.getMessage());
} catch (Exception e){
... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (super.equals(o)) {
return true;
}
orgataxe.entity.Vehicle vehicle = (orgataxe.en... | 6 |
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
boolean leaf, int row, boolean hasFocus)
{
JLabel result = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,
... | 1 |
public TestLinkUriResolverTest(URI expectedUri, final TestLinkId<?> testLinkId) {
this.testLinkId = testLinkId;
this.expectedUri = expectedUri;
} | 1 |
private static void printDeck(String[] bestDeck) {
for (String s : bestDeck) {
System.out.print(s + ", ");
}
} | 1 |
public Point toGate(Point current){
double ox = 0, oy = 0;
Point gate = new Point(dimension/2, dimension/2);
// if both the x and y of the piper are farther than 1 from the gate, change both
// !finishround signifies that the piper is not ready to move towards the target yet
if(Math.abs(gate.x - current.x) > ... | 8 |
public static String[] removeSlashStrings(String[] data)
{
ArrayList<String> result = new ArrayList<String>();
for (int i = 0; i < data.length; i++)
{
if (!data[i].equals("/"))
{
result.add(data[i]);
}
}
String[] res = new... | 2 |
public void keyReleased(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key released: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
this.upPress = false;
break;
case KeyEvent.VK_DOWN:
System.out.println("down");
this.downPress = false;
break;
... | 5 |
private CommandResponse doGet(String commandName, List<Pair<String,String>> headers, Object commandParameters, Class<?> responseCastClass) //throws ClientException may need to add this in later
{
CommandResponse result = null;
int clientVersion = 0;
if(commandName.contains("game/model")) {
int modelIndex = co... | 9 |
private InetAddress findMatch(String dest) {
InetAddress realDstIP = null;
int prefixLength = 0;
/* Finds the best matching prefix for the destination IP */
for (String prefix : prefixes.keySet()) {
String[] prefixArr = prefix.split("\\.");
String[] destArr = dest.split("\\.");
String p = ""... | 5 |
public boolean isPrime(long num) {
if (num % 2 == 0) {return false;}
else {
for (long x = 3l; x*x < num; x += 2) {
if(num % x == 0) {
return false;
}
}
}
return true;
} | 3 |
static RunnerConfig parseCommandLine( Options opts, String[] args ) throws ParseException, UnknownHostException {
final CommandLine cl = new GnuParser().parse( opts, args );
if( cl.hasOption( OPT_h ) ) {
// Jnetcat -l
new HelpFormatter().printHelp( "Jnetcat [ -h ] [ -l listenPort [ listenAddr ] ] ", opts );
... | 9 |
public boolean delBannedWord(String badWord) {
if (badWord.indexOf(":") > 0) {
String thisSplut[] = badWord.split(":",2);
badWord = thisSplut[0];
}
if (wordList.containsKey(badWord)) {
wordList.remove(badWord);
saveWordList();
return true;
} else {
return false;
}
} | 2 |
public static DatabaseClosure createClosure(String name, File target) {
if (closures.containsKey(name))
throw new RuntimeException("Closure with that name already exists.");
DatabaseClosure closure = new DatabaseClosure(name, target);
return closures.put(name, closure);
} | 1 |
private static Map<? extends Attribute, ?> fixattrs(Map<? extends Attribute, ?> attrs) {
Map<Attribute, Object> ret = new HashMap<Attribute, Object>();
for(Map.Entry<? extends Attribute, ?> e : attrs.entrySet()) {
if(e.getKey() == TextAttribute.SIZE) {
ret.put(e.getKey(), ((Number)e.getValue()).floatValue());
... | 8 |
private boolean pushPrimitiveArg(Class<?> argclass, Object arg) {
if (argclass.equals(Float.class)) {
pushFloatArg((float) arg);
} else if (argclass.equals(Integer.class)) {
pushIntArg((int) arg);
} else if (argclass.equals(Long.class)) {
pushLongArg((long) ar... | 7 |
public double getDuration() {
// Return nothing if we don't have sufficient information.
if(this.dateRoundStarted == null || this.dateRoundEnded == null)
return -1;
// Get our round duration
long diffMilliseconds = (this.dateRoundEnded.getTime() - this.dateRoundStarted.getTime());
double seconds ... | 2 |
public static void main(String[] args) {
if(true && true){
System.out.println(1);
}
if(true && false){
System.out.println(2);
}
if(false && true){
System.out.println(3);
}
if(false && false){
System.out.println(4);
}
} | 8 |
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.