text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean toggleInitWithMouse(MouseEvent mouse) {
Tool tool = GUI.controls.getTool();
Object o = getObject(mouseGetX(mouse), mouseGetY(mouse), tool);
if (o == null)
return false;
if (o instanceof RandomInit) {
((RandomInit) o).toggleInitial();
ret... | 4 |
public static boolean getBooleanProperty(Properties properties, Object key) {
String string = (String)properties.get(key);
if(string == null) {
System.err.println("WARN: couldn't find boolean value under '" +
key + "'");
return false;
}
if(string.toLowerCase().equ... | 5 |
private void loginSession(String address, int port, String username, String password) {
msgSocket = new MessageSocket(address, port);
ServiceCommands service = new ServiceCommands(msgSocket);
AccessControlCommands access = new AccessControlCommands(msgSocket);
TransferParameterCommands tra... | 2 |
public static byte[] downloadFile(String url) throws IOException {
HttpURLConnection connection = null;
InputStream inputStream = null;
try {
connection = (HttpURLConnection)new URL(url).openConnection();
connection.setDoInput(true);
connection.setRequestMetho... | 1 |
public void mu() {
System.out.println("Enter range of numbers to print their multiplication table");
a = in.nextInt();
b = in.nextInt();
for (c = a; c <= b; c++) {
System.out.println("Multiplication table of " + c);
for (d = 1; d <= 10; d++) {
System.out.println(c + "*" + d + " = " + (c * d));
}
... | 2 |
public boolean matches(InventoryCrafting var1) {
ArrayList var2 = new ArrayList(this.recipeItems);
for(int var3 = 0; var3 < 3; ++var3) {
for(int var4 = 0; var4 < 3; ++var4) {
ItemStack var5 = var1.getStackInRowAndColumn(var4, var3);
if(var5 != null) {
boolean... | 8 |
public void analyze() {
while (!toAnalyze.isEmpty()) {
Identifier ident = (Identifier) toAnalyze.iterator().next();
toAnalyze.remove(ident);
ident.analyze();
}
} | 1 |
public Turn(direction lr, int state) {
this.lr = lr;
this.state = state;
} | 0 |
@Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... | 1 |
@Override
public void initTrans() throws Exception {
try {
oConexionMySQL.setAutoCommit(false);
} catch (SQLException e) {
throw new Exception("Mysql.initTrans: Error al iniciar transacci�n: " + e.getMessage());
}
} | 1 |
public void test_other() throws Exception {
assertEquals(1, DateTimeFieldType.class.getDeclaredClasses().length);
Class cls = DateTimeFieldType.class.getDeclaredClasses()[0];
assertEquals(1, cls.getDeclaredConstructors().length);
Constructor con = cls.getDeclaredConstructors()[0];
... | 1 |
@Override
public Item generateRandomStartItem(IGameMap game) {
Item[] items = game.getStartItems().toArray(new Item[game.getStartItems().size()]);
for (int i = 0; i < items.length; i++) {
for (Item item : game.getItemsOnMap()) {
if(item.getX() != items[i].getX() && item.getY() != items[i].getY()... | 4 |
private VideoListVO addSearchMessageToVO(VideoListVO videoListVO, Locale locale, String actionMessageKey, Object[] args) {
if (StringUtils.isEmpty(actionMessageKey)) {
return videoListVO;
}
videoListVO.setSearchMessage(messageSource.getMessage(actionMessageKey, args, null, locale));... | 1 |
public Vector<Item> resourceHere(Room R, int material)
{
final Vector<Item> here=new Vector<Item>();
for(int i=0;i<R.numItems();i++)
{
final Item I2=R.getItem(i);
if((I2!=null)
&&(I2.container()==null)
&&(I2 instanceof RawMaterial)
&&(((I2.material()&RawMaterial.RESOURCE_MASK)==material)
||(((... | 7 |
synchronized Hashtable getProperties()
{
if ((props == null) && (getText() != null))
{
Hashtable props = new Hashtable();
int off = 0;
while (off < getText().length)
{
// length of the next key value pair
int len = getTe... | 9 |
public void changeColor() {
this.trackImg = trackImg1;
} | 0 |
public static void writeShape(final Shape shape,
final ObjectOutputStream stream)
throws IOException {
if (stream == null) {
throw new IllegalArgumentException("Null 'stream' argument.");
}
if (shape != null) {
stream.writeBoolea... | 9 |
public void fitToScreen() {
if (vertices.size() == 0 || canvas.getWidth() <= 0 || canvas.getHeight() <= 0) {
canvas.offX = canvas.getWidth() / 2;
canvas.offY = canvas.getHeight() / 2;
canvas.zoom = 1.0;
return;
}
double minx = vertices.get(0).getX(... | 4 |
@Override
public void paintComponent(Graphics g){
Paint paint;
Graphics2D g2d;
if (g instanceof Graphics2D) {
g2d = (Graphics2D) g;
}
else {
System.out.println("Error");
return;
}
paint = new GradientPaint(0,0, getBackground(), getWidth(), getHeight(), getForeground());
g2d.setPaint(paint);
... | 3 |
void intialiseWithInfected(int N, int initI) {
for (IndividualStateType state : allowedStates) {
if (state.equals(IndividualStateType.SUSCEPTIBLE)) {
createIndividualAgentsInState(state, (N-initI));
} else if (state.equals(IndividualStateType.INFECTED)) {
... | 3 |
public String authenticate() throws Exception {
logger.info("Authenticating to Rackspace API...");
HttpGet request = new HttpGet(API_AUTH_URL);
request.addHeader("X-Auth-User", username);
request.addHeader("X-Auth-Key", apiKey);
try{
HttpResponse respo... | 6 |
private static int sgn(int x) {
return x < 0 ? -1 : 1;
} | 1 |
public synchronized boolean moveItem(FieldItem item, Position fromPosition, Position toPosition) {
if (insideBounds(fromPosition) && insideBounds(toPosition)) {
int transcurredTime = 0;
while (getItemType(toPosition) != ' ') {
try {
long time = System.... | 6 |
public void loadFromConfig(){
try {
BufferedReader reader = new BufferedReader(new FileReader("config.txt"));
//S2 path
s2Path = reader.readLine();
if (s2Path == null)
s2Path = "";
//Developer mode
if (reader.readLine().equals("1"))
isDeveloper = true;
else
isDeveloper = false;
//a... | 6 |
protected String getTypeName(){
switch(this.eventType){
case(EVENT_MESSAGE_C):
return "Message_Client";
case(EVENT_MESSAGE):
return "Message";
case(EVENT_UPDATE_C):
return "Update_Client";
case(EVENT_UPDATE):
return "Update";
case(EVENT_DESTROY):
return "Destroy";
case(EVENT_INTE... | 7 |
public boolean solution(Node root, int sum) {
if (root == null) {
if (sum <= 0) {
return true;
} else {
return false;
}
}
termNode = root;
sum = sum - root.value;
boolean lValue = solution(root.leftChild, sum);
boolean rValue = solution(root.rightChild, sum);
if (!lValue... | 6 |
@Override
public void run(){
try (
InputStream inputStream = socket.getInputStream();
Scanner in = new Scanner(inputStream)
) {
boolean done = false;
while (!done && in.hasNextLine()) {
String line = in.nextLine();
Out... | 5 |
public BTURL2(String loc, String ...params) throws Exception {
if((params.length % 2) != 0) {
throw new Exception("Parameters should be key, value array, length is not divisible by 2");
}
String p = "";
if(params.length > 0) {
p += "?";
for (int i = 0; i < params.length; i += 2) {
if(params[i... | 5 |
@Override
public void paint(Graphics g) {
super.paint(g); // paint background
//Drawing
Font f=new Font(Font.SANS_SERIF,Font.BOLD,12);
g.setFont(f);
g.setColor(Color.WHITE);
//Get space dimensions.
//Betting bar
//Betting bar line
g.drawLine(bettingW, 0, bettingW, HEIGHT);
//Betting bar butto... | 7 |
public int[] getIntArray(String key) {
try {
if(hasKey(key))
return ((NBTReturnable<int[]>) get(key)).getValue();
return new int[]{};
} catch (ClassCastException e) {
return new int[]{};
}
} | 2 |
public void renderGradientQuad(float x, float y, float width, float height, ColorHelper color, SideHelper... sides) {
for (SideHelper side : sides) {
switch (side) {
case TOP:
gradientTop.setOverwriteColor(color);
bindMaterial(gradientTop);
... | 5 |
synchronized public Color[][] getColorTab(boolean withPiece) {
if (!withPiece) {
return super.getColorTab();
} else {
Color[][] tab = super.getColorTab();
TetrisShape shape = (TetrisShape) getCurrentPiece().getShape(getCurrentPiece().getCurrentRotation());
... | 6 |
public HyperbolicEquation(float a, float b, float h, float k) {
this.a = a;
this.b = b;
this.h = h;
this.k = k;
} | 0 |
public static byte[] hexStringToByteArray(String s) throws NumberFormatException {
byte[] data = new byte[0];
if (s != null && s.length() > 0) {
String[] split;
if (s.length() > 2) {
if (s.length() >= 3 && s.contains("x")) {
s = s.startsWith("x... | 9 |
public List<Token> tokenize(String code) {
final List<Token> tokens = new LinkedList<>();
for (char c : code.toCharArray()) {
if (mapping.containsToken(c)) {
tokens.add(new Token(c, mapping.getType(c)));
}
}
return tokens;
} | 2 |
private int date_to_index(int date) {
//System.out.println("date_to_index : date = " + date);
//algorithme de recherche par dichotomie (a chaque fois on divise le tableau en 2)
boolean fin_iteration = false;
int debut = 0;
int fin = filemessages.size();
int milieu=-1;
if(date > filemessages.get(0).dat... | 5 |
public void launch()
{
// Load URLs
final List<URL> urls = new ArrayList<URL>();
mods.fill(urls);
File natives = new File(main.getApi().getMinecraftDirectory(), "bin/");
for (final UpdaterWorker.GameFile gameFile : main.getUpdater()
.getGameF... | 4 |
public int compare(Object o1, Object o2) {
Color first = (Color) o1;
Color second = (Color) o2;
if (first.getAlpha() != second.getAlpha())
return (second.getAlpha() - first.getAlpha());
// Extract the HSB, and impose the ordering.
float[] firstHSB = Color.RGBtoHSB(first.getRed(), first.getGreen(),
firs... | 3 |
protected boolean fix_with_precedence(
production p,
int term_index,
parse_action_row table_row,
parse_action act)
throws internal_error {
terminal term = terminal.find(term_index);
/* if the production has a precedence number, it can be fixed */
if (... | 7 |
private int addNeighbours(Point p, List<Point> list) {
int c = 0;
if (p.x - 1 != 0) if (this.maze[p.x - 1][p.y] == true) {list.add(new Point(p.x - 1, p.y));c++;}
if (p.x + 1 != this.width - 1) if (this.maze[p.x + 1][p.y] == true) {list.add(new Point(p.x + 1, p.y));c++;}
... | 8 |
@Override
public boolean matches(String[] input) {
for (String word: input) {
matcher.reset(word);
if (matcher.find()) {
return true;
}
}
return false;
} | 2 |
private void saveSettings() {
try {
myMode = mySettingsSWT.getSelectedMode();
myBoardType = mySettingsSWT.getSelectedBoardType();
myBoardFile = mySettingsSWT.getFile();
myFileParser = new FileParser(myBoardFile);
myFileParser.parse();
valid... | 1 |
public void apply() throws XPathExpressionException {
if(!this.isSelected()) {
return;
}
Element e = editor.getXMLElementByString(this.xmlPath);
if(e != null) {
Node child = null;
MessageUtil.debug("Remove all "+ this.name);
while((child ... | 3 |
@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 |
public static void main(String[] args) throws Exception {
ServerSocket serverSocket = new ServerSocket(6868);
while(true)
{
Socket socket = serverSocket.accept();
//启动读写线程
new ServerInputThread(socket).start();
new ServerOutputThread(socket).start();
}
} | 1 |
private LaunchProxy(File... files) {
StringBuilder buffer = new StringBuilder();
mFiles = new ArrayList<>();
mTimeStamp = System.currentTimeMillis();
buffer.append(LAUNCH_ID);
buffer.append(' ');
buffer.append(mTimeStamp);
buffer.append(' ');
if (files != null) {
for (int i = 0; i < files.length; i++... | 3 |
private synchronized void processNetPacket(Sim_event ev, int tag)
{
double nextTime = 0;
Packet pkt = (Packet) ev.get_data();
PacketScheduler sched = getScheduler(pkt);
// if a packet scheduler is not found, then try reschedule this packet
// in the future
if (sched ... | 8 |
@Basic
@Column(name = "payment_type")
public String getPaymentType() {
return paymentType;
} | 0 |
protected MD3_Surface( MD3_File parent_reader, int index) throws Exception{
this.parent_reader = parent_reader;
this.byter = this.parent_reader.byter;
INDEX = index;
start_pos = byter.getPos();
S32_IDENT = byter.getInteger(0);
STR_IDENT = byter.backward(4).getString(0, 4);
... | 9 |
private void runExperiment(int runType) {
int[] query = convertObjectArrayToIntegerArray(chooseQuery());
if (query == null || query.length == 0) {
ERROR("Query choose error.");
return;
}
switch (runType) {
case 0:
debug(query);
break;
case 1:
runExperiment1(query);
break;
case 2:
brea... | 9 |
public Item getItem(int slot) {
if(slot >= 0 && slot < items.length && items[slot] != null)
return items[slot];
return null;
} | 3 |
public InteractiveObject getInteractiveObject(int x, int y, int z) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile == null) {
return null;
}
for (int l = 0; l < groundTile.anInt1317; l++) {
InteractiveObject interactiveObject = groundTile.interactiveObjects[l];
if ((interactiveObject.uid... | 5 |
public Gui_Settings2(Gui_StreamRipStar mainGui)
{
super(mainGui, "Preferences");
this.mainGui = mainGui;
this.setModalityType(ModalityType.APPLICATION_MODAL);
Object elements[][] = {
{"Look And Feel",commonPrefIcon},
{"Audio and Programs",pathPrefIcon},
{"Language and Log",audioPlayerPrefIcon}};
... | 4 |
private void addTeam()
{
clear();
System.out.println("Add a new team:");
System.out.println();
try
{
int counter = teammgr.showCount();
int maxId = teammgr.maxTeamId();
Team tm = teammgr.getById(maxId);
if (tm == null || tm.ge... | 4 |
void Move_Send_Serial() {
// send updates to hexapod?
ByteBuffer buffer = ByteBuffer.allocate(64);
int used=0;
int i;
for(i=0;i<6;++i) {
Leg leg=legs[i];
// update pan
leg.pan_joint.angle=Math.max(Math.min(leg.pan_joint.angle,(float)leg.pan_joint.angle_max),(float)leg.pan_joint.ang... | 5 |
public boolean execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)){
return true;
}
String groupName = args[0];
String targetName = args[1];
GroupManager groupManager = Citadel.getGroupManager();
Faction group = groupManager.getGroup(groupName);
if(group == null){
sendMessa... | 9 |
@Override
public void mousePressed(MouseEvent e)
{
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
&& isStartEvent(e))
{
start(e);
e.consume();
}
} | 4 |
@Override
public void epoch(Player p) {
//Save the network
if (model_mimic != null){
if (drawNet_file != null)
drawNet.export(drawNet_file);
if (playNet_file != null)
playNet.export(playNet_file);
//Deep learning stopping criteria
//If no improvement, add another deep learning layer
if (DL_... | 5 |
private void setGroupNames(String username, String[] groups) {
Vector<String> v = null;
if (groups == null) {
v = emptyVector;
} else {
v = new Vector<String>(groups.length + 1);
for (int i = 0; i < groups.length; i++) {
v.add(groups[i]);
... | 2 |
public void init() {
// TODO Auto-generated method stub
try {
//setCurMap(new TiledMap("assets/grassmap.tmx"));
setCurMap(new TiledMap(map));
}
catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// could not find the map brooo!!! BBOOOOMMMMM!!!!!
}
// B... | 5 |
public void visit_lushr(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} | 1 |
public void addFind(int i, String s) {
this.finds.add(i, s);
} | 0 |
@Override
protected boolean evaluateLayer(final T baseValue, final T testValue) {
if (baseValue instanceof Integer) {
return testValue.intValue() < baseValue.intValue();
} else if (baseValue instanceof Float) {
return testValue.floatValue() < baseValue.floatValue();
} else if (baseValue instan... | 5 |
public void delegateLoadingOf(String classname) {
if (classname.endsWith("."))
notDefinedPackages.addElement(classname);
else
notDefinedHere.put(classname, this);
} | 1 |
@EventHandler
public void init(FMLInitializationEvent event)
{
} | 0 |
private void crearMazo(){
for(int x=0; x<40; x++){
//condicionales que asigna distintos palos a las cartas
if(x<10){
if(x<7){
mazo[x] = new Carta(x+1,"Espada");
}else{
mazo[x] = new Carta(x+3,"Espada");
}
}else if(x < 20){
if(x<17){
mazo[x] = new Carta((x-10)+1,"Oro");
... | 8 |
public SimpleFileFormat() {} | 0 |
public final void useType(Type type) {
if (type instanceof ArrayType)
useType(((ArrayType) type).getElementType());
else if (type instanceof ClassInterfacesType)
useClass(((ClassInterfacesType) type).getClassInfo());
} | 2 |
public boolean isContinuousForRC(int curRes, int curAA, int curRC){
//Check if the DOF can be continuously minimized in the given RC,
//i.e. there is an interval of nonzero width compatible with the RC
if( intervals == null )
return false;
//Convert curRes (numbered among al... | 8 |
@Test
public void testGetValue() {
Genotype g = new Genotype(1, 1);
Agent a;
try {
a = new Agent(g, 0, 0, 0);
HungerInputNeuron neuron = new HungerInputNeuron(a);
assertEquals("New agent should have 0 hunger.", 0.0, neuron.getValue(), 0);
} catch (WeigthNumberNotMatchException e) {
fail("Error whi... | 1 |
private DeviceType(String name) {
this.name = name;
} | 0 |
private int calculateOffset(int original, int watermark, Alignment alignment) {
if (alignment == HorizontalAlignment.LEFT || alignment == VerticalAlignment.TOP) {
return 0;
}
if (alignment == HorizontalAlignment.RIGHT || alignment == VerticalAlignment.BOTTOM) {
return ori... | 4 |
public StringBuffer format(double number, StringBuffer toAppendTo,
FieldPosition pos) {
StringBuffer s = new StringBuffer( nf.format(number) );
if( s.length() > width ) {
if( s.charAt(0) == ' ' && s.length() == width + 1 ) {
s.deleteCharAt(0);
}
else {
s.setLength( width );
for( in... | 9 |
public void printTree() throws CloneNotSupportedException {
int korkeus = laskeKorkeus(this.getRoot());
int tamanHetkinenKorkeus = korkeus;
int solmujenMaara = 1;
int korkeudenLaskemisraja = 1;
boolean tulostetaankoEkatValit = true;
// Tehdään puusta "täydellinen" puu
... | 8 |
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 OximataAdd(int editId) {
/*
* parathiro gia prosthiki oximatos an to editId einai 0 i epe3ergasia an einai megaluterao tou 0
*/
con = new Mysql();
id=editId;
if(id==0) //emfanizei ton katalilo titlo analoga thn leitourgia pou exei epilex8ei
setTitle("Prosthiki Oxhmatos");
else
setTitle("Epe... | 3 |
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if(numberStorage != null)
{
Set<Integer> keys = numberStorage.getKeys();
int maxCount = numberStorage.getMaxValue();
int minCount = numberStorage.getMinValue();
int totalCount = numberStorage.getTotalCount();
int numbKeys = keys... | 9 |
public Set<Action> actions(Object state) {
Sudoku sudoku = (Sudoku) state;
int grille[][] = sudoku.getGrille();
Set<Action> actions = new LinkedHashSet<Action>();
// boolean positionTrouve = false;
// // Genere exception Java heap space
// for(int i = 0; i < 9 ; i++){
// for(int j = 0; j < 9 ; ... | 9 |
public void createPanel(JPanel mainPanel) {
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
mainPanel.add(contentPane);
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
JPanel panel = new JPanel();
contentPane.add(panel);
panel.setLayout(null);
JLis... | 4 |
public void update(float dt) {
for(Letter letter: this.lettersOnTheTable){
letter.update(dt);
}
checkingPlatform.update(dt);
hero.update(dt);
monster.update(dt);
timer.update(dt);
checkForBodiesToDelete();
} | 1 |
public EditorData(int index,String header,String dataUrl){
this.url=dataUrl;
this.id=index;
HorizontalPanel upPanel=new HorizontalPanel();
add(upPanel);
HorizontalPanel downPanel=new HorizontalPanel();
add(downPanel);
String[] headerValues=header.split("\t");
title = new Label(he... | 7 |
public void onMessage(IMessage message) throws JFException {
} | 0 |
@Override
public HeightMap applyTo(HeightMap... heightMaps){
double[][] finalHeights = heightMaps[0].getHeights().clone();
double[][] newHeights = heightMaps[0].getHeights();
int xSize = finalHeights.length;
int ySize = finalHeights[0].length;
for(int iteration = 0; iteration... | 9 |
public void InsertaMedio (int ElemInser,int Posicion)
{
if (VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
if (Posicion<=1)
InsertaInicio(ElemInser);
else
{
NodosProcesos Aux = PrimerNodo;
int i = 2;
... | 3 |
public void loadMap() {
try {
InputStream in = getClass().getResourceAsStream(src);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
numCols = Integer.parseInt(br.readLine());
numRows = Integer.parseInt(br.readLine());
width = numCols * tileSize;
height = numRows * tileSize;
... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
int len = Integer.parseInt(br.readLine());
String[] in = br.readLine().split(" ");
int pred = Intege... | 7 |
private void increasePoolSizePercent(int increment) throws SQLException
{
synchronized (this.mutex)
{
double percincr = 1 + (increment / 100.0);
int newsize = (int) (pool.size() * percincr);
if (newsize <= pool.size())
{
newsize = pool.size() + 1;
}
LOGGER.fine("Increasing pool size from " + ... | 2 |
private void drawLines(int[][] lines, Graphics2D g, boolean addToX)
{
for (int line = 0; line < lines.length; line++)
{
for (int i = 0; i < lines[line].length; i += 2)
{
int grid = 30;
int p1 = xTop + lines[line][i] * grid;
int p2 = yTop + line * grid;
int x1 = addT... | 6 |
private int findIndexByKeyEvent(KeyEvent keyEvent) {
for (int i = 0; i < icons.size(); i++) {
IconInformation info = (IconInformation) icons.get(i);
final KeyStroke iconKeyStroke = info.getKeyStroke();
if (iconKeyStroke != null
&& (keyEvent.getKeyCode() ==... | 8 |
private String read() throws IOException, EOFException, InterruptedIOException
{
StringBuffer buffer = new StringBuffer();
int codePoint;
boolean zeroByteRead=false;
if (DEBUG) System.out.println("Reading...");
do
{
codePoi... | 5 |
public void submit() {
String Benutzername = nameTextPane.getText();
if (Benutzername.length() <= 0) {
JOptionPane.showMessageDialog(this, "Your username must have at least one character.", "Oh, come on...", JOptionPane.WARNING_MESSAGE);
} else if (Benutzername.length() > 16) {
JOptionPane.showMessageDialog... | 9 |
public static void test(Class<?> surroundingClass){
for(Class<?> type : surroundingClass.getClasses()){
System.out.println(type.getSimpleName() + ": ");
try{
Generator<?> g = (Generator<?>) type.newInstance();
for(int i = 0 ; i < size; i++)
System.out.println(g.next() + " ");
System.out.println... | 7 |
public Transition addIncomingTransition(Transition t) {
if(t != null && !incomingTransitions.contains(t)) {
incomingTransitions.add(t);
return t;
}
return null;
} | 2 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for(int c = 0, C = parseInt(in.readLine().trim()); c++ < C; ){
StringTokenizer st = new StringTokenizer(in.readLine());
int W = abs(parse... | 8 |
private void handle(Object input) {
if (input instanceof Datagram) {
TransitionEvent event = getTransitionEventFromDatagram((Datagram) input);
try {
this.fsm.handleEvent(event);
if(this.fsm.getCurrentState() != null && "acked".equals(this.fsm.getCurrentState().getIdentifier())) {
if(Statics.RX... | 7 |
@Override
public String execute(HttpServletRequest request) {
String text = request.getParameter("text");
Text nText = Parser.parseText(text);
List<Sentence> sentences = new ArrayList<>();
for (int i = 0; i < nText.getElements().size(); i++) {
sentences.addAll(nText.getE... | 1 |
private void langSelector_settingsListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_langSelector_settingsListValueChanged
if (langSelector_settingsList.getSelectedValue() == null)
return;
String oldLang = String.valueOf(settings.getLanguage());
... | 8 |
private static String intArrayToString(int[] sa) throws Exception
{
StringBuffer res=new StringBuffer();
for(int i=0;i<sa.length;i++)
{
int ii=sa[i];
char ch0=(char) (ii& 0xFF);
char ch1=(char) (ii>>>8& 0xFF);
... | 5 |
public static void main(String[] args) {
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ClientGUI frame = new ClientGUI();
frame.se... | 2 |
private void determineOrbits() {
int maxPerOrbit = Math.min((int) (baseOrbit.getCircumference() / componentSize), this.getNumSubComponents());
componentTheta = Math.PI*2/maxPerOrbit;
int numOrbits = (int)Math.ceil((double)this.getNumSubComponents() / maxPerOrbit);
orbitCounts = new in... | 3 |
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.