text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Player(int pID){
playerID = pID;
//Jeder Spieler bekommt 15 Steine
for(int i=0; i<14; i++){
steine.add(new Steinchen(this.playerID, i));
}
dice = new Dice();
//Startposition fuer die einzelnen Spieler initialisieren
switch(playerID){
case 0:
this.startposition = 0;
case 1:
... | 3 |
public BBLogHandler(File f) {
log.finer("Creating new BBLogHandlerInstance");
try {
if(!f.exists()) {
//noinspection ResultOfMethodCallIgnored
f.getParentFile().mkdirs();
//noinspection ResultOfMethodCallIgnored
f.createNewFile();
}
fw = new FileWriter(f, true);
toFile = true;
} catch(... | 2 |
public void update(UserBall b){
BPx = b.getPx();
BPy = b.getPy();
BVx = b.getVx();
BVy = b.getVy();
BRad = b.getRadius();
if ((BPy+BRad > Py) && (BPy+BRad < Py+BRad) && (BPx+(0.5)*BRad > Px) && (BPx-(0.5)*BRad < Px+width)){
// ball is on top of platform
BPy = Py-BRad;
BVy = -60;
}
b.setP... | 4 |
public static String decode(X509Certificate x509) {
List<String> result = new ArrayList<>();
boolean[] usage = x509.getKeyUsage();
if (usage == null) { return "<missing>"; }
for (int i = 0; i < NAMES.length; i++) {
if (i >= usage.length) break;
if (usage[i]) {
result.add(NAMES[i]);
}
}
retur... | 4 |
public void applyBackpropagation(double expectedOutput[]) {
int i = 0;
for (Neuron n : outputLayer) { // update weights for output layer
ArrayList<Connection> connections = n.getAllInConnections();
for (Connection con : connections) {
double ak = n.getOutput()... | 5 |
@RequestMapping(value = "/event-branch/{id}", method = RequestMethod.GET)
public ModelAndView eventBranchPage(
final HttpServletRequest request,
final HttpServletResponse response,
@PathVariable(value = "id") final String idStr
) throws IOException {
ModelAndView mode... | 1 |
@Override
public void run() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println(Encriptador.CifrarMensaje("Ingrese una operacion (SUMAR, RESTAR, MUL... | 6 |
public String read(String player, String element) {
String value = null;
Node players = doc.getFirstChild();
NodeList playerNode = null;
NodeList list = players.getChildNodes();
for(int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
if(player.equals(node.getNodeName()))
playerN... | 5 |
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else {
String path = file.getAbsolutePath().toLowerCase();
for (int i = 0, n = extensions.length; i < n; i++) {
String extension = extensions[i];
if ((path.endsWith(extension) && (path.charAt(path.lengt... | 4 |
public static <K> void incrementValue(TreeMap<K, Integer> map, K key) {
Integer count = map.get(key);
if (count == null) {
map.put(key, 1);
} else {
map.put(key, count + 1);
}
} | 1 |
public void setYearStored (Year y)
{
yearStored = new Year (y);
} | 0 |
public List<Schedule> getScheduleList()
{
List<Schedule> list = new ArrayList<Schedule>();
try {
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM schedule");
while(rs.next())
{
list.add(getScheduleFromRS(rs));
}
rs.close();
} catch (SQLException e) {
// TODO Auto-generat... | 2 |
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir + "ChronoTower.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) {
File imageFile = new File(Structure.baseDir + "Chro... | 8 |
public static void main(String[] args) {
try {
Manifest manifest = new Manifest(FreeCol.class.getResourceAsStream("/META-INF/MANIFEST.MF"));
Attributes attribs = manifest.getMainAttributes();
String revision = attribs.getValue("Revision");
FREECOL_REVISION = FREE... | 6 |
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] split) throws NullPointerException, ArrayIndexOutOfBoundsException {
// get basic info needed
Player player;
Boolean isPlayer;
if (sender instanceof Player) {// If it's a player, we respond differently than ... | 8 |
static final void method2267(int i, int i_0_, int i_1_, int i_2_, int i_3_,
int i_4_, int i_5_, int i_6_) {
anInt6324++;
if (i != 10499)
method2267(55, -44, 14, -122, 70, 0, 127, 112);
if ((i_0_ ^ 0xffffffff) == (i_6_ ^ 0xffffffff))
Npc.method2441(i_2_, i_6_, i_4_, -22728,
i_5_, i_3_, i_1_);... | 6 |
private void newSong() {
boolean cont = true;
if (StateMachine.isSongModified())
cont = Dialog
.showYesNoDialog("The current song has been modified!\n"
+ "Create a new song anyway?");
if (cont) {
theStaff.setSequence(new St... | 2 |
public JLabel getPlayer1Name() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer1Name() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer1Name() - END");
return m_player1Name;
} | 4 |
public final void init(InjectorClassLoader classLoader, InjectorPluginLoader loader) {
if (this.classLoader != null && this.pluginLoader != null || isEnabled()) {
return;
}
this.classLoader = classLoader;
this.pluginLoader = loader;
if (getDescriptio... | 4 |
private static int runmemsize(String[] args) {
String rstr = null;
String path = null;
for (int i = 1; i < args.length; i++) {
String arg = args[i];
if (path == null && arg.startsWith("-")) {
usage();
} else if (rstr == null) {
rstr = arg;
} else if (path == null) {
... | 7 |
public ResultSet Select(String query){
//DO NOT USE IN PRODUCTION
//This method will take a query and blindly execute it
// We'll fill this ResultSet from the query and return it. The calling code can then break it down and pop it into the target attributes
ResultSet r... | 1 |
protected static Ptg calcOdd( Ptg[] operands )
{
if( operands.length != 1 )
{
return PtgCalculator.getNAError();
}
double dd = 0.0;
try
{
dd = operands[0].getDoubleVal();
}
catch( NumberFormatException e )
{
return PtgCalculator.getValueError();
}
if( new Double( dd ).isNaN() ) // Not a ... | 5 |
public static void main(String[] args) {
char again;
int n;
do{
print("Enter the dimension of the matrix: ");
n = scan.nextInt();
double[][] matrix = new double[n][n];
print("\nEnter the matrix data:\n");
input(matrix);
print("The trace of the matrix is: " + trace(matrix));
print("\nContinue?... | 2 |
public boolean userNameInList(User user, ArrayList<String> friendNamesList) {
String curName = user.getName();
for (String friendName : friendNamesList) {
if (curName.equals(friendName)) {
return true;
}
}
return false;
} | 2 |
public static void updates(Year year)//update the events in the year and the displayed event
{
myYears.set(0, year);
} | 0 |
public static boolean isFileClass(String file) {
byte[] magicNumber = {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE};
try (FileInputStream input = new FileInputStream(file)) {
byte[] number = new byte[4];
if (input.read(number) != -1){
if (Arrays.equals(ma... | 4 |
protected ObjectFormatter getObjectFormatter(Field field) {
Class type = field.getType();
if (List.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) {
type = String.class;
}
if (field.isAnnotationPresent(Formatter.class)) {
Formatter formatter = fi... | 7 |
public DuplicateEntryException(Exception e, String name)
{
super(e, name);
} | 0 |
public void openBraceNoIndent() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) {
print(currentLine.length() > 0 ? " {" : "{");
println();
} else {
if (currentLine.length() > 0)
println();
println("{");
}
} | 3 |
protected void paintComponent(Graphics g) {
g.drawImage(background, 0, 0, this.width,
this.height, null);
switch (pageId) {
case MAINMENU: {
resume.draw(g);
save.draw(g);
load.draw(g);
options.draw(g);
break;
}
case OPTIONSMENU: {
audio.draw(g);
video.draw(g);
controls.draw(g);... | 6 |
public void readSensors() throws IOException{
try{
com.requestData(Communication.LATITUDE);
com.requestData(Communication.LONGITUDE);
com.requestData(Communication.HEADING);
com.requestData(Communication.ABSOLUTE_WIND);
com.requestData(Communication.OBSTACLES);
com.readMessage();
}catch(Num... | 3 |
@Override
//SimpleEntry: NextHop, Distance
public SimpleEntry<Byte, Byte> getRoute(Byte destination)
throws RouteNotFoundException {
lock.lock();
// TODO Respond whenever a route is requested.
if(destination == this.deviceID) {
lock.unlock();
return new SimpleEntry<Byte,Byte>((byte)1,(byte)0);
} else... | 7 |
static public void stop() {
setStopFlag(true);
if (mp3 != null)
mp3.stop();
mp3 = null;
if (music != null)
music.stop();
music = null;
if (musicType.equals("midi")) {
if (sequencer == null)
return;
if (sequencer.isRunning())
sequencer.stop();
if (sequencer.isOpen())
sequencer.clos... | 6 |
public List<ShopDataBean> getarticleList() throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
List<ShopDataBean> articleList = null;
ShopDataBean shopBean = null;
try{
conn = getConnection();
sql = "select cou_name,count(*) from coupon";
... | 9 |
public static int getExpressionLocByPtg( Ptg ptg, Stack expression ) throws FormulaNotFoundException
{
for( int i = 0; i < expression.size(); i++ )
{
Object o = expression.elementAt( i );
if( o == null )
{
throw new FormulaNotFoundException( "Couldn't get Ptg at: " + ptg.toString() );
}
if( o i... | 5 |
public void control(Agent[] agents, Thing[] things) {
MeView meV = new MeView();
meV.t = t;
meV.vt = vt;
meV.x = x;
meV.y = y;
meV.r = r;
meV.a = a;
meV.AMIN = AMIN;
meV.AMAX = AMAX;
meV.VTMIN = VTMIN;
meV.VTMAX = VTMAX;
meV... | 2 |
Precision(String fmt,String regex,int expectedStringLength) {
this.formatter=new SimpleDateFormat(fmt);
this.regex=regex;
this.expectedStringLength=expectedStringLength;
} | 0 |
public static void calculate(int x, int y) {
Queue<Node> cola = new LinkedList<Node>();
cola.add(new Node(x, y, 0));
for (int i = 0; i < v.length; i++) {
for (int j = 0; j < v[0].length; j++) {
v[i][j] = false;
}
}
v[x][y] = true;
dp[x][y][x][y] = 0;
while (!cola.isEmpty()) {
Node actually... | 9 |
private void cftfsub(int n, double[] a, int offa, int[] ip, int nw, double[] w) {
if (n > 8) {
if (n > 32) {
cftf1st(n, a, offa, w, nw - (n >> 2));
if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) {
... | 9 |
private static void checkUIAvailable() {
String checkUIStr = System.getProperty(CHECK_UI);
//if not in nogui mode check for a visible window
if (Boot.isHeadless() == false && (checkUIStr == null || checkUIStr.equals("true"))) {
//We need to check for a UI. Create a Timer to Check f... | 7 |
@Override
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
if (status == 0) {
out.write("<option class='" + invalClass + "' value='" + value + "'>");
} else if(status == 1) {
if (date != null) {
... | 5 |
private RealDistribution resolveDistribution(DistributionType d){
switch(d){
case BETA: return bettafishd;
case NORMAL: return normald;
case CAUCHY: return cauchyd;
case CHISQUARED: return chid;
case EXPO... | 8 |
private void getUpgrade(RobotController rc) {
if(upgradeTwo){
if (this.upgrade==NUKE) {
this.upgrade = VISION;
} else {
this.upgrade = NUKE;
}
} else {
if(rc.hasUpgrade(PICKAXE)&&rc.hasUpgrade(DEFUSION)&&rc.hasUpgrade(FUSION... | 9 |
public void findAllPairsShortestPath() throws IOException {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFileName)));
PrintWriter log = new PrintWriter(new BufferedWriter(new FileWriter(logFileName)));
for(Map.Entry<Character,Position> s : nodes.entrySet()) {
for(Map.Entry<Ch... | 3 |
public static Role findByName(String name) {
for (Role role : values()) {
if (name.equalsIgnoreCase(role.name())) {
return role;
}
}
return null;
} | 2 |
@Override
public boolean createTable(String query) {
Statement statement = null;
try {
this.connection = this.open();
if (query.equals("") || query == null) {
this.writeError("SQL query empty: createTable(" + query + ")", true);
return false;
}
statement = connection.createStatement();
... | 4 |
@Test
public void testConvertToDataNode() throws FileNotFoundException {
try {
InputStream inputStream = new FileInputStream(new File("xml/example.xml"));
NodeList nodes = source.getXMLNodes(inputStream);
Node parent = nodes.item(0);
NodeList realList = parent.getChildNodes();
for (int i = 0; i < rea... | 6 |
@Override
public List<AdminCol> getColSrchList(String tblNm) {
log.debug("get column search list for table = " + tblNm);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminCol> list = new ArrayList<AdminCol>();
StringBuilder sql = new StringBuilder();
sql.a... | 8 |
public boolean goToHunter(List ants) {
Iterator<Ant> antsIterator = ants.iterator();
boolean advanceX, advanceY;
int velocityY = 1, velocityX = 1;
Ant target=null;
while (antsIterator.hasNext()) {
Ant ant = antsIterator.next();
if(target==null &&distance(this.getX_position(), ant.getX(), this.getY_posit... | 8 |
private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req, String ip) {
String uri = req.getUri();
FullHttpResponse resp = null;
if (uri.equalsIgnoreCase(STATUS)) {
ManagerDB.addOrUpdateRequestAmount(ip, dateFormat.format(new Date()));
ServerStatus.add... | 6 |
protected void print() {
for (int i = 0; i < mLocalMem.size(); i++) {
System.out.println("i: " + i);
if (mLocalMem.get(i).getDescription() != null) {
System.out.println(mLocalMem.get(i).getDescription());
}
if (mLocalMem.get(i).getFromDateTime() != null) {
System.out.println(mLocalMem.get(i).getFr... | 7 |
public int eventOnNoExplore(int noExploreCounter, int idealLeashLength, int randomNumber) throws ExploringControlException {
double noExploreCounterD = (double) noExploreCounter;
double minLeashLenght = 4;
if (noExploreCounter < 0 || noExploreCounter > 10) { // test for good leashlenght
... | 8 |
public AnimationField(Color bg, Animation init, String fieldTitle) {
if (fieldTitle == null) {
fieldTitle = "";
}
if (init == null) {
init = Animation.ORIGINAL;
}
if (bg == null) {
bg = Color.WHITE;
}
create(bg, init, fieldTi... | 3 |
public void draw(Graphics g) {
int i;
for (i = 0; i != 5; i++) {
setVoltageColor(g, volts[i]);
drawThickLine(g, ptEnds[i], ptCoil[i]);
}
for (i = 0; i != 4; i++) {
if (i == 1) {
continue;
}
setPowerColor(g, curre... | 7 |
public static String getAppropriateCode(Environmental E, Environmental RorM, List classes, List list)
{
if(CMLib.flags().isCataloged(E))
return "CATALOG-"+E.Name();
else
if(list.contains(E))
return ""+E;
else
if(((RorM instanceof Room)&&(((Room)RorM).isHere(E)))
||((RorM instanceof MOB)&&(((MOB)RorM)... | 7 |
private boolean r_shortv() {
int v_1;
// (, line 49
// or, line 51
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 50
if (!(out_grouping_... | 8 |
public void setBirth(String birth) {
Birth = birth;
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE>... | 8 |
protected void prepareCanvas(int[] bits){
for(int i = 0; i < bits.length; i++){
bits[i] = GUIStandarts.backgroundColor;
}
} | 1 |
private String _smsc_read_url(String url) {
String line = "", real_url = url;
String[] param = {};
boolean is_post = (SMSC_POST || url.length() > 2000);
if (is_post) {
param = url.split("\\?",2);
real_url = param[0];
}
try {
URL u = ... | 6 |
@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 Settings)) {
return false;
}
Settings other = (Settings) object;
if ((this.id == null && other.id != null) || (... | 5 |
private void seriesTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_seriesTableKeyPressed
Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "seriesTableKeyPressed");
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
evt.consume();
alb... | 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 look and feel.
* For details see http://down... | 6 |
@Override
public void deserialize(Buffer buf) {
presetId = buf.readByte();
if (presetId < 0)
throw new RuntimeException("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0");
position = buf.readUByte();
if (position <... | 4 |
@Override
public synchronized void finalize() {
try {
try {
closeDocument();
} catch (RemoteException ex) {
/* Nothing */
} catch (FileNotFoundException ex) {
/* Nothing */
} catch (MalformedURLException e) {
... | 9 |
public void setInsets(Insets insets) {
if (insets != null) {
mInsets.set(insets.top, insets.left, insets.bottom, insets.right);
} else {
mInsets.set(0, 0, 0, 0);
}
} | 1 |
public String eqMember(String membername, String desc, int index) {
MemberrefInfo minfo = (MemberrefInfo)getItem(index);
NameAndTypeInfo ntinfo
= (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex);
if (getUtf8Info(ntinfo.memberName).equals(membername)
&& getUtf8Info(nti... | 2 |
public boolean move(double newBearing) {
// if the newBearing is -1, then leave it on the ground
if ((bearing == -1 && newBearing == -1))
return true;
// see if it's a legal move
if (!isLegalMove(newBearing)) {
return false;
}
// this allows bearing to be equal to 360, in which case we treat it ... | 7 |
private void readLuminance() {
int type = sourceImage.getType();
if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) {
int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null);
for (int i = 0; i < picsize; i++) {
int p = pixels[i];
int r ... | 9 |
public static boolean isPowerProviderOrWire(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4)
{
int var5 = par0IBlockAccess.getBlockId(par1, par2, par3);
if (var5 == Block.redstoneWire.blockID)
{
return true;
}
else if (var5 == 0)
{
... | 7 |
public int IndexOfByKMP(String q, String D) {
int m = q.length();
int n = D.length();
// get special cases out of the way
if (m == 0) { return 0; }
if (m > n) { return -1; }
LongestEquifix equiSolver = new LongestEquifix();
// E[i] holds the length of the longes... | 9 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = new String();
int i;
i = sc.nextInt();
while (i > 0) {
str = sc.next();
String rnp = new String();
int len = str.length();
Stack<Character> stk = new Stack<Character>();
char c;
for (int k = 0; k... | 9 |
public final void currVote() {
Date today = new Date();
Calendar cal = new GregorianCalendar();
cal.setTime(today);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 1);
List<VoteData>... | 3 |
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 boolean addRecord(Record record){
for(Record r:table){
if(r.getUsername().compareToIgnoreCase(record.getUsername())==0){
return false;
}
}
return table.add(record);
} | 2 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
String[] list = null;
try {
list = plugin.getUtilities().getWarpList(sender);
} catch (SQLException e) {
e.pri... | 3 |
public void splash(GraphicsEngine g) throws JavaLayerException{
StdDraw.setXscale(0.0, 610); //Set scale to 500
StdDraw.setYscale(0.0, 610); //Set scale to 500
while(true){
String file = "splash/splashscreen.jpg";
//String shoot = "Portal2_sfx_portal_gun_fire_blue.mp3";
FileInputStream welcome = null;
... | 9 |
@Override
protected void loopImpl(ServerSocket listener) throws Exception {
Socket socket = null;
try {
socket = listener.accept();
} catch(SocketTimeoutException e) {
// No-Op
}
try {
if(socket != null) {
logger.info("Socket recieved.");
InputStream iStream = socket.getInputStream();... | 5 |
public SubProcess getNextSubProcess(State state) {
if (state == null) return null;
reSortSubProcesses();
SubProcess sp = state.getSubProcess();
if (sp == null
|| !this.subProcesses.contains(sp)
|| this.subProcesses.indexOf(sp) >= this.subProcesses.size() - 1) return null;
return this.subProcesses.get(... | 4 |
public ProfileEntry checkAvailability(int reqPE, double startTime,
long duration) {
Iterator<ProfileEntry> it = avail.itValuesFromPrec(startTime);
if (!it.hasNext()) {
return null;
}
PERangeList intersec = it.next().getAvailRanges().clone();
double finishTime = startTime + duration;
... | 5 |
private static String myCrypt(String password, String seed) throws RuntimeException {
String out = null;
int count = 8;
MessageDigest digester;
// Check for correct Seed
if (!seed.substring(0, 3).equals("$H$")) {
// Oh noes! Generate a seed and continue.
byte[] randomBytes = new byte[6];
java.util.R... | 6 |
@Override
public boolean equals(Object o) {
if (o == null) { // fast fail
return false;
}
if ((o == this) || (o == payload)) { // fast success
return true;
}
if (!(o instanceof CachedValue)) { // cope with non-cached values
return o.equals(payload);
}
return ((CachedValue... | 4 |
private void checkForPrompt()
{
// Text has been entered, remove the prompt
if (document.getLength() > 0)
{
setVisible( false );
return;
}
// Prompt has already been shown once, remove it
if (showPromptOnce && focusLost > 0)
{
... | 8 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Ball other = (Ball) obj;
if (this.color != other.color) {
return false;
}
if (this.coords != other.coor... | 6 |
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 |
public final List<Answer> getAnswers()
{
final Random rand = new Random();
final Answer[] ans = new Answer[this.answers.length];
boolean hasBottom = false;
for (final Answer a : this.answers)
{
if (a.dispStr.equals(Card_Question.BOTTOM_ANSWER))
{
hasBottom = true;
}
}
for (final Answer a :... | 9 |
public void provideCapacity(final int capacity) {
if (c.length >= capacity) {
return;
}
int newcapacity = ((capacity * 3) >> 1) + 1;
char[] newc = new char[newcapacity];
System.arraycopy(c, 0, newc, 0, length);
c = newc;
} | 1 |
public void init()
{
boolean debug = CommandLine.booleanVariable("debug");
if (debug)
{
// Enable debug logging
Logger logger = Logger.getLogger("com.reuters.rfa");
logger.setLevel(Level.FINE);
Handler[] handlers = logger.getHandlers();
... | 6 |
protected String unFilterString(String str)
{
final StringBuffer buf=new StringBuffer(str);
for(int i=0;i<buf.length()-1;i++)
if(buf.charAt(i)=='\\')
switch(buf.charAt(i+1))
{
case '\\':
buf.deleteCharAt(i);
break;
case 't':
buf.deleteCharAt(i);
buf.setCharAt(i,'\t');
break;
ca... | 7 |
public boolean jsFunction_waitStartProgress(int timeout) {
deprecated();
int curr = 0; if(timeout == 0) timeout = 10000;
while(!JSBotUtils.hourGlass)
{
if(curr > timeout)
return false;
Sleep(25);
curr += 25;
}
return true;
} | 3 |
public List<User> getInitialUserForSecondActivityCluster(List<FirstActivityCluster> facList,
List<SleepingCluster> scList, List<User> allUserList) {
List<User> returnUserList = new ArrayList<>();
for (SleepingCluster sc : scList) {
for (User user : allUserList) {
... | 8 |
public SudokuGame(){
File f = new File("Sudoku.sudoku");
Scanner sc = null;
try{
sc = new Scanner(f);
}
catch (FileNotFoundException e){
e.printStackTrace();
System.out.println("File doesn't exist");
System.exit(1);
}
Color c = Color.BLACK;
for (int i=0;i<9;i++){
for (int j=0;j<9;j++){
... | 8 |
private void generateSongStructure(File songsDirectory) {
songList.getItems().clear();
for(File songFolder : songsDirectory.listFiles()) {
//Check that only directories are processed
if(songFolder.isDirectory() || songFolder.listFiles() == null) {
if(!songFolder.can... | 9 |
private void computeNext() {
int i = k - 1;
int j = k;
// find smallest j > k - 1 where a[j] > a[k - 1]
while (j < n && a[i] >= a[j]) {
++j;
}
if (j < n) {
swap(i, j);
} else {
reverseRightOf(i);
// i = (k - 1) - 1
... | 8 |
@Override
public void paintIcon(Component c, Graphics g, int x, int y)
{
if (axis == Axis.X_AXIS)
{
int height = getIconHeight();
for (Icon icon : icons)
{
int iconY = getOffset(height, icon.getIconHeight(), alignmentY);
icon.paintIcon(c, g, x, y + iconY);
x += icon.getIconWid... | 5 |
public GnuNeutron (String computer_algorithme)
{
autodisplay = true;
display = 1;
computerColour = NeutronBoard.BLACK;
playerName = "";
ponder = true;
nb = new NeutronBoard ();
if (computer_algorithme.equals("random"))
{
cp = new ComputerPlayerRandom ();
}
else if (compute... | 5 |
private void doPrint(String aInText, Throwable aInT)
{
switch (this)
{
case WARN:
case ERROR:
case DEATH:
if (null == stream)
{
System.err.println(aInText);
if (null != aInT)
... | 9 |
public void resetPlplayer()
{
start = false;
if (P1character.equals("White"))
{
whiteKnight.reset(100,450,true);
}
else if (P1character.equals("Bond"))
{
jamesBond.reset(100,450,true);
}
else if (P1character.equals("Ninja"))
... | 4 |
public Song(String filePath) {
measures = new ArrayList<Measure>();
titleCards = new ArrayList<String>();
try {
BufferedReader in = new BufferedReader(new FileReader(filePath));
String line = null;
while ((line = in.readLine()) != null) {
if (line.length() > 0) {
switch(line.charAt(0)) {... | 8 |
public int getMove(int place1,int place2) {
if (System.currentTimeMillis() - c.lastSpear < 4000)
return 0;
if ((place1 - place2) == 0) {
return 0;
} else if ((place1 - place2) < 0) {
return 1;
} else if ((place1 - place2) > 0) {
return -1;
}
return 0;
} | 4 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.