text stringlengths 14 410k | label int32 0 9 |
|---|---|
public FlowLoggerImpl() {
try {
Class<?> factoryClass = Class.forName("org.slf4j.LoggerFactory");
Class<?> loggerClass = Class.forName("org.slf4j.Logger");
Method factoryMethod = factoryClass.getDeclaredMethod("getLogger", String.class);
logger = factoryMethod.in... | 3 |
public void createMenu() {
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem fileItem = new MenuItem(bar, SWT.CASCADE);
fileItem.setText("&File");
Menu submenu = new Menu(shell, SWT.DROP_DOWN);
fileItem.setMenu(submenu);
//menuItem = new MenuItem(menu, SWT.SEPARATOR);
MenuIt... | 3 |
public boolean canMoveRight(){
int emptyColumsFromRight=0, j, i;
// check for field boundaries on the right side
for(i=(t.getySize()-1);i>0;i--){
if(!t.columnIsEmpty(i)){
break;
}
emptyColumsFromRight++;
}
if((t.getPosX()+t.getxSize()-emptyColumsFromRight)>(p.getxSize()-1)){
return false;
... | 8 |
private void ForwardCheck(Message message) throws InterruptedException{
System.out.println("HELLO");
CPA fc_cpa = message.cpa();
if(message.SC()>AgentView.SC()){
if(!AgentView_consistent){
if(!fc_cpa.contains(new CPA(AgentView))){
AgentView_consistent=true;
}
}
if(AgentView_consistent){
... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ComparePerson)) return false;
ComparePerson person = (ComparePerson) o;
if (age != person.age) return false;
if (name != null ? !name.equals(person.name) : person.name != null) return... | 5 |
private ResGridlet cancel(int gridletId, int userId)
{
ResGridlet rgl = null;
// Check whether the Gridlet is in execution list or not
int found = gridletInExecList_.indexOf(gridletId, userId);
// if a Gridlet is in execution list
if (found >= 0)
{
// up... | 3 |
public void infinite() {
while (true) {
try {
synchronized(this) {
while (this.pause == 1)
wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
this.state.update();
}
} | 3 |
public static void cppOutputSystemMakefile() {
{ String makefile = Stella.makeFileName("Makefile", Stella.KWD_STELLA, true);
String templatefile = Stella.fileNameWithoutExtension(makefile) + ".in";
SystemDefinition system = ((SystemDefinition)(Stella.$CURRENTSYSTEMDEFINITION$.get()));
if (!(Stell... | 7 |
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);
if(det(matrix)==0){
print("\nThe matrix is singular.\n");
}else{
... | 3 |
public Response serve( String uri, String method, Properties header, Properties parms, Properties files, Socket source ) {
System.out.println("URI: " + uri);
if (uri.length() > 1) {
if (uri.charAt(0) == '/') {
uri = uri.substring(1);
}
} else {
return handleIndex();
}
String[] params = uri.split... | 9 |
@Override
protected Void doInBackground() throws Exception {
final int BUFFER_SIZE = 64000;
Client client = new Client(BUFFER_SIZE, BUFFER_SIZE);
client.getKryo().register(PacketLogin.class);
client.getKryo().register(PacketLoginResponse.class);
client.getKryo().register(Pac... | 3 |
private boolean onCommandListMods(CommandSender sender, Command command, String label, String cmd, String[] args)
{
if (sender.hasPermission(ReplicatedPermissionsPlugin.ADMIN_PERMISSION_NODE))
{
List<String> supportedModList = this.parent.getProvider().getMods();
boolean first = true;
String reply = C... | 4 |
public static int getInt(String domain, String key, int fallback)
{
return Integer.parseInt(getString(domain, key, String.valueOf(fallback)));
} | 0 |
public List<CommandType> getCommand() {
if (command == null) {
command = new ArrayList<CommandType>();
}
return this.command;
} | 1 |
public BufferedImage getImageFromName(String resourceName) throws IOException
{
if (Game.getInstance() != null)
{
return ImageIO.read(Game.getInstance().getClass().getClassLoader().getResourceAsStream(Game.getInstance().getResourceDirectory() + resourceName));
}
return null;
} | 1 |
public static void main(String[] args){
try{
int i = 4;
if(i==1) throw new C12Q9Exp1();
else if(i==2) throw new C12Q9Exp2();
else if(i==3) throw new C12Q9Exp3();
else
throw new NullPointerException();
}
catch(C12Q09Exception e){
}
finally{
System.out.println("In finally");
}
} | 4 |
private void bubbleDown(int pos) {
for (int i = pos - 1; i >= 0; i--) {
if(swapIfFirstIsLess(pos, i)) pos = i;
else return;
}
} | 2 |
public boolean isSet(String string) {
Option<?> opt = options.get(string);
if (opt == null)
return false;
if (opt instanceof CollectionOption<?, ?>) {
@SuppressWarnings("unchecked")
CollectionOption<?, Collection<?>> c = (CollectionOption<?, Collection<?>>) opt;
return !c.value.isEmpty();
}
return... | 9 |
protected void compexch(T[] a, int i, int j) {
if (less(a[j], a[i]))
exch(a, j, i);
} | 1 |
@EventHandler(priority = EventPriority.HIGH)
public void useRedstone(PlayerInteractEvent event) {
Material[] blockedInteracts = {Material.WOOD_BUTTON, Material.STONE_BUTTON, Material.LEVER, Material.GOLD_PLATE,
Material.IRON_PLATE, Material.STONE_PLATE, Material.WOOD_PLATE, Material.TRIPWIRE... | 9 |
@EventHandler
public void SkeletonFastDigging(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("Skeleton... | 7 |
public void generateHTML() {
File file = new File("RAPORT.html");
List<UserDTO> listaUserow;
try {
listaUserow = requests.getAllUsers();
Collections.sort(listaUserow);
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write("<html>");
bw.write("<head>");
bw.write("<style>");
... | 5 |
protected ArrayList<Position> getBgPiecesNrby(Board b, Position tgt) {
ArrayList<Position> posArray = tgt.adjacentP(b, false, false);
int i;
Rank r1 = Rank.Engineer;
Position pos1 = null;
Rank r2 = Rank.Engineer;
Position pos2 = null;
Piece p = null;
for (i = 0; i ... | 6 |
public String intToRoman(int num) {
StringBuffer result = new StringBuffer();
int step = numbers.length - 1;
while (num > 0) {
if (num < numbers[step] - minuses[step]) {
step--;
continue;
}
if(num < numbers[step]){... | 3 |
*/
private boolean initializeMods () {
Logger.logDebug("pack dir...");
Logger.logInfo(ModPack.getSelectedPack().getDir());
ModManager man = new ModManager(new JFrame(), true);
man.setVisible(true);
while (man == null) {
}
while (!man.worker.isDone()) {
... | 5 |
public void run(){
while(running){
println(id + ": " + count);
count++;
this.linha.update();
try{
sleep((long)(wait));
}catch (Exception e){
}
}
println("The thread is dead!");
} | 2 |
protected Object fillCollection(Object o, TypeToken typeToken, ITestContext iTestContext) {
ITestParamState iTestState = iTestContext.getCurrentParam();
Collection<Object> col = (Collection<Object>) o;
Class collectionClass;
if ( null != iTestContext.getCurrentParam() && null != iTestCon... | 9 |
static void readImages(String xfilename, String yfilename) {
try {
Scanner xscanner = new Scanner(new File(xfilename));
Scanner yscanner = new Scanner(new File(yfilename));
while (xscanner.hasNextLine()) {
Image i = new Image();
String line = x... | 4 |
@RequestMapping(value="/match", method=RequestMethod.PUT)
@ResponseBody
public MatchData startGame(@PathVariable("gameId") String gameId, @RequestParam("accountName") String accountName) {
Assert.notNull(messageRouter, "Message router can't be null, is required.");
Assert.hasText(accountName, "Account name mus... | 3 |
public static PublicEventTypeEnum fromString(String v) {
if (v != null) {
for (PublicEventTypeEnum c : PublicEventTypeEnum.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
public String encode(String plain)
{
char[] pt=build_keyed_alphabet(h_key,26,0);
int period=v_key.length();
String v_key_u=v_key.toUpperCase();
char[][] ct_table=new char[period][26];
for(int i=0;i<period;i++)
{
char first_c=v_key_u.charAt(i);
char[] ct_line=build_keyed_alphabet(h_key,26,0);
... | 5 |
private void setOutputPrecision(){
int maxPrec = Fmath.checkPrecision(this.responses0[0][0]);
int prech = maxPrec;
for(int i=0; i<this.nGroups; i++){
for(int j=0; j<this.nResponsesPerGroup[i];j++){
prech = Fmath.checkPrecision(this.responses0[i][j]);
i... | 5 |
public static int removeDuplicates2(int[] A) {
int len = A.length;
int dup = 1;
int des = 0;
for (int i = 1; i < len; i++) {
if (A[i] == A[i - 1]) {
dup = dup + 1;
} else {
if (dup > 2) {
des = des + dup - 1;
}
dup = 1;... | 4 |
public void mouseEntered(MouseEvent e) {
if(getState() == ENABLED) {
textColor = "white";
} else {
textColor = "lightGray";
}
} | 1 |
@Override
public float getTaskProgress() {
if (taskList.size() == 0)
return 0;
if (totalWeight == 0)
return 0;
float completedWeight = 0;
for (int i = 0; i < taskProgress; i++) {
IInstallTask task = taskList.get(i);
if (taskWeights.co... | 5 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((--regenTick)>0)
return true;
regenTick=maxTickDown;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob.location()==null)
return true;
if(mob.amDead())
return true;
... | 9 |
private boolean addCardAtRandom(PlayingCard card)
{
int[] validIndexes=new int[cardsInDeck.length];
int counter=0;
for(int i=0; i<cardsInDeck.length;i++)
{
if(cardsInDeck[i]==null)
{
validIndexes[counter++]=i;
}
}
if(counter==0)
{
return false;
}
int index=random.nextInt(counter);
c... | 3 |
static int findFactorByLimit(final long base)
{
final long value = Math.abs(base);
int from = 0;
int to = LIMITS.length - 1;
if (value <= LIMITS[to])
{
return to;
}
if (value > LIMITS[0])
{
return 0;
}
do
{
final int mid = (from + to) >> 1;
if (LIMITS[mid] >= value)
{
if (LIMITS[mid + 1] <... | 6 |
public void drawShips(Ship player) {
g2d.setTransform(identity);
Collection<Ship> ships = DataController.getInstance().getShips();
Point playerPoint = player.getCenter();
for(Ship s: ships){
if(s == player){
continue;
}
Point sPoint = s.getCenter()... | 6 |
void removeInternal(Node<K, V> node, boolean unlink) {
if (unlink) {
node.prev.next = node.next;
node.next.prev = node.prev;
}
Node<K, V> left = node.left;
Node<K, V> right = node.right;
Node<K, V> originalParent = node.parent;
if (left != null && right != null) {
/*
*... | 8 |
@Override
public boolean onCommand(CommandSender sender, Command command,
String lable, String[] args) {
Player player = null;
Player toPlyer = null;
String toPlayer = "";
String fromPlayer = "";
String fromBoxel = "";
if (!(sender instanceof Player)) {
master.getLogManager().info(
"You can... | 5 |
protected final void assertInvariants( LongMap<V> map ) {
LongSet keySet = map.keySet();
Collection<V> valueCollection = map.values();
Set<Entry<V>> entrySet = map.entrySet();
assertEquals( map.size() == 0, map.isEmpty() );
assertEquals( map.size(), keySet.size() );
asse... | 8 |
public boolean postMortem(PostMortem pm) {
JSONzip that = (JSONzip) pm;
return this.namehuff.postMortem(that.namehuff)
&& this.namekeep.postMortem(that.namekeep)
&& this.stringkeep.postMortem(that.stringkeep)
&& this.stringhuff.postMortem(that.stringhuff)
... | 4 |
static void preprocess(char[] p) {
int i = 0, j = -1, m = p.length;
b = new int[p.length + 1];
b[0] = -1;
while (i < m) {
while (j >= 0 && p[i] != p[j])
j = b[j];
b[++i] = ++j;
}
} | 3 |
static void lengthLimitedCodeLengths(Cookie cookie, int[] frequencies, int maxBits,
int[] bitLengths) {
cookie.resetPool();
int n = frequencies.length;
int nn = 0;
Node[] leaves = cookie.leaves1;
for (int i = 0; i < n; i++) {
i... | 8 |
public ReDrawer(int id, int offset, CyclicBarrier cb) {
this.id = id;
this.offset = offset;
this.cb = cb;
} | 0 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final int PENNIES_PER_DOLLAR = 100;
final int PENNIES_PER_QUARTER = 25;
final int PENNIES_PER_DIME = 10;
final int PENNIES_PER_NICKEL = 5;
final int PENNIES_PER_PENNY = 1;
System.out.print("En... | 0 |
public void mostrarAdmins(){
if(admins.size() > 0){
for(beansAdministrador admin : admins){
System.out.println("----------------------------------");
System.out.println("Nombre --> "+admin.getNombre());
System.out.println("Nick --> "+admin.getNick());
System.out.println("Edad ... | 2 |
private static int setInOrderPosition(Integer[] a, int pos, int startIndex, int endIndex) {
swap(a, pos, endIndex);
int firstSmallerValuePosition = startIndex;
for (int i = startIndex; i <= endIndex; i++) {
if (a[i] >= a[endIndex]) {
swap(a, i, firstSmallerValuePositi... | 2 |
private void ensureCapacity() {
if (elements.length == size)
elements = Arrays.copyOf(elements, 2 * size + 1);
} | 1 |
public String toString(String input) {
return name + calc(input);
} | 0 |
protected void generateFile(Configuration config, Table table, List<File> templateFiles) {
try {
System.out.println("#############-------------开始生成代码-----------#############");
for (File templateFile : templateFiles) {
String templateRelativePath = templateFile.getName();
if (templateFile.isDirectory() ... | 7 |
public void setPaused(boolean paused) {
if (this.paused != paused) {
synchronized (pausedLock) {
this.paused = paused;
if (!paused) {
// restart sounds
pausedLock.notifyAll();
}
}
}
} | 2 |
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if (arg0.isMetaDown())
{
//popup.show(arg0.getComponent(),arg0.getX(),arg0.getY());
buildPopUp(arg0);
}
else if(arg0.getSource() == popDelete)
{
deleteRows();
}
else if(arg0.getSource() == popOpen)
... | 8 |
public static void main(String [] args) {
try {
if (args.length < 1) {
System.err.println("Usage : weka.gui.visualize.Plot2D "
+"<dataset> [<dataset> <dataset>...]");
System.exit(1);
}
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Explorer: Visualize");
jf.setSize(500... | 7 |
public String getColumnData(int i) throws Exception {
if (i == 0)
return getFileID();
else if (i == 1)
return getProjectID();
else if (i == 2)
return getFormat();
else if (i == 3)
return getFileName();
else if (i == 4)
return getLocation();
else
throw new Exception... | 5 |
private Node put(Node h, Key key, Value val){
if(h == null)
return new Node(key, val, 1, RED);
int cmp = key.compareTo(h.key);
if(cmp < 0) h.left = put(h.left, key, val);
else if(cmp > 0) h.right = put(h.right, key, val);
else h.val = val;
if(isRed(h.right) && !isRed(h.left)) h = rotateLeft(h);
if(i... | 9 |
public void checkIP(List<String> ip){
System.out.println("reachable ip:----------------->");
Socket socket = null;
for (String url : ip) {
boolean reachable = false;
try {
socket = new Socket();
// set timeout to 3 seconds
socket.connec... | 5 |
public Fruit (Room room, int type){
this.room = room;
this.type = type;
switch (type){
case 1: points = 100;
break;
case 2: points = 300;
break;
case 3: points = 500;
break;
case 4: points = 700;
... | 8 |
private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
... | 9 |
private String toHtmlTd(Object obj) {
String result = null;
if (obj == null) {
result = "<td x:str></td>";
} else if (obj instanceof StdStyledCell) {
StdStyledCell cell = (StdStyledCell)obj;
StringBuilder sb = new StringBuilder();
StringBuilder style = new StringBuilder();
// スタイルの作成
if (cell.ge... | 8 |
public static boolean illegalIdentifier(String identifier) {
return identifier.equals("do") || identifier.equals("if")
|| identifier.equals("for") || identifier.equals("try")
|| identifier.equals("int");
} | 4 |
public void processMouseDragged(int x, int y)
{
// WE MAY HAVE TO USE VALUES IN POSE SPACE
Rectangle2D.Double poseArea = zoomableCanvasState.getPoseArea();
int incX = x - lastMouseDraggedX;
int incY = y - lastMouseDraggedY;
lastMouseDraggedX = x;
lastMouseDraggedY = y... | 7 |
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
cp.newUTF8(desc);
if (visible) {
cp.newUTF8("RuntimeVisibleAnnotations");
} else {
cp.newUTF8("RuntimeInvisibleAnnotations");
}
return new AnnotationConstantsCollector(fv.visitAnnotation(desc,
visible), cp);
} | 1 |
public FileBasedCobweb(String startSite, String dirPath, Cobweb spiderEngine) {
super(startSite, dirPath, spiderEngine);
} | 0 |
public Purchase makePurchase(int id_user, int cost, String type, int id) throws DataBaseConnectorException {
Purchase purchase = new Purchase();
try {
if(type == null){
throw new DataBaseConnectorException("Shopping error ^_^ (type == null): ");
}else if(type.equa... | 7 |
public BFSPerformanceTest() {
} | 0 |
public /*@pure@*/ boolean checkInstance(Instance instance) {
if (instance.numAttributes() != numAttributes()) {
return false;
}
for (int i = 0; i < numAttributes(); i++) {
if (instance.isMissing(i)) {
continue;
} else if (attribute(i).isNomina... | 8 |
public void mainLoop() {
String input;
do {
// show the player where they are to start off
player.getLocation().printInfo();
input = Printer.getInput();
if (move(input))
continue;
switch (input) {
case "look":
// don't know if title should be included
player.getLocation().printDes... | 6 |
@Override
public double[] intersect(Ray ray) {
Vector3 rayToTop = ray.getFrom().subtract(top);
double AxR = direction.dotProduct(ray.getDirection());
double AxBR = direction.dotProduct(rayToTop);
double cosSquare = Math.pow(Math.cos(angle), 2);
double paramA... | 5 |
public String expression(){
if(this.randomXY <= 0.5){
result = "X";
}
else{
result = "Y";
}
return result;
} | 1 |
public String toComplexString() {
if(this.b>=0)
return String.format("%.3f +%.3fi", this.a+this.b*Math.cos(ALPHA), this.b*Math.sin(ALPHA));
else
return String.format("%.3f %.3fi", this.a+this.b*Math.cos(ALPHA), this.b*Math.sin(ALPHA));
} | 1 |
public void setValueAt( Object aValue, int row, int column )
{
boolean onlyThisRowChanged = true ;
Row r = rows.elementAt( row ) ;
String strValue ;
if ( aValue instanceof String )
strValue = (String)aValue ;
else
strValue = aValue.toString() ;
if (... | 9 |
public DirectedGraph<String, DefaultEdge > parseHPO(BlastProtein Protein) throws Exception {
// Query Hashtable for geneID
String GeneID = ProtGeneMap.get(Protein.getId());
// Graph Data structures
DirectedGraph<String, DefaultEdge > Graph = null;
Graph = new SimpleDirectedGraph<String, DefaultEdge>(De... | 9 |
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(Task.PROP_DUE_DATE)
|| evt.getPropertyName().equals(Task.PROP_DUE_DATE_REMINDER)
|| evt.getPropertyName().equals(Task.PROP_START_DATE)
|| evt.getPropertyName().equals(Task.PROP_START_DATE_REMINDER)
|| evt... | 6 |
private ArrayList<Image> getDataFromDataBaseOracle() throws SQLException{
DbHandler db = new DbHandler();
Statement st = db.connect();
ArrayList<Image> files = null;
ArrayList<Rute> rutes = db.getRutes(st);
for (Rute r : rutes) {
ArrayList<Image> images = db.getImage... | 9 |
@Override
public ServerModel acceptTrade(AcceptTradeRequest request, CookieParams cookie) throws InvalidMovesRequest {
if(request == null) {
throw new InvalidMovesRequest("Error: invalid accept trade request");
}
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
if (request.isWillAc... | 2 |
private void generateAllOperators(HallInfo h) {
if (h == null) {
h = hallInfo;
if (operationCount > 0)
return;
operations = new SymmetryOperation[4];
operationCount = 0;
if (hallInfo == null || hallInfo.nRotations == 0)
h = hallInfo = new HallInfo(hallSymbol);
setLattice(hallInfo.latticeCode... | 8 |
@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 Teacher)) {
return false;
}
Teacher other = (Teacher) object;
if ((this.idTeacher == null && other.idTeacher !=... | 5 |
@Basic
@Column(name = "employee_id")
public int getEmployeeId() {
return employeeId;
} | 0 |
public void actionOcurred(GameAction action){
if (gameOver) return;
// if (gameOver) throw new IllegalStateException("Game is over! No actions accepted");
if (isGameOver(successRule, action) && listener != null) listener.onGameSuccess();
if (isGameOver(failRule, action) && listener != null) listener.onGam... | 5 |
private String getDowJonesValue ()
{
String dowJonesValue = "0";
try (final Scanner dowJonesWebPage = new Scanner (new URL (FieldGoogleFinance.URL.toString()).openStream()))
{
boolean lastPriceHasFind = false;
boolean changePercentHasFind = false;
while (dowJonesWebPage.hasNext() && ((! lastPrice... | 7 |
@Override
public void changedBroadcast(boolean enabled){
if(enabled){
broadcastChkbox.setSelected(true);
} else {
broadcastChkbox.setSelected(false);
}
} | 1 |
public String getShareKey() {
return shareKey;
} | 0 |
public static DoubleMatrix createAverages(int w, int h, double... values) {
if (w == 0 || h == 0)
throw new IllegalArgumentException(
"Dimensions must be bigger than 0!");
double sum = 0;
for (double value : values)
sum += value;
double avgs[... | 5 |
public static void main(String[] args) {
int[] src = new int[TOTAL_ELEMENTS];
for (int i = 0; i < TOTAL_ELEMENTS; i++)
src[i] = i + 1;
System.out.print("Source array : ");
for (int i = 0; i < TOTAL_ELEMENTS; i++)
System.out.print(src[i] + " ");
System.out.println();
int destSize = src.length / 2;
... | 3 |
LexingState(TokenStream stream) {
this.regExpFlags = stream.regExpFlags;
if (stream.stringBufferTop > 0) {
this.bufferedString = new String(TokenStream.stringBuffer, 0, stream.stringBufferTop);
}
this.xmlOpenTagsCount = stream.xmlOpenTagsCount;
... | 7 |
@Override
public boolean equals(Object obj) {
if (obj instanceof ScreenCharacter == false) {
return false;
}
final ScreenCharacter other = (ScreenCharacter) obj;
return character == other.character && foregroundColor == other.foregroundColor && backgroundColor == other.backgroundColor && bold == other.bold... | 7 |
public static void main(String[] args) throws Exception
{
Class<?> classType = Class.forName("java.lang.String");
Object array = Array.newInstance(classType, 10);
Array.set(array, 4, "ArrayTest");
String str = (String)Array.get(array, 4);
System.out.println(str);
} | 1 |
public int getValue()
{
int faceValue = 0;
if (this.getFace() == "Seven") {
faceValue = 7;
} else if (this.getFace() == "Eight") {
faceValue = 8;
} else if (this.getFace() == "Queen") {
faceValue = 9;
} else if (this.getFace() == "King") {
faceValue = 10;
} else if... | 8 |
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
in.nextLine();
List<Integer> strengths = new ArrayList<Integer>();
for (int i = 0; i < N; i++) {
strengths.add(in.nextInt());
in.nextLine();
}
... | 4 |
public void rotate(boolean clockWise)
{
if(!currentCreatedAndMovable)
return;
try
{
lock.acquire();
}
catch (InterruptedException e)
{
return;
}
for(int i = 0; i < currentBlock.length; i+... | 6 |
private static void inputStrToList(String cleanString) {
//deletion of blanks at beginning or end of String
if (cleanString.startsWith(" ")) {
cleanString = cleanString.substring(1);
}
//temporary linked list with userInput
LinkedList finalInputList = new <String>... | 5 |
public void ParseElements(Node parentElement) {
Node child = parentElement.getFirstChild();
while (child != null) {
String nodeName = child.getNodeName();
if (nodeName == "has") {
ConditionType = ConditionTypeENUM.OWNER;
if (child.getFirstChild().getNodeValue().charAt(0) == 'y') {
has = true;... | 6 |
public static void main(String args[]) {
/* Set the Windows 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://dow... | 6 |
public static void handleHelloReply(HTSMsg msg, HTSPClient client){
Collection<String> requiredFields = Arrays.asList(new String[]{"htspversion","servername","serverversion","servercapability","challenge"});
if (msg.keySet().containsAll(requiredFields)){
for(String s : msg.keySet()){
if(s.equals(HTSPVERSION)... | 9 |
public void resize(double scaleFactor){
if (Debug.audio) System.out.println("AudioPlayer -> Resize called");
if((null != player) && (realizeComplete)){
scaledXCoord = (int) (scaledXCoord * scaleFactor);
scaledYCoord = (int) (scaledYCoord * scaleFactor);
scaledXDim = (int) (scaledXDim * scaleFactor);
... | 4 |
public TweetMap() {
for (int i = 0; i < getSize(); i++) {
Status status = tweets.get(i);
String result = "<html><a href='www.twitter.com'>"
+ status.getUser().getName() + "</a>" + " : "
+ status.getText() + "</html>";
listData.add(result);
}
} | 1 |
public Tile(Sprite sprite, boolean solid) {
this.sprite = sprite;
this.solid = solid;
} | 0 |
private Color deserialiseColour(String c) throws NumberFormatException {
String[] parts = c.split(" ");
int r, g, b, a;
Color result;
if (parts.length >= 3) {
r = Integer.parseInt(parts[0]);
g = Integer.parseInt(parts[1]);
b = Integer.parseInt(parts[2]... | 2 |
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.