text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void exceptionalMethod()
{
throw new TestException();
} | 0 |
public String updateOffline(Product p) {
try {
String sql = "UPDATE stock SET productName = ?, count = ?, price = ?, feature = ? where productId = "+p.getpId();
PreparedStatement ps = StatusController.connection.prepareStatement(sql);
ps.setString(1, p.getpName());
ps.setInt(2, p.getAmount());
ps... | 1 |
public int logIn(String username, String password) {
try {
String host = "localhost";
socket = new Socket(host, 2001);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
... | 4 |
public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null)
return q == null;
if (q == null)
return p == null;
TreeIterator ip = new TreeIterator(p);
TreeIterator iq = new TreeIterator(q);
while (ip.hasNext() && iq.hasNext()) {
if (!eq... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AdjacencyListElement other = (AdjacencyListElement) obj;
if (target == null) {
if (other.target != null)
return false;
} else if (!targe... | 7 |
public List<ObjectiveObj> getObjectiveTable(PreparedStatement pre) {
List<ObjectiveObj> items = new LinkedList<ObjectiveObj>();
try {
ResultSet rs = pre.executeQuery();
if (rs != null) {
while (rs.next()) {
ObjectiveObj item = new ObjectiveObj(... | 3 |
public ArrayList<Copy> getAllCopies(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Copy> copyList = new ArrayList<Copy>();
try... | 5 |
protected JPopupMenu createPopupMenu(boolean properties,
boolean save,
boolean print,
boolean zoom) {
JPopupMenu result = new JPopupMenu("Chart:");
boolean separator = false;
... | 7 |
@Test
public void resolve() {
BigDecimal n1=new BigDecimal(1);
BigDecimal n2=new BigDecimal(1);
BigDecimal num=new BigDecimal(3);
int count=2;
while(num.toString().length()<1000){
count++;
num=n2.add(n1);
n1=n2;
n2=num;
}
print(count);
} | 1 |
public void setNameFromTextField() {
firstNameText.setText((Name.getInstance().getFirstName()));
middleNameText.setText((Name.getInstance().getMiddleName()));
lastNameText.setText((Name.getInstance().getLastName()));
} | 0 |
public List<Double> getDoubleListFromString(String xArg)
{
if (xArg == null || xArg.equalsIgnoreCase(""))
return null;
List<Double> d = new ArrayList<Double>();
char[] c = xArg.toCharArray();
int lastPos = 0;
for (int i = 0; i < c.length; i++)
{
if (c[i] == ',')
{
d.add(Double.valueOf(re... | 4 |
private boolean has6Neighbors(PieceCoordinate butterflyPos) {
int neighbors = 0;
Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator();
PieceCoordinate next;
while(pieces.hasNext()) {
Entry<PieceCoordinate, HantoPiece> entry = pieces.next();
next = entry.getKey();
if (nex... | 2 |
public static BufferedImage loadImage(String path){
try {
return ImageIO.read(new FileInputStream("res/" + path + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
return null;
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SanitizeEvent other = (SanitizeEvent) obj;
... | 5 |
public void submitMode(boolean isSubmitMode) {
if (isSubmitMode) {
submissionPane.setViewportView(new SubmitView(this));
} else {
submissionPane.setViewportView(submissionView);
}
} | 1 |
private void getResponseBipolarList() {
titleDLM.removeAllElements();
bipolarQuestionList = bipolarQuestion.getResponseBipolarList(fileName, publicFileName, counterTeamType);
if (bipolarQuestionList.size() != 0) {
for (int i = 0; i < bipolarQuestionList.size(); i++) {
titleDLM.addElement(bipolarQuestionLis... | 7 |
private Class _clazz(Class clazz){
switch(clazz.getName()){
case "boolean": return java.lang.Boolean.class;
case "int": return java.lang.Integer.class;
case "float": return java.lang.Float.class;
case "double": return java.lang.Double.class;
case "long... | 7 |
private boolean compruebaImpactoMisil(Nave jugador){
for (int i=0;i<sprites.size();i++)
if (sprites.get(i).getClass()==Misil.class) {
Misil laserEnemigo=(Misil)sprites.get(i);
if ((laserEnemigo.getX()>jugador.getX() && laserEnemigo.getX()+laserEnemigo.getWidth()<j... | 6 |
private void updateClaim(boolean choice1) {
switch (claim.getStatus()) {
case UnRanked:
claim.rank(choice1 ? Claim.Rank.Complex : Claim.Rank.Simple);
JOptionPane.showMessageDialog(form, "The claim has been ranked " + (choice1 ? Claim.Rank.Complex : Claim.Rank.Simple))... | 8 |
public BrickBreaker() {
panel = new BrickBreakerPanel();
//build the frame and attach everything to it.
frame = new GameFrame(
"Brickbreaker by Jeremy",
GAMEHEIGHT,
GAMEWIDTH,
new BrickBreakerMenu(
GAMEWIDTH ... | 4 |
public void testContext() {
int min = -80;
int max = 80;
int size = max - min;
for (double v : new double[] { -15D, -10D, -5D, 5D, 15D }) {
double[] table = new double[2];
char[][] data = new char[size][size];
int i = 0;
int j = 0;
for (double x = min; x < max; x++, i++) {
j = 0;
for (d... | 8 |
public void update() {
if (walking) animSprite.update();
else animSprite.setFrame(0);
if (fireRate > 0) fireRate--;
double xa = 0, ya = 0;
double speed = 1.0;
if (input.up) {
ya -= speed;
animSprite = up;
} else if (input.down) {
ya += speed;
animSprite = down;
}
if (input.left) {
xa -=... | 8 |
public static String getSuffixWithDot(String s){
if(s == null || s.isEmpty()){
return null;
}
int lastDotIndex = s.lastIndexOf(".");
int length = s.length();
String suffix = s.substring(lastDotIndex, length);
return suffix;
} | 2 |
public void run() {
try {
Synthesizer synthesizer = MidiSystem.getSynthesizer();
synthesizer.open();
MidiChannel channel = synthesizer.getChannels()[0];
while (true) {
if (play == true) {
channel.programChange(instType);
channel.noteOn(pitch, velocity);
pause = 350;
play = false... | 4 |
public int getPort() {
return port;
} | 0 |
protected String getTag() {
return newArray ? "new[]" : "new";
} | 1 |
public boolean containsNode(String idRef) {
return terminals.containsKey(idRef) || nonterminals.containsKey(idRef);
} | 1 |
public void run() {
/* forall v in V doe label(v) <- EMPTY;
* for i<-n downto 1 do
* let v be an unnumbered vertex with largest label;
* number(v);
* forall unnumbered neighbours of v do
* label(w) <- label(w) + {i}
*/
NVertexOrder<D> order = new NVertexOrder<D>();
int bestUpperBound = Int... | 9 |
public void setNext(Items next) {
this.next = next;
} | 0 |
public Player getNextLocatorPlayer(){
ArrayList<Player> onlineFriends = getOnlineFriends();
if(onlineFriends.size() == 0) return null;
int index = 0;
if(playerLocator != null){
Player currLocator = Bukkit.getPlayerExact(playerLocator);
System.out.print("1");
if(currLocator != null && onlineFriends.cont... | 5 |
protected void handleExpandStateChanged() {
if (isExpanded()) {
if (scrollpane.getParent() != this)
add(scrollpane);
} else {
if (scrollpane.getParent() == this)
remove(scrollpane);
// collapse all pinnable palette stack children that aren't pinned
for (Iterator iterator = getContentPane().getC... | 8 |
private void paintNaves(Graphics2D g2d){
int nNaves = juego.getnNaves();
List<Nave> nav=naves;
List<Nave> list = (nNaves==2) ? nav : nav.subList(0, 1);
for (Nave n : list) {
if(n.isVivo()) n.paint(g2d);
}
} | 3 |
public void setZeroes(int[][] matrix) {
boolean[] row = new boolean[matrix.length];
boolean[] col = new boolean[matrix[0].length];
for(int i=0; i<matrix.length; i++)
{
for(int j=0; j<matrix[i].length; j++)
{
if(matrix[i][j] ==0)
{
ro... | 7 |
public static boolean commitToFile(ArrayList<Employee> employees, String filePath)
{
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
Document employeeDoc;
DocumentBuilder docBuilder = dbFactory.newDocumentBuilder();
employeeDoc = docBuilder.newDocument();
Element roo... | 2 |
public void mouseDragged(MouseEvent e) {
//System.out.println("============= mouseDragged ============");
moveCamera(e);
} | 0 |
private static void init(){ // создание и заполнение списка
list.add(new Cube(3,0,0));
list.add(new Orb(1,2,5,5));
list.add(new Tetrahedron(1,2,3,12));
list.add(new Cylinder(1,1,5));
//list.add(new Cube(2,0,0));
// list.add(new Orb(3,4,1,0));
... | 0 |
public void renderHUD(Box2D bounds) {
super.renderHUD(bounds) ;
if (selection.selected() != null) {
camera.setLockOffset(infoArea.xdim() / -2, 0) ;
}
else {
camera.setLockOffset(0, 0) ;
}
camera.updateCamera() ;
if (currentPanel != newPanel) {
beginPanelFade() ;
... | 6 |
public final void processFFT(double pitchShift, double[] gFFTworksp)
{
int k, qpd, index;
double real, imag, magn, phase, tmp;
double[] gAnaMagn = this.gAnaMagn;
double[] gAnaFreq = this.gAnaFreq;
double[] gSynMagn = this.gSynMagn;
double[] gSynFreq = this.gSynFreq;
/* this is the analysis step... | 5 |
private static void printHubDetails (int indent, Device dev)
{
try {
Hub h = new Hub (dev);
int ports = h.getNumPorts ();
boolean indicator = h.isIndicator ();
indentLine (indent,
(h.isRootHub () ? "Root " : "")
+ "Hub, "
+ ports
+ " ports"
);
indentLine (indent,
"overcurren... | 7 |
public ParticleGenerator(Class<? extends T> impl, actor.interfaces.Movable source) {
try {
ctor = impl.getConstructor();
} catch (SecurityException e) {
e.printStackTrace();
return;
} catch (NoSuchMethodException e) {
e.printStackTrace();
... | 3 |
public void downloadJarFromJenkins(String urlPrefix, String localPath) {
InputStream input = null;
FileOutputStream writeFile = null;
try {
String path = getJenkinsRelativePath(urlPrefix);
URL url = new URL(urlPrefix+"lastStableBuild/artifact/"+path);
System.out.println(url... | 4 |
private Node merge(Node startLeft, int leftLength, Node startRight, int rightLength) {
int leftCounter = 0;
Node leftCursor = startLeft;
int rightCounter = 0;
Node rightCursor = startRight;
Node startCursor = null;
Node mergeCursor = null;
int totalLength = leftLength + rightLength;
for (int i ... | 6 |
public double pow2(double x, int n){ // deal with negativity separately
if(n == Integer.MIN_VALUE) return 1.0/(pow2(x, n+1) * pow2(x, -1));
if(n < 0) return 1.0 / pow2(x, -n); // can not handle the case where n = MIN_VALUE
if(n == 1) return x;
if(n == 0) return 1.0;
double y = po... | 5 |
public void updateUniforms(Matrix4f worldMatrix, Matrix4f projectedMatrix, Material material)
{
if(material.getTexture() != null)
material.getTexture().bind();
else
RenderUtil.unbindTextures();
setUniform("transform", projectedMatrix);
setUniform("color", material.getColor());
} | 1 |
public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", ... | 2 |
private void Equipa2_RadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Equipa2_RadioButtonItemStateChanged
if(Equipa2_RadioButton.isSelected())
Jogador_ComboBox.setEnabled(true);
if(Equipa2_RadioButton.isSelected()== false)
Jogador_ComboBox.setEnabled(f... | 2 |
@SuppressWarnings("unchecked")
private<PType extends IPerformances> List<GenericTestResults<Double, CTDiscreteNode, ICTClassifier<Double,CTDiscreteNode>, PType>> executeTests(
List<ITestFactory<Double, CTDiscreteNode, ICTClassifier<Double,CTDiscreteNode>, PType>> testFactories,
List<ITrajectory<Double>> dataset,... | 7 |
public void PlayAgain(){
System.out.print("Do you wish to play again? Y or N: ");
Scanner input = new Scanner(System.in);
String answer = "";
answer ="n";//input.nextLine();
if (answer.equalsIgnoreCase("y"))
{
input.close();
new Game();
}
else if (answer.equalsIgnoreCase("n"))
{
input.clo... | 2 |
public void configureOtherEtcProperties(){
if (getDebug()) System.out.println(getProperties().size()+" property updates found");
for (Map.Entry<String, String> e:getProperties().entrySet()){
File file=new File(getFuseHome(), "etc/"+e.getKey().split("_")[0]+".cfg");
if (!file.exists()) throw ... | 9 |
public String[] mapTypes(String[] types) {
String[] newTypes = null;
boolean needMapping = false;
for (int i = 0; i < types.length; i++) {
String type = types[i];
String newType = map(type);
if (newType != null && newTypes == null) {
newTypes =... | 7 |
public void putAll( Map<? extends Float, ? extends Integer> map ) {
Iterator<? extends Entry<? extends Float,? extends Integer>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Float,? extends Integer> e = it.next();
this.put( e.... | 8 |
@Override
public void restartMachine(IMachine machine) throws InvalidObjectException, ConnectorException
{
try
{
CloudStackClient client = ClientLocator.getInstance().getClient(machine.getComputeCenter().getProperties(),
controllerServices);
client.rebootVirtualMachine(machine.getName());
}
catch ... | 1 |
public Interactable.Result keyboardInteraction(Key key)
{
try {
switch(key.getKind())
{
case ArrowDown:
return Result.NEXT_INTERACTABLE_DOWN;
case Tab:
case ArrowRight:
return... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Hill other = (Hill) obj;
if (field == null) {
if (other.field != null)
return false;
} else if (!field.equals(other.field))
return fa... | 6 |
private static void populateEntities(World world, String uin, int loops){
TileMap tm = world.tileMap;
for(int i = 0; i < loops; i++){
EntityLiving el = (EntityLiving) Entity.createEntityFromUIN(uin, tm, world);
int x = new Random().nextInt(tm.getXRows());
int y = new Random().nextInt(tm.getYRows());
... | 4 |
protected void restoreButtonBorder(AbstractButton b) {
Object cp = b.getClientProperty("paintToolBarBorder");
if ((cp != null) && (cp instanceof Boolean)) {
Boolean changeBorder = (Boolean)cp;
if (!changeBorder.booleanValue()) {
return;
}
}
... | 5 |
public void setNametextFontsize(int fontsize) {
if (fontsize <= 0) {
this.nametextFontSize = UIFontInits.NAME.getSize();
} else {
this.nametextFontSize = fontsize;
}
somethingChanged();
} | 1 |
void parseOtherServersList(String list) {
// Splitlist
String[] temp = list.split(";");
String IP = null;
String BindingName = null;
int Port = 0;
for (int i = 0; i < temp.length; i++) {
switch (i % 3) {
case 0:
IP = temp[i];
// System.out.println("IP: "+IP);
break;
case 1:
Binding... | 8 |
public static void init3dCanvas(int x, int y) {
Rasterizer.lineOffsets = new int[y];
for (int i = 0; i < y; i++) {
Rasterizer.lineOffsets[i] = x * i;
}
Rasterizer.centerX = x / 2;
Rasterizer.centerY = y / 2;
} | 1 |
public Declaration(String jsonFile) throws FileNotFoundException, IOException, Exception {
String JSONInfo = FileReader.loadFileIntoString(jsonFile, "UTF-8");
json = JSONObject.fromObject(JSONInfo);
nomCycle = json.get("cycle").toString();
NumeroPermis = json.get("numero_de_permis").toS... | 1 |
public int removeDuplicates(int[] A) {
int MAX_REPEAT = 2;
if( A.length <= MAX_REPEAT ) return A.length;
int p = 0;
int r = 1;
for( int i = 1; i < A.length; i++ ) {
if( A[i] != A[p] ) {
A[++p] = A[i];
r = 1;
} else {
... | 4 |
public void run() {
String producedData = "";
try {
while (true) {
if (producedData.length()>75) break;
producedData = new String("Hi! "+producedData);
sleep(1000); // It takes a second to obtain data.
theBuffer.putLine(producedData);
}
}
catch (Exception e) {
// Just let thread termina... | 3 |
private Object popupCombo(Object combobox) {
// combobox bounds relative to the root desktop
int combox = 0, comboy = 0, combowidth = 0, comboheight = 0;
for (Object comp = combobox; comp != content; comp = getParent(comp)) {
Rectangle r = getRectangle(comp, "bounds");
combox += r.x; comboy += r.y;
Recta... | 7 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Class clsObj=null;
try{
clsObj = Class.forName("UsingAnnotation");
}
catch(ClassNotFoundException cnfe){
cnfe.printStackTrace();
}
try {
Method mthd = clsObj.getMethod("fun", null);
if(mthd.isAnnotationPresent(MyAnnota... | 7 |
@Override
public void analyzeCoverage() {
// in this analysis, skip and count the read pair where either read
// or mate are flagged as unmapped
if (this.getSamRecord().getReadUnmappedFlag()
|| this.getSamRecord().getMateUnmappedFlag()) {
readMateUnmappedCount++;
return;
}
// in this analysis, ski... | 8 |
final public SimpleNode Start() throws ParseException {
/*@bgen(jjtree) Start */
SimpleNode jjtn000 = new SimpleNode(JJTSTART);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
booleanSentence();
jj_consume_token(0);
jj... | 9 |
public int getMouseX() {
return mouseLocation.x;
} | 0 |
static void write(Command cmd, OutputStream out) throws UnsupportedEncodingException, IOException {
encode(cmd.getCommand(), out);
for (Parameter param : cmd.getParameters()) {
encode(String.format("=%s=%s", param.getName(), param.hasValue() ? param.getValue() : ""), out);
}
... | 8 |
public void begin() {
final ObjectInputStream in;
final ObjectOutputStream out;
try {
in = new ObjectInputStream(socket.getInputStream());
out = new ObjectOutputStream(socket.getOutputStream());
Thread input = new Thread() {
@Override
public void run() {
while(true) {
readMessage(in)... | 5 |
private void checkAttribute()
{
ExpressionDecomposer ed=new ExpressionDecomposer();
//check select
Iterator<Expression> s=select.iterator();
while(s.hasNext())
{
ArrayList<String> selectAttrs=ed.getIdentifiers(s.next());
Iterator<String> selectIterator=selectAttrs.iterator();
while(selectIterator.ha... | 5 |
@Override
public boolean removeLockByResources(Set<String> resources) {
boolean thereturn = false;
for (String resource : resources)
thereturn = removeLockByResource(resource) || thereturn;
return thereturn;
} | 2 |
public boolean checkForBookIssuedOrNot(IssueBookVO issueBookVO)
throws LibraryManagementException {
boolean returnValue = true;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException... | 5 |
private void checkForRemovedMarkers() {
markersToRemove.clear();
for (Node node : pane.getChildren()) {
if (node instanceof Marker) {
if (getSkinnable().getMarkers().keySet().contains(node)) continue;
node.setManaged(false);
node.removeEventHan... | 4 |
public static void start() {
System.out.println("MAYBE IT WORKS?");
try {
try {
new ServerClassLoader().
//ServerRestarter.class.getClassLoader().
loadClass("server.Server").getConstructor(int.class).newInstance(port);
return;
} catch (InstantiationException e) {
e.printStackTrace();
}... | 8 |
@Override
public void Parse(Session Session, EventRequest Request)
{
if (Session.GrabActor().Frozen)
{
return;
}
int X = Request.PopInt();
int Y = Request.PopInt();
Session.GrabActor().GoalPosition = new Position(X, Y, Session.GrabActor().CurrentPosition.Z);
if (Session.GrabActor().IsMoving... | 2 |
static void sortWith0(int[] a, int fromIndex, int toIndex, IntComparator cmp) {
final int length = toIndex - fromIndex + 1;
if (length < 2)
return;
if (length == 2) {
if (cmp.gt(a[fromIndex], a[toIndex])) {
int x = a[fromIndex];
a[fromIndex... | 9 |
private void validate() throws RrdException {
boolean ok = true;
if(timestamps.length != values.length || timestamps.length < 2) {
ok = false;
}
for(int i = 0; i < timestamps.length - 1 && ok; i++) {
if(timestamps[i] >= timestamps[i + 1]) {
ok = false;
}
}
if(!ok) {
throw new RrdException("I... | 6 |
public Archive(File file) throws IOException {
// Initialize
this.file = file;
files = new HashMap<String, ArchiveFile>();
if (!file.exists()) return;
// Open the file to read
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(file, "r");
// Read the header
int filecnt = changeEndian... | 5 |
@Override
public boolean store() throws SQLException{
if(super.store()== false){
return false;
}
else if(super.getID()==-1)
{
return false;
}
SQLiteJDBC db = new SQLiteJDBC();
String sql = String.format(
... | 3 |
public static PrivateKey getPrivateKey(String pem) throws IOException, GeneralSecurityException {
PrivateKey key = null;
byte[] bytes = getFragmentOfPEM(pem, RSA_PRIVATE_KEY_PEM_HEADER,
RSA_PRIVATE_KEY_PEM_FOOTER);
String rsa = new String(bytes);
String spli... | 4 |
public ObjectDefinition method580() {
int i = -1;
if (varbitFileId != -1) {
VarBit varBit = VarBit.cache[varbitFileId];
int j = varBit.configId;
int k = varBit.anInt649;
int l = varBit.anInt650;
int i1 = Client.anIntArray1232[l - k];
... | 5 |
@Override
public boolean evaluate(T t) {
if(firstSearchString.evaluate(t) || secondSearchString.evaluate(t)){
return true;
}
else{
return false;
}
} | 2 |
public boolean actionDisinfest(Actor actor, Crop crop) {
final Item seed = actor.gear.bestSample(
Item.asMatch(SAMPLES, crop.species), 0.1f
) ;
int success = seed != null ? 2 : 0 ;
if (actor.traits.test(CULTIVATION, MODERATE_DC, 1)) success++ ;
if (actor.traits.test(CHEMISTRY , ROUTINE_DC , 1... | 5 |
public static void main(String[] args) {
/*
* try { // Set cross-platform Java L&F (also called "Metal")
* //UIManager
* .setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
* UIManager.
* setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
* } catch (UnsupportedLookAndFeelE... | 0 |
private ListNode insertIntoSortedList(ListNode target, ListNode source){
//initialize
if(target == null){
target = new ListNode(source.val);
}else{
ListNode p = target;
//if source is the smallest one.
if (target.val > source.val) {
target = new ListNode(source.val);
... | 7 |
@Override
protected ERGameEvent readEventStream(InputStream inputStream)
throws IOException {
ObjectInputStream ois = new ObjectInputStream(inputStream);
switch(ois.readInt()){
case (ERGameEvent.EVENT_MESSAGE_C):
return ERGameEvent.EventMessageClient(ois.readUTF());
case (ERGameEvent.EVENT_MESSAGE)... | 7 |
public static void main(String[] args) {
int startPort = 8000;
int endPort = 8001;
int TIMESPAN = 10;
String serverIp = "localhost";
String output = "y";
for (int i = 0; i < args.length - 1; i++) {
if (args[i].equals("-sp")) {
startPort = Integer.parseInt(args[i + 1]);
}
if (args[i]... | 9 |
public boolean getJumpKeyPressed() {
return jumpKeyPressed;
} | 0 |
public void setZ(int z) {
this.z = z;
} | 0 |
public void stop() {
if (!loading()) {
// Make sure there is a sequencer:
if (sequencer == null)
return;
try {
// stop playback:
sequencer.stop();
// rewind to the beginning:
sequencer.setMicrosecondPosition(0);
// No need to listen any more:
sequencer.removeMetaEventListener(thi... | 3 |
public static String byteToHexString(byte[] data) {
// convert the byte to hex format method 2
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < data.length; i++) {
String hex = Integer.toHexString(0xff & data[i]);
if (hex.length() == 1)
hexString.append('0');
hexString.append(hex);
... | 2 |
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) {
final Path PATH = new Path();
PATH.setFillRule(FillRule.EVEN_ODD);
while (!PATH_LIST.isEmpty()) {
if ("M".equals(READER.read())) {
PATH.getElements().add(new MoveTo(READER.nextX()... | 9 |
public static void main(String[] args) {
// Load the project properties
Properties properties = new Properties();
try {
properties.load(new FileInputStream("src/main/resources/threadedMerge.properties"));
} catch (IOException e) {
System.out.println("Error: could... | 7 |
public List<Element> getElementsOnGrid() {
final List<Element> elements = new ArrayList<Element>();
for (Square square : squares.values())
elements.addAll(square.getElements());
return elements;
} | 1 |
@Override
public void init (AbstractQueue<QueueElement> queue, Properties props)
throws MalformedURLException, ParserConfigurationException,
TransformerConfigurationException {
this.queue = queue;
this.props = props;
String strInputURL = System.getPr... | 9 |
@Override
public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) {
// Grab the argument, if any.
String arg1 = (args.length > 0 ? args[0] : "");
if(arg1.isEmpty()) {
plugin.reloadConfigs();
plugin.reloadDataFiles();
Messenger.sendMessage(sender, Ch... | 4 |
public void personDetailsForm() {
super.personDetailsForm();
// If fields not empty
if (name != null && address != null && email != null && contactNumber != null) {
// Edit mode selected
if (editMode) {
driver.getPersonDB().changePersonDetails(person, name, email, contactNumber,
address, 0, null... | 5 |
public Air() {
super(Color.white, false);
} | 0 |
public void testCompare2Spreadsheets( WorkBookHandle bk1, WorkBookHandle bk2 ) throws Exception
{
WorkSheetHandle[] s1 = bk1.getWorkSheets();
WorkSheetHandle[] s2 = bk2.getWorkSheets();
if( s1.length != s2.length )
{
log.info( "These Workbooks do not have the same sheet count. Original: " + s1.length + "... | 5 |
private void readGrid() throws FileNotFoundException, IllegalArgumentException, ArrayIndexOutOfBoundsException{
boardReader = new Scanner(startBoard);
String row = "";
int rowCount = 0;
while (boardReader.hasNext()) {
row = boardReader.next();
rowCount++;
}
boardReader = new Scanner(startBoard);
gri... | 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.