text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void testCorrectness(boolean isBWT)
{
System.out.println("\nBWT"+(!isBWT?"S":"")+" Correctness test");
// Test behavior
for (int ii=1; ii<=20; ii++)
{
System.out.println("\nTest "+ii);
int start = 0;
byte[] buf1;
Random r... | 9 |
public static int maximun(int ar[]) {
int max = ar[0];
System.out.print("Array Is :\t");
System.out.print(ar[0] + " ");
for (int i = 1; i < ar.length; i++) {
System.out.print(ar[i] + " ");
if (max < ar[i]) {
max = ar[i];
}
}
System.out.println();
return max;
} | 2 |
public Type getSuperType() {
if (elementType instanceof IntegerType)
return tRange(tObject, this);
else
return tRange(tObject,
(ReferenceType) tArray(elementType.getSuperType()));
} | 1 |
private Scenery[][] loadRandomMap(GameMap g, int multiplier, int xOfMap, int yOfMap,
int levelsDeep, TextDisplay textDisplay) throws Exception {
String path = PATH_TO_MAPS;
if (notSpawnedPlayerCount > 2) {
path += "PlayerMaps" + File.separator;
initPlayerMaps();
} else {
initMapLoade... | 5 |
public Response serve( String uri, String method, Properties header, Properties parms, String data )
{
try{
String response_string=null;
if(data!=null){
System.out.println(DateFormat.getTimeInstance(DateFormat.FULL).format(Calendar.getInstance().getTime()));
System.out.println("Command: " + data);
... | 8 |
@Override
public boolean equals(Object obj) {
if(!(obj instanceof Anime)) {
return false;
}
Anime anime = (Anime)obj;
return (anime.episodes == episodes && anime.id == id &&
anime.score == score && anime.title.equals(title) &&
an... | 8 |
public Loop(List<String> identifiers, List<String> values) {
this.rows = new ArrayList<Map<String,String>>();
int identSize = identifiers.size();
// TODO check that the identifiers are unique
int valIndex = 0;
// don't want to loop endlessly if there's no keys
if(identSize == 0 && values.size() > 0) {
th... | 6 |
@SuppressWarnings("unchecked")
public E previous() {
if (nextIndex == 0) {
throw new NoSuchElementException();
}
if(next != null) {
lastReturned = next = next.previous;
} else {
lastReturned = next = tail.previous; // index > 0 => not tail is not head.
}
nextIndex--;
checkForComodific... | 2 |
public void imprimirRelatorio(int argumento1,int argumento2, String nomedorelatorio, String nomedocampoparaarguemntacao, String nomedegravacaodorelatorio) throws IOException, JRException, ClassNotFoundException, Exception {
ServletOutputStream servletOutputStream;
File arquivoGerado;
System.out.... | 5 |
public Integer getBiggestBorrower() {
Integer id = -1;
Integer max = 0;
Map<Integer, Integer> total = new HashMap<Integer, Integer>();
for (Integer stockId : this.stock.keySet()) {
Map<Integer, Integer> currentStock = stock.get(stockId)
.getBookingTotals(... | 8 |
@Override
public void setEntityValue(ResultSet rs, int index, Object entity) throws Exception {
Field f = getField();
Integer ordinal = rs.getInt(index);
Enum<?> value = null;
if(ordinal == null) {
getField().set(entity, value);
return;
}
@SuppressWarnings("unchecked")
Class<? extends Enum... | 9 |
private String getExpression(int index) throws SyntaxErrorException {
int c = 1;
for (int j = index + 1; j < expression.length(); j++) {
char s = expression.charAt(j);
if (s == '(')
c++;
if (s == ')')
c--;
currentPosition = j;
if (c == 0)
return expression.substring(index + 1, j);
}
t... | 4 |
public List<String> getDescription() {
if (description == null) {
description = new ArrayList<String>();
}
return description;
} | 1 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int n = 0;
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
char[] a = lin... | 9 |
private void draw() {
double size = getWidth() < getHeight() ? getWidth() : getHeight();
canvas.setWidth(size);
canvas.setHeight(size);
ctx.clearRect(0, 0, size, size);
if (isFrameVisible()) { //frame
Paint frame = new LinearGradient(0.14 * size, 0.14 * size,
... | 3 |
public void rollback() throws DatabaseManagerException {
try {
if( conn == null || conn.isClosed() || conn.getAutoCommit() == true ) {
throw new IllegalStateException("Transaction not valid for commit operation.");
}
conn.rollback();
} catch(SQLException e) {
throw new DatabaseManagerException("Err... | 4 |
public void resolveCollision(Sprite collidee)
{
// The normal is a unit vector along the line between the sprites.
Vector2d normal = collidee.getPosition().minus(getPosition());
normal.setMagnitude(1);
Vector2d relativeVelocity = collidee.getVelocity().minus(getVelocity());
... | 1 |
@Override
public void processGameEvent(GameEvent e) {
if(e instanceof TimerEvent)
return;
if(e instanceof InternalGameEvent)
return;
if(e instanceof GameStartEvent)
synchronized(this) { notify(); }
else if(e instanceof GameEndEvent) {
out.println(e.getUpdateStrin... | 9 |
public HierarchicalClustering(int link, Instances data) {
if (link == 0)
this.link = new CompleteLink();
else if (link == 1)
this.link = new SingleLink();
else
this.link = new AverageLink();
this.instances = data;
} | 2 |
public NodeBuilder<?,?> addChildNode(Class<CallableData<?,?>> clazz, Initializer<? extends CallableData<T,E>> initializer){
NodeBuilder<?,?> node = new NodeBuilder(clazz,initializer,root);
local.getNext().add(node.getLocal());
return node;
} | 7 |
public void invoke(T entity, EntityProperty entityProperty, Cell cell) {
try {
Method method = entityProperty.getPropertyDescriptor().getWriteMethod();
switch (entityProperty.getColumnType()) {
case TEXT:
method.invoke(entity, cell.getStr());
... | 4 |
public PayloadSubjectExceptionData(Node exception) {
if(exception == null) {
throw new IllegalArgumentException("Node not specified.");
}
if(!exception.getLocalName().equals("PayloadSubjectException")) {
throw new IllegalArgumentException("Unknown node \'" + exception.getNodeName() + "\', expected Payloa... | 2 |
protected AnnotatedHandlerBuilder<Field> handleField()
{
return wrapped.handleField();
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 9 |
@Override
public void setHouseNumber(String houseNumber) {
super.setHouseNumber(houseNumber);
} | 0 |
public static synchronized void monitorBalance() {
int b = myValue;
if (b != 1) {
System.out.println("Balance change: " + b);
System.exit(1);
}
} | 1 |
private static void printSummary() {
GlobalOptions.err.println();
if (failedClasses.size() > 0) {
GlobalOptions.err.println("Failed to decompile these classes:");
Enumeration enum_ = failedClasses.elements();
while (enum_.hasMoreElements()) {
GlobalOptions.err.println("\t" + enum_.nextElement());
}
... | 2 |
public static void main(String[] args) throws Exception {
LOG.info("Args: ");
int i = 0;
for (String arg : args) {
LOG.info("{}:{}", i++, arg);
}
// create Options object
Options options = new Options();
options.addOption("array_id", true, "the parame... | 4 |
public static void Spectrum(byte[] audioBytes, AudioFormat format, Vector<Line2D.Double> SpectrumData) {
SpectrumData.removeAllElements();
int h=105, w=689;
int[] audioData = null;
int nlengthInSamples = audioBytes.length/2;
audioData = new int[nlengthInSamples];
for (int i = ... | 3 |
private boolean dropTargetValidate(DropTargetEvent event, File targetFile) {
if (targetFile != null && targetFile.isDirectory()) {
if (event.detail != DND.DROP_COPY && event.detail != DND.DROP_MOVE) {
event.detail = DND.DROP_MOVE;
}
} else {
event.detail = DND.DROP_NONE;
}
return event.detail != DN... | 4 |
public boolean isFull() {
for(Park park : this.parkList) {
if(!park.isFull()) {
return false;
}
}
return true;
} | 2 |
protected void done() {
fr.setVisible(true);
if (exito && !this.isCancelled() && Vista.OS.equals("windows")){
eti.setText("Minecraft instalado con éxito en " + System.getProperty("user.home") + "\\AppData\\Roaming\\.minecraft");
bot.setVisible(true);
bot.setEnabled(tr... | 8 |
public UpcomingEventType getEventType() {
if ("HTML".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("MANAGED_OD".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("MANAGED_HTML".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("THREAD".equalsIgnoreCase(getType())... | 6 |
public static float convertTensionUnitIndexToFactor(int index) {
switch (index) {
case 0:
return NEWTON;
case 1:
return POUND_FORCE;
case 2:
return KILOGRAM_FORCE;
case 3:
return DECANEWTON;
... | 4 |
public static String toString(JSONObject jo) throws JSONException {
boolean b = false;
Iterator<String> keys = jo.keys();
String string;
StringBuilder sb = new StringBuilder();
while (keys.hasNext()) {
string = keys.next();
if (!jo.isNull(string)) {
... | 3 |
protected void close() {
if(!statusSent) status(500); // Internal server error
if(!headersSent) completeHeaders();
try {
connection.shutdownOutput();
connection.close();
} catch (IOException e) { e.printStackTrace(); }
} | 3 |
static final public void simpleExpr() throws ParseException {
terme();
label_8:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OU:
case ADD:
case SUBNEG:
;
break;
default:
jj_la1[18] = jj_gen;
break label_8;
}
opAdd();
... | 5 |
public static Player Load()
{ //loads the character's file (plaintext)
Scanner Input = new Scanner(System.in);
Player player;
Player decoy = new Player();
String strFile;
String charName;
int[] stats = new int[9];
String cmd="";
System.out.println("Enter ... | 4 |
public static synchronized void open(File file) {
if (PASS_THROUGH) {
OpenDataFileCommand opener = new OpenDataFileCommand(file);
if (!SwingUtilities.isEventDispatchThread()) {
EventQueue.invokeLater(opener);
} else {
opener.run();
}
} else {
if (PENDING_FILES == null) {
PENDING_FILES = n... | 3 |
public String getColumnData(int i) throws Exception {
if (i == 0)
return getPersonID();
else if (i == 1)
return getName();
else if (i == 2)
return getProjectID();
else if (i == 3)
return getRole();
else
throw new Exception("Error: invalid column index in courselist table");... | 4 |
void menuOpenFile() {
animate = false; // stop any animation in progress
// Get the user to choose an image file.
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
if (lastPath != null)
fileChooser.setFilterPath(lastPath);
fileChooser.setFilterExtensions(OPEN_FILTER_EXTENSIONS);
fileChooser.se... | 9 |
@SuppressWarnings("rawtypes")
private BeanDefinition createProxyBeanDefinition(String serviceName,
Class serviceInterface, Exposer exposer) {
// HTTP http://host:port/contextPath/serviceName
String httpServiceUrl = new StringBuilder(HTTP_PROTOCOL)
.append(getHost()).append(":").append(getHttpPort())
.a... | 9 |
void run(){
Scanner sc = new Scanner(System.in);
dp = new int[30][51][6];
for(;;){
C = sc.nextInt(); D = sc.nextInt(); W = sc.nextInt(); X = sc.nextInt();
if((C|D|W|X)==0)break;
E = new int[C][D]; F = new int[C][D];
for(int i=0;i<C;i++)for(int j=0;j<D;j++)E[i][j]=sc.nextInt();
for(int i=0;i<C;i++)f... | 9 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public MiniXMLToken getToken() {
MiniXMLToken oMiniXMLToken = new MiniXMLToken();
oMiniXMLToken.setType(tError);
if (!bInsideTag)
return getTokenOutsideTag(oMiniXMLToken);
else
return getTokenInsideTag(oMiniXMLToken);
} | 1 |
private void checkVarDeclaration() throws Exception {
if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.ID) {
// missing identificator
throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() +
": Expected identificator and got \"" + tokenList.get(... | 4 |
public void acceptClusterer(BatchClustererEvent ce) {
if (ce.getTestSet() == null ||
ce.getTestOrTrain() == BatchClustererEvent.TEST ||
ce.getTestSet().isStructureOnly()) {
return;
}
Instances trainHeader = new Instances(ce.getTestSet().getDataSet(), 0);
String titleString = ce.g... | 8 |
public static ArrayList<Kill> compairEntityKill(ArrayList<Kill> Kills,
String name) {
ArrayList<Kill> output = new ArrayList<Kill>();
for (Kill k : Kills) {
if (k.getAttackers().size() != 0) {
for (ShipAndChar attacker : k.getAttackers()) {
if (attacker.getPilot().findAttribute(name)) {
output... | 4 |
public static void clearEditableText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
clearEditableForSingleNode(currentNode, undoable);
if (!undoable.isEmpty()) {
undoable.setName("Clear Editability for Node");
... | 1 |
public int queueLengthRec(){
if (nextPatient == null){
return 1;
}
int count = nextPatient.queueLengthRec() + 1;
return count;
} | 1 |
public static Const constant(int value) {
switch(value) {
case 0: return C0;
case 1: return C1;
case 2: return C2;
}
return new Const(value);
} | 3 |
public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... | 7 |
public FrameAddArraysData(){
super("Arrays Editor");
initialize();
} | 0 |
public static int parseInt(String s, int offset, int length, int base)
throws NumberFormatException
{
int value=0;
if (length<0)
length=s.length()-offset;
for (int i=0;i<length;i++)
{
char c=s.charAt(offset+i);
int digit=c-'0... | 9 |
public void moveElement(Element element, Direction direction) {
if (element == null || direction == null)
throw new IllegalArgumentException("The given parameters are invalid!");
if (!canMoveElement(element, direction))
throw new IllegalArgumentException("This element can't move in the given direction!");
... | 7 |
public void setSelectedItem(Object element) {
if (element == null) {
if (elementIndex != -1) {
elementIndex = -1;
fireContentsChanged(this, -1, -1);
}
} else if (element instanceof String) {
int index = 0;
for (DBElement e :... | 6 |
public synchronized void tick() {
if (unchoked.size() == maxUnchoked && interested.size() > maxUnchoked) {
long now = System.currentTimeMillis();
Peer slowest = null;
for (Map.Entry<Peer, Long> e : unchoked.entrySet()) {
if (now - e.getValue() > 10000) {
... | 7 |
public void setPasswordfieldDownshift(int shift) {
if (shift < 0) {
this.passwordfieldDownshift = UIShiftInits.PWAREA_DOWN.getShift();
} else {
this.passwordfieldDownshift = shift;
}
} | 1 |
private double calcValue(double point) {
double value = 0;
for (int i = 0; i < equationCoef.length; i++) {
if (equationPower[i] != 0) {
value = value + equationCoef[i] * Math.pow(point, equationPower[i]);
} else {
value = value + equationCoef[i];
... | 2 |
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
if (key == null) {
key = new LongWritable();
}
key.set(pos);
if (value == null) {
value = new Text();
}
value.clear();
final Text endline = new Text("\n"... | 7 |
public static void quit() {
if (loggingEnabled)
handler.close();
} | 1 |
public static AuthorizationToken generateToken(String controller, String type, String id, String passcode) {
if (type.equals(ComponentTypes.Authorization.NONE_FALSE.name())) {
return new AuthorizationToken(controller, ComponentTypes.Authorization.NONE_FALSE);
}
else if (type.equals(ComponentTypes.Authorization... | 6 |
public void saveIssueFired(ActionEvent event) {
final ObservableIssue ref = getSelectedIssue();
final Issue edited = new DetailsData();
SaveState saveState = computeSaveState(edited, ref);
if (saveState == SaveState.UNSAVED) {
model.saveIssue(ref.getId(), edited.getStatus(),
... | 2 |
@Override
public Map<Course, Integer> getMarks(int userId) throws SQLException {
Map<Course, Integer> courseMark = new HashMap<>();
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connec... | 5 |
public Quester(String[] questerInfoInString, Player player) {
//this.plugin = plugin;
this.theQuestersName = player.getName();
this.questID = Integer.parseInt(questerInfoInString[0]);
this.questsCompleted = Integer.parseInt(questerInfoInString[1]);
this.moneyEarnedFromQuests = Integer.parseInt(questerInfoI... | 2 |
public boolean isNearTree(Coordinate coord) {
ElementType to;
for (int i = 0; i < 4; i++) {
Coordinate coordTemp = coord.copy();
switch (i) {
case 0:
coordTemp.moveNorth();
break;
case 1:
coordTemp.moveEast(dimension);
break;
case 2:
coordTemp.moveSouth(dimension);
break;
... | 6 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} | 2 |
public LayerMatcher(Layer layer)
{
// match 1 = tagname
// match 2 = id
// match 3 = attributes
String layerRegex = "^(<[a-z^>]*>)?([A-z\\-\\_]*)?(\\[.*\\])?$";
String layerName = layer.toString();
Pattern p = Pattern.compile(layerRegex);
Matcher m = p.matcher(layerName);
if(m.matches()) {
// g... | 6 |
public static synchronized Config getInstance() {
if (instance == null) {
instance = new Config();
}
return instance;
} | 1 |
public static void main(String[] args) throws IOException {
String s;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Integer t = new Integer(br.readLine());
for(int i=0;i<t;i++){
s = br.readLine();
if(s.length()>3){
Syste... | 8 |
public boolean _setMapCanvas(GenericCanvas mapcanvas)
{
if(mapcanvas != null)
{
this.mapcanvas = mapcanvas;
return true;
}
else
{
return false;
}
} | 1 |
public void reserve() {
if (this.capacity - this.length < JSONzip.substringLimit) {
int from = 0;
int to = 0;
this.root = new Node();
while (from < this.capacity) {
if (this.uses[from] > 1) {
Kim kim = this.kims[from];
... | 6 |
public ArrayList<Pizza> haeMyydyimmat() throws DAOPoikkeus {
// Hakee etusivulle tiedot kolmesta myydyimmästä pizzasta.
TilastointiDAO tilasto = new TilastointiDAO();
ArrayList<Toppizzat> pizzatop = tilasto.haeToppizzat();
TuoteDAO tDao = new TuoteDAO();
Pizza pizza = new Pizza();
ArrayList<Pizza> myy... | 1 |
@Override
public void setCourseName(String courseName) {
if(courseName == null || courseName.length() == 0) {
JOptionPane.showMessageDialog(null,
"Error: courseName cannot be null of empty string");
System.exit(0);
}
this.courseName = courseName;
... | 2 |
public static void main(String args[]) throws Exception
{
final int TOP = 200;
String outputPath = "C:/z-ling/task/HEY/ResultTest/HamTopSim_"+TOP+".txt";
FileOutputStream fos=new FileOutputStream(outputPath);
OutputStreamWriter osw=new OutputStreamWriter(fos);
Buffer... | 6 |
public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
this.put(key, value);
}
return this;
} | 2 |
public Button loadButton(Location loca) {
String wName = loca.getWorld().getName();
String saveLoc = Utils.convertLoc(loca);
Button button = new Button();
buttonConfig = new Configuration(new File(configDir + File.separator + "buttons" + File.separator + wName + File.separator + saveLoc + ".yml"));
File finde... | 5 |
protected void processMouseWheelEvent(MouseWheelEvent e) {
if (hasFocus()) {
int code = InputManager.MOUSE_WHEEL_DOWN;
if (e.getWheelRotation() < 0) {
code = InputManager.MOUSE_WHEEL_UP;
}
mapGameAction(code, true);
}
e.cons... | 2 |
public static int deleteMstxRecommend(int mid) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("delete from mstx_recommend where mid=?");
pstmt.setInt(1, mid);
result = pstmt.executeUpdate();
} catch (Exception e) {
e.pr... | 5 |
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int[] rgb = new int[3];
int ladoCuadrado;
int ladoMax = 200,
ladoMin = 100;
boolean rgbValido = true;
do System.out.print("Dame el lado del cuadrado [100, 200]: ");
while((ladoCuadrado = teclado.nextInt()) < ladoMin |... | 6 |
public SortedList quicksort(ListNode head) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if(head==null || head.next==null) return new SortedList(head, head);
ListNode lHead = null;
ListNode... | 9 |
private void spawnFruit() {
//Reset the score for this fruit to 100.
this.nextFruitScore = 100;
/*
* Get a random index based on the number of free spaces left on the board.
*/
int index = random.nextInt(BoardPanel.COL_COUNT * BoardPanel.ROW_COUNT - snake.size());
/*
* While we could just as easi... | 5 |
@Override
public ParseResult<T, A> parse(LList<T> tokens) {
ParseResult<T,A> r = this.parser.parse(tokens);
if(!r.isSuccess()) {
// parser failed -> fail
return r;
} else if(this.pred.apply(r.getValue())) {
// result is present and predicate passes -> pass
return r;
} else {
// result is present... | 2 |
public void run(){
} | 0 |
public Tile(int x, int y, int tilesize, Sprite sprite){
this.x = x;
this.y = y;
this.dX = 0;
this.dY = 0;
this.dir = 1;
this.tilesize = tilesize;
this.sprite = sprite;
this.crect = new Rectangle(x,y,tilesize,tilesize);
if (sprite != null) {
this.id = sprite.getId();
if (this.id > 0 && this.id <=... | 5 |
public int read(CharBuffer cb) {
if (count-- == 0)
return -1;
String result = Double.toString(next()) + " ";
cb.append(result);
return result.length();
} | 1 |
@Override
public void setBoilerState(int boilerState) {
this.boilerState = boilerState;
} | 0 |
public void translateDemands(int period, Conversion cons) {
//
// Firstly, we check to see if the output good is in demand, and if so,
// reset demand for the raw materials-
final float demand = shortageOf(cons.out.type) ;
if (verbose) I.sayAbout(venue, "Demand for "+cons.out.type+" is: "+demand) ... | 4 |
public static SingleItem getItem(int id) {
String input = null;
try {
input = Untils.readPage(new URL(SINGLE_ITEM + id));
} catch (MalformedURLException e) {
e.printStackTrace();
}
HashMap<String, Object> parse = Parser.parse(input);
if (parse.get("name") == null)
return null;
parse = Parser.... | 2 |
@Override
public void writeBuffer(ReceiveBuffer wbuf) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
if(wbuf.length() >=4 && wbuf.charAt(0)=='M' && wbuf.charAt(1)=='1' &&wbuf.charAt(2)=='0' &&wbuf.charAt(3)=='5' ){
isM105=true;
}
sendbuf.put(wbuf.array,0,wbuf.length());
isSend=true... | 7 |
private void testData() {
if ((useKNN() && knn != null) || (!useKNN() && gaussian != null)) {
int c = 1;
int numClasses = getNumTestClasses();
int[][] confusionMatrix = new int[numClasses][numClasses];
while (classHasFiles(String.format("c:/ordata/test-%s",testTextField.getText()), String.format("%d",c)))... | 8 |
public static void main( String[] args ) throws Exception
{
TestingHelper.CONFIG.read();
OptionManager.initialize( TestingHelper.CONFIG ); // initialize options from config file
OptionManager.initialize( args ); // initialize options from commandline (override the config file)
Optio... | 9 |
@EventHandler
public void WitherSpeed(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.getZombieConfig().getDouble("Wither.Speed.Dod... | 7 |
protected void onDeVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} | 0 |
private boolean setCoordinates(int r, int c) {
// If the coordinates are not already set
if (!areCoordinatesSet()) {
// Ensure valid coordinates
if (!validCoordinates(r, c)) {
throw new IllegalArgumentExcep... | 2 |
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getBarDateTime() != null) {
_hashCode += getBarDateTime().hashCode();
}
if (getOpen() != null) {
_hashCode += g... | 7 |
public void render(Graphics g){
g.setColor(Color.BLACK);
int size = display.frame.getHeight() / 12;
int xOff = (display.frame.getWidth() - size * 9) / 2;
int yOff = (display.frame.getHeight() - size * 9) / 4;
for(int x = 0; x < 9; x++){
for(int y = 0; y < 9; y++){
if(board.get(x).get(y) != 0){
if(... | 6 |
public String getIP() {
return clientIP;
} | 0 |
public void start() {
try {
this.createWindow();
try {
Keyboard.create();
Mouse.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
this.postInit();
while (!Display.isCloseRequested()) {
Display.update();
this.getCamera().input();
this.input();
if(this.isHa... | 7 |
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.