text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected synchronized void execute(boolean synchronous) {
// see if we're already running
if (thread != null) {
// we're already running. Make sure we wake up on any change.
synchronized (statusLock) {
statusLock.notifyAll();
}
return;
... | 3 |
private void adjustMinPrefForSpanningComps(DimConstraint[] specs,
Float[] defGrow, FlowSizeSpec fss,
ArrayList<LinkedDimGroup>[] groupsLists) {
for (int r = 0; r < groupsLists.length;
r++) {
ArrayList<LinkedDimGroup> groups = groupsLists[r];
for (... | 9 |
public void SendText(){
String x = Tinput.getText ();
//Checks to see if it is a server command
if(x.length() > 5 && x.substring(0,5).equals("serv.")){
send(x);
}
else if (!x.equals(""))
{
x = Username + ": " + Tinput.getText (... | 3 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
int completion=16;
final Item fire=getRequiredFire(mob,0);
if(fire==null)
return false;
final PairVector<EnhancedExpertise,Integer> enhancedTypes=enhancedTypes(mob,commands);
buildingI=null;... | 7 |
public static User readFrom(HttpServletRequest request) throws Exception {
Cookie[] cookies = request.getCookies();
if (cookies == null || cookies.length == 0) {
return null;
}
for (Cookie cookie: cookies) {
if ("FB_ID".equals(cookie.getName())) ... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public SampleComperator(boolean decreasing_order) {
order = decreasing_order ? -1 : 1;
} | 1 |
public int getUpcomingEventsCount() {
return upcomingEventsCount;
} | 0 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public boolean isElementPresent(By by) {
try {
List allElements = driver.findElements(by);
if ((allElements == null) || (allElements.size() == 0))
return false;
else
return true;
}
catch(java.util.NoSuchElementException e)
... | 3 |
private boolean checkClass(HashMap<String, ClassInfo> db, ClassInfo info) {
if(info == null) {
return false;
}
/* check extends */
for(String cls : classes) {
if(cls.equals(info.superName)) {
return true;
}
}
/* check implements */
String[] clsImpl = info.getInterfaceNames();
for(String r... | 9 |
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerCommand(PlayerCommandPreprocessEvent event) {
DwDPlayer pCheck = DwDPlayers.getPlayer(event.getPlayer().getUniqueId());
DwDBridgePlugin plugin = DwDBridgePlugin.getPlugin();
if (event.getMessage().toLowerCase().startsWith("/co... | 8 |
public ZoomPane(SelectionDrawer drawer) {
super(drawer);
drawer.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
transform = null;
}
});
} | 0 |
public int run()
{
qSortMedianThree(aInt, 0, aInt.length-1);
return 0;
} | 0 |
public void dispose(boolean cache) {
// dispose the nameTree
if (nameTree != null) {
nameTree.dispose();
namesTreeInited = false;
if (!cache)
nameTree = null;
}
if (pageTree != null) {
pageTree.dispose(cache);
i... | 6 |
@Test
public void testCmd() throws Exception
{
for (CommandBase command : container.getCommands())
{
try
{
assertTrue(command.execute(new CommandInvocation(null, command.getDescriptor().getDescription(), scm.getProviderManager())));
}
... | 2 |
private String formatNoteElementLabel(NoteElement element) {
String noteText = ensureTextIsValid(element.getText().toString());
// does the note provides its own wrap
if(noteText.contains("\\n"))
return noteText;
return wrap(noteText, noteWrapLength, "\\n", false);
} | 1 |
public void PrintMe(String _title)
{
System.out.println(_title);
for(int i=0;i<Block.N;i++)
{
System.out.println();
for (int j = 0; j < Block.N; j++)
{
System.out.print(this.block[i][j] + " ");
}
}
} | 2 |
@Override
public int compareTo(final Version other) {
if (this == ALL || other == ALL) {
return 0;
}
int c = modifier.compareTo(other.modifier);
if (c != 0) {
return c;
}
c = major - other.major;
if (c != 0) {
return c;
}
c = minor - other.minor;
if (c != 0) {
return c;
}
return rev... | 5 |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDeath(EntityDeathEvent event){
//check if the entity is tagged
Entity dead = event.getEntity();
int id = dead.getEntityId();
if(plugin.getMobsTagged().containsKey(id)){
Player killer = plugin.getSer... | 4 |
public static void main(String[] args) {
// TODO Auto-generated method stub
} | 0 |
public double interpolate(double xx){
double h=0.0D,b=0.0D,a=0.0D, yy=0.0D;
int k=0;
int klo=0;
int khi=this.nPoints-1;
while (khi-klo > 1){
k=(khi+klo) >> 1;
if(this.x[k] > xx){
khi=k;
}
else{
klo=k;
}
}
h=this.x[khi]-t... | 3 |
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Reference")
public JAXBElement<ReferenceType> createReference(ReferenceType value) {
return new JAXBElement<ReferenceType>(_Reference_QNAME, ReferenceType.class, null, value);
} | 0 |
public static Cons matchPatternElement(Symbol patternElement, Stella_Object datumElement) {
if (Stella_Object.isaP(datumElement, Stella.SGT_STELLA_CONS)) {
{ Stella_Object datumType = ((((Cons)(datumElement)).value == Stella.SYM_STELLA_SPECIAL) ? ((Cons)(datumElement)).rest.value : ((Cons)(datumElement)).valu... | 7 |
private T getHermanoABBUtil(NodoArbol <T> nodo, T dato) {
int i;
if(nodo == null || nodo.dato == null)
return null;
if(containsABBRecursivo(dato) == false)
return null;
if(dato == this.raiz.dato)
return null;
if(nodo.der.dato.compareTo(dato)... | 9 |
public static Rate parse(final String name, byte[] rateBytes) throws ParseException {
Rate rate;
int rateUnit = rateBytes[4] + rateBytes[5] * 16;
if (rateUnit == 0) {
int frequency = 0;
for (int i = 0; i < 4; i++) {
frequency += (rateBytes[i] * Math.pow(16... | 9 |
private Entity getEntityAt(Position pos, Environment enviro) {
ArrayList<Entity> entities = enviro.getEntities();
Entity closest = entities.get(0);
for(int i = 1; i < enviro.getEntityAmount(); i++){
Entity x = entities.get(i);
if(x.getPosition().x()-pos.x() < closest.getPosition().x()- pos.x()){
if(x.ge... | 4 |
public void atNewArrayExpr(NewExpr expr) throws CompileError {
int type = expr.getArrayType();
ASTList size = expr.getArraySize();
ASTList classname = expr.getClassName();
ASTree init = expr.getInitializer();
if (init != null)
init.accept(this);
if (size.leng... | 4 |
String getCurrentOrientation() {
axisangleT.set(matrixRotate);
float degrees = axisangleT.angle * degreesPerRadian;
StringBuffer sb = new StringBuffer();
if (degrees < 0.01f) {
if (matrixRotate.m00 == -1.0f || matrixRotate.m11 == -1.0f || matrixRotate.m22 == -1.0f) {
sb.append(" 1000 0 0 -180"); // rear ... | 9 |
static final void indent(Writer writer, int indent) throws IOException {
for (int i = 0; i < indent; i += 1) {
writer.write(' ');
}
} | 1 |
public void clear (int color){
for(int i = 0; i < pixels.length; i++){
pixels[i] = color;
}
} | 1 |
public boolean processRead(SocketChannel sc) throws IOException,
RemoteSocketClosedException {
final String socketAddresss = ServerLogger.parseSocketAddress(sc);
if (disconnectionRequested) {
// Block the reads if a disconnect was requested, let the outbound
// buffer clear itself.
LOGGER.log(new Clien... | 8 |
public void setLocationFromPriority(){
switch(priority){
case 1:{
setxCoord(1600);
setyCoord(40);
break;
}
case 2:{
setxCoord(1640);
setyCoord(90);
break;
}
... | 5 |
public void setSignDatetime(Date signDatetime) {
this.signDatetime = signDatetime;
} | 0 |
public boolean isSymmetric(treeNode root) {
if(root == null)
return true;
return treesSymmetric(root.leftLeaf,root.rightLeaf);
} | 1 |
private void jTextFieldSearchEmpruntKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchEmpruntKeyTyped
// TODO add your handling code here:
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
String toSearch = jTextFieldSearchEmprunt.getText();
if (jRadioButtonIdEm... | 9 |
static int f(int x,int y,int z){
LinkedList<int[]> cola=new LinkedList<int[]>();
cola.add(new int[]{x,y,z,0});vis[x][y][z]=true;
for(int[] u;!cola.isEmpty();){
u=cola.pollFirst();
if(mat[u[0]][u[1]][u[2]]=='E')return u[3];
for(int i=0;i<3;i++)
for(int h=-1;h<2;h+=2)
if(u[i]+h>=0&&u[i]+h<t[i]){
... | 8 |
protected static boolean isAListChar(char character) {
switch (character) {
case ':':
case ';':
case '#':
case '*':
return true;
}
return false;
} | 4 |
public void fireSubLWorkerDataAvailableEvent(SubLWorkerEvent event) {
if (event.getEventType() != SubLWorkerEvent.DATA_AVAILABLE_EVENT_TYPE) {
throw new RuntimeException("Got bad event type; " +
event.getEventType().getName());
}
synchronized(listeners) {
Object[] curListeners = listeners... | 4 |
public void update() {
super.update();
if(fireRate>0) fireRate--;
int xa = 0, ya = 0;
if(anim < 7500)
anim++;
else
anim = 0;
if(input.up.down) ya--;
if(input.down... | 9 |
public static void loadBinary(LC3Bridge bridge, String filename) throws IOException
{
FileInputStream stream = null;
byte[] buffer = null;
try
{
File handle = new File(filename);
stream = new FileInputStream(handle);
buffer = new byte[(int)handle.length()];
stream.read(buffer);
}
catch ... | 6 |
protected int read_(long pos, byte[] b, int offset, int len) throws IOException {
file.seek(pos);
int n = file.read(b, offset, len);
if (debugAccess) {
if (showRead) System.out.println(" **read_ " + location + " = " + len + " bytes at " + pos + "; block = " + (pos / buffer.length));
debug_nseeks... | 4 |
public void multiply() {
System.out.println("Enter the range ");
int n=in.nextInt();
int[][] multTable=new int[n+1][n+1];
for (int i=1;i<=n;i++)
{
System.out.println("Multiplication table of " + i);
for (int j=1;j<=n;j++)//j<=10
{
multTable[i][j] = i*j;
System.out.println(i + "*" + j + " = " ... | 2 |
private void saveParagraph(org.w3c.dom.Document xmlDoc, Paragraph para, Element paraElt) {
for (Sentence sent : para.getSentences()) {
Element sentElt = xmlDoc.createElement("sentence");
sentElt.setAttribute("id", Integer.toString(sent.getId()));
// prepare plain text
Element plainTextElt = xmlDoc.createE... | 4 |
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
if (args.length == 0){
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
} else {
StringBuilder... | 9 |
public boolean SetTime(int responseTime){
boolean test = false;
if (test || m_test) {
System.out.println("OthelloAI :: SetTime() BEGIN");
}
m_time = responseTime;
if (test || m_test) {
System.out.println("ConnectFourAI :: SetTime() END");
}
return true;
} | 4 |
public void setAge(int age) {
Age = age;
} | 0 |
private PublicStaticFieldSingleton () {}; | 0 |
public String toFirstUpperCase(String title)
{
char[] c = title.toCharArray();
for(int i = 0; i < c.length; i++)
{
if(c[i] != ' ' && (i == 0 || c[i - 1] == ' '))
c[i] = (char)(c[i] - 32);
}
return new String(c);
} | 4 |
private CtClass searchImports(String orgName)
throws CompileError
{
if (orgName.indexOf('.') < 0) {
Iterator it = classPool.getImportedPackages();
while (it.hasNext()) {
String pac = (String)it.next();
String fqName = pac + '.' + orgName;
... | 3 |
protected void stableRun() {
// Timing varibles
long startTime = System.nanoTime(), waitTime, urdTime = 0;
int targetTime = 1000 / targetFramerate;
long tTime = 0;
int fCount = 0;
while (running) {
// Increment the amount of frames that have passed by one
fCount++;
// Add the time it took to com... | 4 |
Caller(Incrementable cbh) {
callbackReference = cbh;
} | 0 |
private double[] calculateNetworkConsumption(Message message, SoftwareSystem system) {
double consumption[] = { 0, -1 };
for (Connector connector : project.getConnectors())
if (connector.getComponent().equals(message.getSender()) && connector.getToInterface().equals(message.getSignature())) {
consumption[0] ... | 3 |
private boolean playerAttackCollision(){
if(!weapon){
CollisionResults [] results = new CollisionResults [4];
for(int i = 0; i < results.length; i++){
results[i] = new CollisionResults();
}
BoundingVolume bv = ((Node)getStageNode().getChild("Play... | 7 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerBetInteract(PlayerInteractEvent event) {
ItemStack itemInHand = event.getItem();
if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
Block clickedBlock = event.getClickedBlock();
if(! FancyRoulette.instance.tableManager.isBlockTile(cli... | 5 |
public void dostepnyFilm(Osoba osoba, Film film) {
osoba = em.find(Osoba.class, osoba.getId());
film = em.find(Film.class, film.getId());
Film usun = null;
// lazy loading here (person.getCars)
for (Film filmy : osoba.getFilm())
if (filmy.getId().compareTo(film.getId()) == 0) {
usun = filmy;
brea... | 3 |
public AlphabetDialog() {
this.setTitle("Customize Alphabet");
this.getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
this.setModal(true);
this.setBounds(200, 200, 400, 600);
this.changed = false;
//Initialize the alphabet combobox
final JTextArea taSymbols = new JTextArea()... | 9 |
public int[] generate(int nplayers, int bowlsize) {
int nfruits = nplayers * bowlsize;
int[] dist = new int[12];
int unit = nfruits / 12;
dist[0] = nfruits - unit * 11;
for (int i = 1; i < 12; i++)
dist[i] = unit;
return dist;
} | 1 |
public static double calGain(double rootEntropy, ArrayList<Double> subEntropies, ArrayList<Integer> setSizes, int data) {
double gain = rootEntropy;
for(int i = 0; i < subEntropies.size(); i++) {
gain += -((setSizes.get(i) / (double)data) * subEntropies.get(i));
}
return gain;
} | 1 |
public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.next... | 3 |
private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... | 5 |
public void increaseRope(int x , int y) {
if (ropelength < 125){
ropelength ++;
}
x += 1;
y += 2;
switch (ropelength) {
case 1: getWorld().addObject(rope, x, y); getWorld().addObject(ropeman, x, y+3); break;
case 25: y+= 2; getWorld().addObject... | 7 |
public static int minCut4(String s) {
int length = s.length();
int[] dp = new int[length + 1];
boolean[][] parlin = new boolean[length][length];
for (int i = length; i >= 0; i--) {
dp[i] = length - i;
}
for (int i = length - 1; i >= 0; i--) {... | 6 |
public void convertInfixArrayToPostFixArray(List<BaseOperClass> infixEquationArray)
{
Stack<BaseOperClass> tempStack = new Stack<BaseOperClass>();
for(BaseOperClass token : infixEquationArray)
{
if(token instanceof Operator)
{
while(tempStack.size() != 0 && tempStack.peek().getPrecedence() >= token.... | 5 |
private double runBestAlgorithm(String feature) {
// TODO Auto-generated method stub
//String language, double np, CoNLLHandler ch, String trainingCorpus, String rootHandling
File f=new File(feature);
if (f.exists()) {
CoNLLHandler ch=new CoNLLHandler(trainingCorpus);
AlgorithmTester at=new AlgorithmTester(... | 9 |
private long set_clock_time(String config_value)
{
String value = "0";
String identifier = "";
long time = 0;
/* loop to split string into value and identifier */
for (int i = 0; i < config_value.length(); i++)
{
if( (config_value.charAt(i) >= '0')
... | 7 |
private static void BinaryTreeMenu(BinaryTree<Integer> BinaryTree){
System.out.println("\nWhat do you want to do ?");
System.out.println(" 1) Insert");
System.out.println(" 2) Search");
System.out.println(" 3) Delete");
System.out.println(" 4) Print");
System.out.println("Enter your option and hit enter: (f... | 8 |
public static void spawnSkeletonWarriorGold (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton SkeletonWarriorIron = (Skeleton) loc.getWorld()
.spawnEntity(loc, EntityType.SKELETON);
SkeletonWarriorIron.getEquipment().setChestplate(
... | 1 |
public boolean equals (Particulier part)
{
boolean exists = false;
if ((this.getNom().equals(part.getNom())) && (this.getPrenom().equals(part.getPrenom())) && (this.getCivilite().equals(part.getCivilite())) && (this.getAdresse().equals(part.getAdresse()))
&& (this.getTelD().equals(part.g... | 7 |
public void move(String dir) {
if (dir.equalsIgnoreCase("up")) {
ypos--;
}
else if (dir.equalsIgnoreCase("down")) {
ypos++;
}
else if (dir.equalsIgnoreCase("left")) {
xpos--;
}
else if (dir.equalsIgnoreCase("right")) {
xpos++;
}
} | 4 |
public void lookForConstructorCall() {
type01Count = cons.length;
for (int i = 0; i < type01Count;) {
MethodAnalyzer current = cons[i];
FlowBlock header = cons[i].getMethodHeader();
/* Check that code block is fully analyzed */
if (header == null || !header.hasNoJumps())
return;
StructuredBlock ... | 8 |
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
double a = s.nextDouble();
double b = s.nextDouble();
double c = s.nextDouble();
if(Math.abs(b-c) < a && a < b+c && Math.abs(a-c) < b && b < a+c && Math.abs(a-b)... | 6 |
private void avaliarCaso(boolean avaliacao) {
try {
admin.avaliarCaso(avaliacao);
removerPainelCaso();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this, "Erro ao atualizar a base de dados... Por favor contacte um administrador.\nA sair do programa...");
... | 6 |
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[41];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 15; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... | 9 |
private void loadTowerPref() {
Scanner scanner = null;
try {
scanner = new Scanner(new FileInputStream("res" + File.separator + "towerPref.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String currentLine;
String[] lineTowerLevelArray;
String[] lineTowerPrefArray;
ArrayList<A... | 5 |
private StringBuilder add(CharSequence num1, CharSequence num2) {
StringBuilder builder = new StringBuilder();
int maxLen = Math.max(num1.length(), num2.length());
boolean carryOne = false;
for (int i = 0; i < maxLen; i ++) {
char c1 = '0';
char c2 = '0';
... | 8 |
public void mouseMoved(MouseEvent e) {
if (shiftPressed) {
int oldMouseX = mouseX;
int oldMouseY = mouseY;
mouseX = e.getX();
mouseY = e.getY();
if (mouseX > oldMouseX) {
// Mouse moved right
// scene.adjustCameraX(.01f);
} else if (mouseX < oldMouseX) {
// Mouse moved left
// scene.... | 5 |
@Override
public void actionPerformed(ActionEvent arg0) {
// Making a lot of assumptions about what could possibly result in an event
String command = ((JMenuItem) arg0.getSource()).getText();
if(command.equals(HIDE_MENU_ITEM_TEXT)) {
toggleVisible();
} else if(command.equals(SAVE_MENU_ITEM_TEXT)) {
... | 5 |
public ListFiles(String wd){
thisFolder=new File(wd);
listOfFiles= thisFolder.listFiles();
int jj=0,ii=0;
System.out.println("Directories");
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isDirectory())
{
jj++;
System.out.println("["+jj+"] "+ listOfFiles... | 6 |
public static boolean Connect(String connection, String user, String password){
boolean result = false;
try {
//String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
// String url = "jdbc:odbc:northwind";
//String username = "";
//String password = "";
... | 4 |
@Override
public List<Integer> getTopRankedRoles(Function func)
{
final List<ClanPosition> allRoles=new LinkedList<ClanPosition>();
for(final ClanPosition pos : govt().getPositions())
{
if((func==null)||(pos.getFunctionChart()[func.ordinal()]!=Authority.CAN_NOT_DO))
allRoles.add(pos);
}
final List<In... | 7 |
private void timetablePage(){
timetablePane = new JPanel();
timetablePane.setBackground(SystemColor.activeCaption);
timetablePane.setLayout(null);
JLabel lblTimetable = new JLabel("Timetable");
lblTimetable.setHorizontalAlignment(SwingConstants.CENTER);
lblTimetable.setFont(new Font("Arial", Font.BOLD, 3... | 0 |
public Object getProperty(Class<?> clazz, Object key) {
Object value = this.systemProperties.get(key);
if (value != null) {
return value;
}
if (customConfigurator != null) {
value = customConfigurator.apply(key);
if (value != null) {
re... | 5 |
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... | 6 |
public int pointsPulled(){
int sum = 0;
for(int n : toPar){
if(n > 2) sum += -1;
if(n == 2) sum = sum;
if(n == 1) sum += 1;
if(n == 0) sum += 2;
if(n == -1) sum += 4;
if(n == -2) sum += 8;
if(n == -3) sum += 10;
... | 8 |
public static void main(String ar[])
{
try{
int k=1;
int numD;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
numD=Integer.parseInt(br.readLine());
int y=0;
while(k-1 < (numD + y))
{
y++;k<<=1;
}
System.out.println("Y Out" + y);
k>>>=1;
in... | 8 |
public static Map<String, String> simpleCommandLineParser(String[] args) {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i <= args.length; i++) {
String key = (i > 0 ? args[i - 1] : null);
String value = (i < args.length ? args[i] : null);
if (key == null || key.star... | 9 |
public void mouseExited(MouseEvent e) {
} | 0 |
private static boolean canDecrease(int[] A, int index, int leng){
int cnt = 0;
int secondMax = Integer.MIN_VALUE;
for(int k=0;k<leng-1;k++){
if(A[index-k-1]>=A[index]) cnt++;
if(k==1) secondMax = A[index-k-1];
}
return cnt<2 && secondMax<A[index]-1;
} | 4 |
public Window() throws IOException {
//Window creation start
super(WordUtils.capitalizeFully(properties.propertiesInit("resources/universe.txt", "universe", 0)));
Main.setUniverse(WordUtils.capitalizeFully(properties.propertiesInit("resources/universe.txt", "universe", 0)));
setSize(800, 600);
setResizable(tr... | 7 |
@Override
public void finishTurn(IPresenter presenter) {
MoveResponse response = presenter.getProxy().finishTurn(presenter.getPlayerInfo().getIndex(), presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter.updateServerModel(response.getGameModel());
presenter.setVersion(presen... | 2 |
private void performOperation(List<String> values){
for(int i = 0;i<values.size();i++)
{
char[] c = values.get(i).toCharArray();
char previousChar = ' ',currentChar=' ';
switch(c[0]){
case 'A':
System.out.println("A found");
break... | 8 |
public static void registerExceptionHandler() {
Logger.getLogger(ExceptionHandler.class.getName()).entering(ExceptionHandler.class.getName(), "registerExceptionHandler");
Enumeration<String> loggers = LogManager.getLogManager().getLoggerNames();
while (loggers.hasMoreElements()) {
Lo... | 9 |
private void checkportfolio() {
String response = "Your current balance is $" + user.getBalance();
System.out.println("Your current balance is $" + user.getBalance());
ArrayList<UserStocks> portfolio = user.getUserStock();
if (portfolio != null) {
System.out.println("Your portfolio is as follows :");
Sys... | 2 |
public static String getMessage(int status) {
// method from Response.
// Does HTTP requires/allow international messages or
// are pre-defined? The user doesn't see them most of the time
switch (status) {
case 200:
if (st_200 == null)
st_200 = sm.getString("sc.200");
return st_200;
case 302:
... | 8 |
public synchronized Connection getConnection()
{
Connection connection = null;
// Check if there is a connection available. There could be times when all the
// connections in the pool may be used up
if (connectionPool.size() > 0)
{
connection = connectionPool.get(0);
... | 7 |
private void initFond(Graphics2D g) {
if (!initiated) {
InputStream is = this.getClass().getClassLoader()
.getResourceAsStream("fonts/TechnoHideo.ttf");
try {
font = Font.createFont(Font.TRUETYPE_FONT, is);
} catch (Exception e) {
e.printStackTrace();
font = new Font(Font.SANS_SERIF, 4, 4)... | 2 |
public static void main(String[] args) {
Deck deck = new Deck();
deck.shuffle();
PokerHand hand = deck.deal(5);
hand.shuffle();
hand.print();
if (hand.isStraight()) System.out.println("straight");
if (hand.hasStraightFlush()) System.out.println("straight flush");
i... | 9 |
public void setY2Coordinate(double y)
{
this.y2Coordinate=y;
} | 0 |
@Override
public void run() {
while(true){
// If we us the HMI at all process inputs
if(hmi.useHMI){
// First process commands from remote control, which is more important than sending data for visualization.
processInputs();
}
try{
Thread.sleep(100);
} catch(Interrupte... | 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.