text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void write(final InputStream in, final OutputStream out) {
try {
final byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) != -1) {
out.write(buf, 0, len);
}
} catch (final Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.clos... | 5 |
public void start()
{
if( !requestNewMatch() )
{
return;
}
String gameStatusFromLastLoop = "";
// actual game loop
while(true)
{
//get game status
String lastGameStatusAnswerString = requestMatchStatus();
if( lastGameStatusAnswerString.equals(gameStatusFromLastLoop))
{
System.o... | 9 |
public void loop() throws IOException {
acceptor = new ServerSocket(PORT);
service = new GLSRequestHandler(this);
while (true) {
System.out.println ("Waiting for connections on port " + PORT);
//This waits for an incomming message
socket = acceptor.accept();
JInPiqi.request req = read_message();
... | 7 |
protected void rapproche(Cellule cible){
if(!this.curent.personne.isEmpty()){
this.curent.personne.remove(this);
}
if (Math.abs(this.curent.coord.x -cible.coord.x) >= Math.abs(this.curent.coord.y - cible.coord.y)) {
if (this.curent.coord.x != cible.coord.x){
if (this.curent.coord.x> cible.co... | 8 |
public String shortName() {
if (isIntegral()) {
return "" + Type.INTEGER_CHAR;
}
// Use R rather than L for readability.
if (isReference()) {
return "R";
}
Assert.isTrue(desc.length() == 1, "Short name too long: " + desc);
return desc;
} | 2 |
public int getStatus() {
return Status;
} | 0 |
public void update() {
// Moves character or scrolls background accordingly
if (speedX < 0) {
centerX += speedX;
}
if (speedX == 0 || speedX < 0) {
bg1.setSpeedX(0);
bg2.setSpeedX(0);
}
if (centerX <= 200 && speedX > 0) {
centerX += speedX;
}
if (speedX > 0 && centerX > 200) {
bg1.setSpe... | 9 |
@Override
public double observe() {
double observed = 0;
for (int i = 0; i < k; i++) {
observed += borel.observe();
}
return observed;
} | 1 |
private int ssCompare (final int p1, final int p2, final int depth) {
final int[] SA = this.SA;
final byte[] T = this.T;
final int U1n, U2n; // pointers within T
int U1, U2;
for (
U1 = depth + SA[p1], U2 = depth + SA[p2], U1n = SA[p1 + 1] + 2, U2n = SA[p2 + 1] + 2;
(U1 < U1n) && (U2 < U2n) && (T[U1... | 6 |
private void Process_IsEmpty(List<Production> productions){
// First step is to select symbols that are on the left side of the epsilon production
// as empty symbols.
for (int i = 0; i < productions.size(); ++i){
if (productions.get(i).mRightSymbolsIndices.get(0) == Utilities.ProductionEpsilonCode)
mSymbo... | 9 |
public void switchMediaLibraryToMappedDrives()
{
if (mediaDir != null)
{
for (int i = 0; i < mediaDir.length; i++)
{
UNCFile file = new UNCFile(mediaDir[i]);
if (file.onNetworkDrive())
{
mediaDir[i] = file.getDrivePath();
}
}
}
if (mediaLibraryDirectoryList != null)
{
for (i... | 9 |
public void addGold()
{
int randNum;
for(int i=0;;i++)
{
randNum=random.nextInt(totalBoardSize);
if(randNum>(boardSize*2) && isCorrectPit(randNum) && isCorrectGold(randNum))
break;
}
findNeighbour(randNum);
for(WumpusWorldVO w:wwList)
{
if(w.getBoardNo()==randNum)
w.setGold(true);... | 9 |
public void testCheckedPoolKeyedObjectPool() throws Exception {
try {
PoolUtils.checkedPool((KeyedObjectPool<Object, Object>)null, Object.class);
fail("PoolUtils.checkedPool(KeyedObjectPool, Class) must not allow a null pool.");
} catch(IllegalArgumentException iae) {
... | 7 |
public void DFS(int[] num){ //index is how many numbers do not add the list
if(list.size() == length){
result.add(new ArrayList<Integer>(list));
return;
}
for(int i=0; i< length ;i++){
if(flag[i])
continue;
list.add(num[i]);
... | 3 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... | 7 |
public void setCurrentProfile(String username) {
LOGGER.log(Level.INFO, "Setting current profile to: " + username);
if (!profiles.containsKey(username)) {
System.out.println("Tried to set current profile to one that doesn't exist.");
return;
}
currentProfile = profiles.get(username);
} | 1 |
public static HashMap<String, String> readTokens() {
final HashMap<String, String> result = new HashMap<>();
try {
final Scanner input = new Scanner(
new File("/etc/firedog/tokens.cf"));
try {
while (input.hasNextLine()) {
final String line = input.nextLine().trim();
if (line.isEmpty())
... | 8 |
public boolean ModificarTipoCultivo(TipoCultivo p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} | 1 |
public int GetMinimumPassenger()
{
return minimumPassenger;
} | 0 |
private JAutoPanel window_login() {
JAutoPanel frame = new JAutoPanel(this.desktop);
JLabel eMafiaText = new JLabel("eMafia");
JLabel usernameText = new JLabel("Username:");
JTextField usernameField = new JTextField(15);
usernameField.setName("username");
JLabel passwordText = new JLabel("Password:");
JP... | 7 |
@Override
public double regress(double[] x) {
for(int i = 0; i < x.length; i++){
this.input.get(i).input(x[i]);
}
//Propagate stuff
for(Neuron n : this.input) n.propagate();
for(List<Neuron> list : this.hidden){
for(Neuron n : list) n.propagate();
}
for(Neuron n : this.output) n.propagate();
doub... | 6 |
public void changeZoom()
{
for(int i=0;i<markers;i++)
{
marker[i].changeZoom();
}
} | 1 |
private void getApps() throws IOException {
List<String> listOfApps = device.getPackageController().getPackages();
DefaultListModel model = new DefaultListModel();
for (String str : listOfApps) {
String[] arr = str.split(":");
model.addElement(arr[1]);
}
j... | 1 |
public int compareSeniorities(Instructor instructor, Course course) {
//Never give up our first assigned course
if(courses.size() == 1 && CourseAssignment.round != 1)
return 1;
//If we're getting a third before they get a second
if( (courses.size() + 1 - instructor.... | 7 |
public boolean connectedTo(WayOsm way){
boolean encontrado = false;
for (int x = 0; !encontrado && x < this.nodos.size(); x++)
encontrado = way.getNodes().contains(this.nodos.get(x));
return encontrado;
} | 2 |
public void getInput() {
String userCommand;
Scanner inFile = new Scanner(System.in);
do {
this.display(); // display the menu
// get commaned entered
userCommand = inFile.nextLine();
userCom... | 5 |
public void playSound(byte inputSound)//From my 2nd year project ^_^
{
if(sound)
{
try
{
stream = null;
switch(inputSound)
{
case(START):
stream = AudioSystem.getAudioInputStream(sound_Start);
break;
case(KILLED):
stream = AudioSystem.getAudioInputStream(sound_Killed);... | 8 |
@Override
public boolean isVisibleAt(int posX, int posY) {
if((posX/zoom) > originX && (posX/zoom) < (originX + getWidth()))
if((posY/zoom) > originY && (posY/zoom) < (originY + getHeight()))
return true;
return false;
} | 4 |
@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 Organisation)) {
return false;
}
Organisation other = (Organisation) object;
if ((this.id == null && other.id !... | 5 |
public static float waitTime(int[] arriveTimes, int[] executeTimes, int q) {
if (arriveTimes == null || executeTimes == null || arriveTimes.length != executeTimes.length)
return 0;
Queue<Process> queue = new LinkedList<Process>();
int curTime = 0, waitTime = 0;
int index = 0;
int length = arriveTimes.lengt... | 9 |
private void initialize() {
final int INSET = 50;
dimWindow = Toolkit.getDefaultToolkit().getScreenSize();
Dimension minDimWindows = new Dimension(300,300);
new JDesktopPane();
setResizable(true);
setBounds(INSET, INSET,
dimWindow.width - INSET*2,
... | 0 |
private int buscarCliente(String host) {
int numero = -1;
for (int i = 0; i < clientes.size(); i++) {
if (clientes.get(i).getHost().equals(host)) {
numero = i;
}
}
return numero;
} | 2 |
private void handleWhoisResponse(int code, String response) {
String[] parts = response.split(" ", 3);
String nickname = parts[1];
response = parts[2];
PrivateMessagingListener listener = getPrivateMessagingListener(nickname);
if (listener == null) {
if (serverEvents... | 8 |
public SchlangenGlied getPreviousGlied() {
return previousGlied;
} | 0 |
public XYSeries[] getAggegatedSeries() {
final XYSeriesCollection seriesCollection = new XYSeriesCollection();
for (int types = 0; types < 255; types++) {
if ((exists(types)) && (!hidden.contains(Integer.toString(types)))) {
// LOGGER.debug("class conatins : " + hidden.contai... | 6 |
public void doLoopAction()
{
switch (whatcha)
{
case PLAYING:
stage.doLoopAction();
break;
case PAUSE:
pauzeMenu.doLoopAction();
break;
case MAIN:
mainMenu.doLoopAction();
... | 4 |
private void refreshMonLocsAtRisk() {
TreeMap<Integer,Integer> atRiskLocs = new TreeMap<Integer,Integer>();
Iterator<Integer> atRiskPeople = this.mySim.getAtRiskPeople().iterator();
Iterator<Integer> implocs = this.trackLocations.keySet().iterator();
while (implocs.hasNext()) {
atRiskLocs.put(implocs.next(),... | 8 |
final void method3642(int i, Class348_Sub1[] class348_sub1s) {
do {
try {
for (int i_281_ = 0; i_281_ < i; i_281_++)
((NativeToolkit) this).aClass348_Sub1Array8132[i_281_]
= class348_sub1s[i_281_];
anInt7988++;
((NativeToolkit) this).anInt8151 = i;
if (!((NativeToolkit) this).aClass196_8184.metho... | 5 |
@SuppressWarnings({ "unchecked", "rawtypes" })
private Collection<Object> newCollection(Class<?> type)
{
if (SortedSet.class.isAssignableFrom(type))
return new TreeSet();
else
if (LinkedHashSet.class.isAssignableFrom(type))
return new LinkedHashSet();
else
if (Set.class.isAssignableFrom(type))
... | 5 |
public Sandwich() {
System.out.println("Sandwich()");
} | 0 |
public String[] getParameters() { return this.parameters; } | 0 |
private void dealBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dealBActionPerformed
(new SwingWorker<String, Object>() {
@Override
public String doInBackground() {
Board b = Board.getInstance();
Company companies[] = b.getCompanies()... | 5 |
public int comparer(Comparer comparer, Task taskX, Task taskY, int colIndex)
{
int result = 0;
if (colIndex == 0)
{
result = comparer.compare(taskX.getTaskID(), taskY.getTaskID());
}
else if (colIndex == 1)
{
result = comparer.compare(taskX.getTitle().toUpperCase(), taskY
.getTitle().toUpperC... | 7 |
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (l1 == null){
return l2;
}
if (l2 == null){
return l1;
}
ListNode superHead = new ListNode(-1);
ListNode temp = superHead;
while (l1 != null&&l2 != null){
if(l1.val<l2... | 7 |
@Override
public void init(GameContainer gc, StateBasedGame game) throws SlickException {
renderQueue.clear();
try {
renderQueue.add(player);
renderQueue.add(map);
for(MapLayer l : map.getLayers()) {
renderQueue.add(l);
}
} catch(Exception e) {
}
} | 2 |
@SuppressWarnings("unused")
public void captureMovie()
{
boolean done = false;
BufferedImage image = null;
long startTime = 0;
long endTime = 0;
int timeToSleep = (int) (1000 / framesPerSecond);
int actualTime = timeToSleep;
int count = 0;
Thread current = Thread.currentThread();
w... | 3 |
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UnorderedPair)) return false;
@SuppressWarnings("unchecked")
final UnorderedPair pair = (UnorderedPair) o;
return (((first == null ? pair.first == null : first.equals(pair.first)) && (second == null ? pair.second == n... | 9 |
public void calculateBranchStatistics() {
if (branchCount == 0) {
for (int i : branchData.keySet()) {
List<BranchData> branchDatas = branchData.get(i);
if (branchDatas != null) {
for (int j = 1; j < branchDatas.size(); j++) {
... | 6 |
public static ParseResult parseXmlPart( char[] chars, int offset ) throws XMLParseException {
int c;
whitespaceloop: while( offset < chars.length ) {
// Skip whitespace
c = chars[offset];
switch( c ) {
case( '<' ):
break whitespaceloop;
case( ' ' ): case( '\t' ): case( '\r' ): case( '\n' ):
+... | 7 |
private ArrayList<String> insertPointsQuery( List<Track> tracks ) throws SQLException {
Statement st = sqlite.createStatement();
ArrayList<String> strList = new ArrayList<String>();
int count = 0;
StringBuilder sqlQuery = new StringBuilder();
int size = tracks.size();
... | 6 |
private int GetLogicActionVetric(WumpusPolje[][] wumpusWorld){
if(tmpPolje.m_vetrovno){
//Down
if(tmpPolje.m_x + 1 < wumpusWorld.length && tmpPolje.m_y - 1 >= 0){
if(obiskanaPolja.contains(wumpusWorld[tmpPolje.m_x + 1][tmpPolje.m_y - 1]) && !wumpusWorld[tmpPolje.m_x + 1][tmpPolje.m_y - 1].m_vetrovno)... | 9 |
private static Individual crossover(Individual indiv1, Individual indiv2)
{
Individual newSol = new Individual();
// Loop through genes
for (int i = 0; i < indiv1.size(); i++)
{
// Crossover
if (Math.random() <= uniformRate)
{
byte gene = 0;
if(indiv1.getGene(i) == 1 && GA.items[i] + newS... | 6 |
public static void filterFiles() {
try {
DirectoryStream<Path> largerThanFourBytes = Files.newDirectoryStream(
Paths.get("/home/xander/test"), new DirectoryStream.Filter<Path>(){
@Override
public boolean accept(Path entry) throws IO... | 2 |
@EventHandler(priority = EventPriority.LOW)
public void onTeleport(PlayerTeleportEvent event) {
if (event.isCancelled()) {
return;
}
if (plugin.settings.blockTeleport() && plugin.isInCombat(event.getPlayer().getUniqueId()) && plugin.ctIncompatible.notInArena(event.getPlayer())) {
TeleportCause cause = even... | 8 |
Skeleton(JMSRemoteSystem remoteSystem, JMSRemoteRef ref, Object target) {
this.remoteSystem = remoteSystem;
try {
this.target = target;
Class<?> clazz = this.target.getClass();
if (CGLibProxyAdapter.isProxyClass(ref.getProxy().getClass())) {
for (Metho... | 8 |
public ShowBild(Bild[] b) {
for(Bild bild : b)
if(bild != null)
filled++;
filled --;
value = (int) (MAX * filled);
this.b = b;
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// setTitle("Bild" + b.name);
setSize(800, 600);
setVisible(true);
} | 2 |
public void setDirection(int dir) {
this.direction = dir;
} | 0 |
private static void readData() {
try {
b = new BufferedReader(new FileReader(fileDirectory + dataFile));
String line;
while ((line = b.readLine()) != null) {
String[] s = line.split(":");
int usr = Integer.parseInt(s[0]);
int mov = Integer.parseInt(s[2]);
int rat = Integer.parseInt(s[4]);
... | 6 |
@Override
public Room unDock(boolean moveToOutside)
{
final Room dock=getIsDocked();
Room exitRoom = null;
if(dock==null)
return null;
for(final Enumeration<Room> e=getProperMap();e.hasMoreElements();)
{
final Room R=e.nextElement();
if(R!=null)
{
for(int d=Directions.NUM_DIRECTIONS()-1;d>=0... | 7 |
public void dosomething() {
component.dosomething();
} | 0 |
public boolean coupPossible() {
Pile pile1;
Pile pile2;
for (int i = 0; i < listePiles.size(); i++) {
pile1 = listePiles.get(i);
for (int j = 0; j < listePiles.size(); j++) {
pile2 = listePiles.get(j);
if(pilesDifferentes(pile1, pile2)) {
... | 5 |
@Override
public Integer getNextValue(Integer current, Integer target)
{
for (ConditionalRule rule : rules)
{
if (rule.isApplicable(current, target))
return rule.getNextValue(current, target);
}
return null;
} | 2 |
public static String formatChar(final Character object) {
if (object == null) return "null";
final StringBuilder result = new StringBuilder(4).append('\'');
switch (object.charValue()) {
case '\'':
result.append("\\\'");
break;
case '\t':
result.append("\\t");
break;
case '\n':
result.a... | 5 |
@Override
public boolean singleStep() {
if (!heap.isEmpty()) {
Vertex u = heap.delMin();
u.setColor(VertexColor.GRAY);
DoublyLinkedList<Vertex> neighbours = adjacency.getNeighbours(u);
Vertex v = neighbours.succ(neighbours.min());
while (v != null)... | 3 |
private static void killBombers(IBomber[] bombers) {
for (IBomber iBomber : bombers) {
iBomber.destroy();
}
} | 1 |
public static void main(String[] args)
{
System.out.println("Starting network example ...");
try
{
if (args.length < 1) {
System.out.println("Usage: java SCFQExample network.txt");
return;
}
// get the network topology
... | 8 |
public void run() {
while (true) {
if (mtime != file.lastModified()) {
read();
}
try {
Thread.sleep(1000 * seconds);
} catch (InterruptedException e) {
return;
}
}
} | 3 |
protected String convertType(Class<?> clazz) {
if (clazz.isEnum()) {
return "INT";
}
return TYPECONVERSION.get(clazz.getSimpleName().toLowerCase());
} | 2 |
public void addOrUpdate(sharedstate.SharedState state, GameObject g, String data) {
UUID id = g.getId();
boolean found = false;
for (GameObject g2 : state.getObjects()) {
if (id.equals(g2.getId())) {
found = true;
if (g.getLastTimeStamp() <= g2.getLastTimeStamp()) {
break; // old data dont use
... | 4 |
private void backgroundRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backgroundRadioButtonActionPerformed
if (backgroundRadioButton.isSelected())
{
try
{
Pointer path = new Memory(300);
user32.SystemParametersInfoA(U... | 3 |
public static Map<String, String> decodeKVMap(String keyValueString) {
Map<String, String> keyValueMap = new HashMap<String, String>();
/**
* Only process if the KVString is not empty
*/
if (keyValueString != null && !keyValueString.isEmpty()) {
/**
* If the keyValueString has been re... | 5 |
@Override
public String decrypt(String str) {
try {
// Decode base64 to get bytes
byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
// Decrypt
byte[] utf8 = dcipher.doFinal(dec);
// Decode using utf-8
return new String(utf8... | 4 |
private King getKing(Color color) {
for (int i = 0; i < NUMBER_OF_COLS; i++) {
for (int j = 0; j < NUMBER_OF_ROWS; j++) {
Piece piece = pieces[j][i];
if (piece.name.equals(Constants.NAME_KING) && piece.getColor() == color)
return (King)piece;
}
}
System.out.println("There is no " + color + " Ki... | 4 |
private void sendOrderCaps(RdpPacket_Localised data) {
byte[] order_caps = new byte[32];
order_caps[0] = 1; /* dest blt */
order_caps[1] = 1; /* pat blt */// nb no rectangle orders if this is 0
order_caps[2] = 1; /* screen blt */
order_caps[3] = (byte) (option.isBitmapCachingEnabled() ? 1 : 0); /* memblt */
... | 7 |
@SuppressWarnings("unchecked")
public static HashMap<String, ArrayList<String>> load(String path) {
Object result = null;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(path));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
... | 5 |
private void moveCrew( final CrewSprite mobileSprite ) {
squareSelector.reset();
squareSelector.setCriteria(new SquareCriteria() {
private final String desc = "Move: Crew";
public String getDescription() { return desc; }
public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareI... | 6 |
public static Categorias sqlLeer(Categorias cat){
String sql="SELECT * FROM categorias WHERE idcategorias = '"+cat.getId()+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return null;
}
if(!BD.getInstance().sqlFetch()){
return null;
}
... | 2 |
public void startTime() {
this.timer = new Timer();
this.timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
updateTime();
}
}, 1000, 1000);
} | 0 |
private boolean isInside(Point p) {
if (p.x >= positionX
&& p.x <= (positionX + width)
&& p.y >= positionY
&& p.y <= (positionY + height)) {
return true;
}
return false;
} | 4 |
private void parse(String template) {
int offs = 0;
int lastOffs = 0;
while ((offs=template.indexOf('$', lastOffs))>-1 && offs<template.length()-1) {
char next = template.charAt(offs+1);
switch (next) {
case '$': // "$$" => escaped single dollar sign
addTemplatePiece(new TemplatePiece.Text(
... | 8 |
public void setPrpTerminal(String prpTerminal) {
this.prpTerminal = prpTerminal;
} | 0 |
public static boolean hasSquare(String[][] grid, int caseCount){
for (int i = 0; i < grid.length; i++) {
for(int j = 0; j < grid.length; j++){
if(grid[i][j].equals("#")){
if(hasNoSurroundingSquares(grid, i, j, caseCount))
return false;
}
}
}
for (int i = 0; i < grid.length; i++) {
for(... | 7 |
public static final void writeInteger( long num, byte encoding, OutputStream os ) throws IOException {
switch( encoding ) {
case NE_INT8 : writeInt8( (byte)num, os ); return;
case NE_INT16 : writeInt16( (short)num, os ); return;
case NE_INT32 : writeInt32( (int)num, os ); return;
case NE_INT64 : writ... | 5 |
void move2D(Mesh mesh, int[] vertexes, int iVertex, int x, int y,
boolean moveAll) {
if (vertexes == null || vertexes.length == 0)
return;
Point3i pt = new Point3i();
Point3f coord = new Point3f();
Point3f newcoord = new Point3f();
Vector3f move = new Vector3f();
coord.set(me... | 9 |
public static void main(String [] args) {
try {
ImportDao importDao = new ImportDao();
importDao.connect();
Dao.getInstance();
Connection conn = Dao.getConnection();
ArrayList<Activity> estudios = importDao.getEstudios();
ActivityDao activityDao = ActivityDao.getInstance();
System.out.pri... | 4 |
public String minWindow(String S, String T) {
if(T.length() == 0) return "";
int lastBeginIndex = -1;
String res = "";
for(int i=0,j=0; i<S.length(); i++)
{
if(S.charAt(i) == T.charAt(j))
{
j++;
if(j==1)lastBeginIndex = i;
if(j=... | 7 |
public void purge()
{
//removes DEAD contacts from the bucket
for (Iterator<Contact> it = contacts.values().iterator(); it.hasNext();)
{
Contact node = it.next();
if(!node.isAlive() && !isLocalNode(node))
it.remove();
}
//replaces... | 8 |
public static void pasteADocFragment(ADocument aDoc, int position, ADocumentFragment fragment){
String text = fragment.getText();
HashMap <DocSection, AttributeSet> styleMap = fragment.getStyleMap();
HashMap <DocSection, AData> fragMap = fragment.getaDataMap();
try {
// inserting plain text
//a... | 6 |
public static Class<? extends Player> load(String jarFile) {
try {
URL url = new File(jarFile).toURI().toURL();
String playerClassName = getPlayerClassName(url);
if (playerClassName == null) {
throw new RuntimeException(String.format("Can not find class name f... | 8 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
private void loadHighScore() {
try {
File f = new File(saveDataPath, fileName);
if (!f.isFile()) {
createSaveData();
}
BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream(f)));
highScore = Integer.parseInt(reader.readLine());
fastestMS = Long.parseLong(rea... | 2 |
@Override
protected void onMove() {
if (Keyboard.isKeyPressed(Keyboard.KEY_LEFT)) {
if (sprZombie.getCurrentAnimationName() == "quiet")
sprZombie.setAnimation("walk");
} else {
if (sprZombie.getCurrentAnimationName() == "walk" && sprZombie.getCurrentAnimationNumLoops() >= 1)
sprZombie.setAnimation... | 8 |
public Object invokeMethod(Reference ref, boolean isVirtual,
Object cls, Object[] params) throws InterpreterException,
InvocationTargetException {
if (cls == null && ref.getClazz().equals(classSig)) {
String clazzName = ref.getClazz();
clazzName = clazzName.substring(1, ref.getClazz().length() - 1)
... | 3 |
@Override
public boolean run() {
for (Gene g : config.getSnpEffectPredictor().getGenome().getGenes()) {
// System.out.println(g.getGeneName());
for (Transcript tr : g) {
if (!tr.isProteinCoding()) continue;
if (tr.introns().size() < 2) continue;
// System.out.println("\t" + tr.getId());
for ... | 5 |
@WebMethod(operationName = "ReadOrderInDetail")
public ArrayList<OrderInDetail> ReadOrderInDetail(@WebParam(name = "ord_in_det_id") String ord_in_det_id) {
OrderInDetail ord_in_det = new OrderInDetail();
ArrayList<OrderInDetail> ord_in_dets = new ArrayList<OrderInDetail>();
Arra... | 3 |
public boolean evaluateLightCheckmate(Chessboard boardToCheck)
{
boolean isInCheckmate = false;
Chessboard chessboardCopy = new Chessboard(boardToCheck);
Tile[][] tileBoardCopy = chessboardCopy.getBoard();
ArrayList<Piece> offendingPieces = new ArrayList<>();
ArrayList<Location> safeAreas = new ArrayLi... | 9 |
public String getPhase() {
byte[] input = getEFBytes(DatabaseOfEF.EF_PHASE);//,1
if (input[0] == (byte) 0x00) {
return "Phase 1";
}
if (input[0] == (byte) 0x02) {
return "Phase 2";
}
if (input[0] == (byte) 0x03) {
return "Phase 2+ (wit... | 3 |
public void delete(String name, Boolean flag) throws UpYunExcetion {
try {
StringBuffer url = new StringBuffer();
for (String str : name.split("/")) {
if (str == null || str.length() == 0) {
continue;
}
url.append(UrlCod... | 6 |
private static Image[] fetchImages(String path, String fileBaseName,
String fileType, int quantity, int stepSize) {
Image[] imgs = new Image[quantity];
if (stepSize == 1) {
for (int i = 0; i < quantity; i += 1) {
try {
imgs[i] = new Image(path + fileBaseName + (i + 1)
+ fileType);
int scl... | 5 |
public void testRemovedSlotPruning() {
THashMap<String,String> map = new THashMap<String,String>();
map.put( "ONE", "1" );
map.put( "TWO", "2" );
map.put( "THREE", "3" );
// Compact to make sure we're at the internal capacity we want to ultimate be at
map.compact();
// Make sure there are no REMOVED slo... | 6 |
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.