text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static User getUserByUsername(String username, ArrayList<User> users) {
// search for user from array of users
for (User u : users) {
if (u.getUsername().equalsIgnoreCase(username)) {
return u;
}
}
return null;
} | 2 |
private boolean jj_2_1(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
} | 1 |
public boolean removeFreeTile(int x, int y) {
for (int i = 0; i < freeTiles.size(); i++) {
Tile t = freeTiles.get(i);
if (t.getX() == x && t.getY() == y) {
freeTiles.remove(i);
return true;
}
}
return false;
} | 3 |
private String comboList(){
if(currentComboNo == 1){
return "Punch1";
}
if(currentComboNo == 2){
return "Punch2";
}
if(currentComboNo == 3){
return "Kick";
}
if(currentComboNo == 4){
return... | 8 |
public static MethodData read(ClassData classData, MethodInfo methodDesc) throws FormatException {
String methodName = methodDesc.resolveName();
String descriptor = methodDesc.resolveDescriptor();
List<Type> params = extractParamTypes(descriptor);
Type returnType = extractReturnType(des... | 9 |
public String subMessage(String message, String pName, Integer remWarnings) {
String remWarningRegex = "%remwarning%";
String sRegex = "%s%";
String nameRegex = "%player%";
String actionRegex = "%action%";
String action = (getBanAction()) ? "banned" : "kicked";
String s = (remWarnings == 1) ? "" : "s";
me... | 2 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String userType = "Guest";
String firstNam... | 9 |
public PacketFactory(int totalNumberOfPackets,int packetSize, int totalNumberOfInputBuffers, long SEED)
{
//initialize the seed used by the simulator
this.SEED = SEED;
//initialize the random
rnd = new Random(this.SEED);
//initialize the packet sequence
sequence = 1;
... | 1 |
@Override
public String execute() throws Exception {
HttpSession session = ServletActionContext.getRequest().getSession();
User user = (User) session.getAttribute(com.ccf.action.user.UserLoginAction.USER_SESSION);
if (user == null)
return LOGIN;
if (action == null || cid == null || sender == null || rece... | 8 |
public Object getField(Integer field) {
switch(field) {
case 1:
return field1;
case 2:
return field2;
case 3:
return field3;
case 4:
return field4;
case 5:
return field5;
... | 8 |
ImmutableListIterator<? extends T> current() {
if (current == null) {
l = left.iterator();
current = l;
}
if (current == l && !current.hasNext()) {
r = right.iterator();
current = r;
}
return curr... | 4 |
public static Alignment score_all_refs(String hyp,
List<String> refs,
List<String> reflens,
List<String> refids,
String refspan,
String hypspan,
CostFunction costfunc,
TerScorer calc) {
double totwords = 0;
String ref;
String refid = "";
... | 9 |
public List<String> loadExclusionWords(File path) throws FileNotFoundException, IOException {
List<String> list = new ArrayList<>();
BufferedReader br = new BufferedReader(new FileReader(path));
while (br.ready()) {
String line = br.readLine();
if (line.trim().length() > ... | 3 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try{
CashPurseAccount cashPurseAccount = new CashPurseAccount();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean isSuccess = cashPurseAccount.dep... | 3 |
public static void inBattle(){
while (GlobalParams.inBattle) {
new Enemy(GlobalParams.enemyName);
System.out.println("Чем нанести удар?");
System.out.println("Кулаки - 1");
if (GlobalParams.swordWeapon){System.out.println("Мечь - 2");}
new ToSay(ToSay.key);
if (ToSay.key.equals(GlobalPar... | 5 |
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 fe... | 6 |
public static List<Long> parseLongList(final Context context, final int position) {
if (position < 0 || context.arguments.size() <= position) return null;
final List<Long> values = new ArrayList<Long>();
for (final String s : context.arguments.get(position).split(","))
try {
... | 5 |
public static void main(String[] args)
{
try {
EventQueue.invokeLater(new Runnable() {
@Override
public void run()
{
new MainWindow().setVisible( true );
}
});
}
catch(Exception exc)
... | 1 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(nextDirection==-999)
return true;
if((theTrail==null)
||(affected == null)
||(!(affected instanceof MOB)))
return false;
final MOB mob=(MOB... | 9 |
public AutomatonType getAutomatonType(){
if(this.type!= null)
if(this.type.equals("AFD"))
return AutomatonType.AFD;
else if(this.type.equals("AFN"))
return AutomatonType.AFN;
else if(this.type.equals("AFNE"))
return AutomatonTy... | 4 |
public Entity findEntity(int ID, String layerName) {
Layer L = findLayerByName(layerName);
if (L != null) {
for (Entity e : L.getEntList() ) {
if (e.getID() == ID) {
System.out.println("FoundEntity");
return e;
... | 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... | 7 |
@Override
public void close() {
// TODO Auto-generated method stub
if(os != null){
try {
os.flush();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
os = null;
}
if(is != null){
try {
is.close();
} catch (IOException e) ... | 6 |
static Method getMethod(Class cls,String name,Object [] args) {
Class [] args_cls = new Class[args.length];
for (int i=0; i<args.length; i++) {
if (args[i] instanceof Boolean) {
args_cls[i] = Boolean.TYPE;
} else if (args[i] instanceof Character) {
args_cls[i] = Character.TYPE;
} else if (args[i] i... | 8 |
@Override
public boolean equals(Object other){
if(other instanceof HttpBodyResponse){
HttpBodyResponse otherBody = (HttpBodyResponse) other;
return contenido.equals(otherBody.contenido);
}
return false;
} | 1 |
public Song getPlayed() {
if (isPaused) {
MyTunes.playerThread.resume();
Song ret = isPlaying() ? current : null;
MyTunes.playerThread.suspend();
return ret;
}
return isPlaying() ? current : null;
} | 3 |
public static String trim(String message)
{
while (message.startsWith(" ")) {
message = message.substring(1);
}
while (message.endsWith(" ")) {
message = message.substring(0, message.length() - 1);
}
return message;
} | 2 |
void frameFromCds() {
for (Exon ex : this) {
// No frame info? => try to find matching CDS
if (ex.getFrame() < 0) {
// Chech a CDS that matches an exon
for (Cds cds : getCds()) {
// CDS matches the exon coordinates? => Copy frame info
if (isStrandPlus() && (ex.getStart() == cds.getStart())) {
... | 7 |
private boolean jj_3_13() {
if (jj_scan_token(COMMA)) return true;
if (jj_3R_31()) return true;
return false;
} | 2 |
@Override
public void run(Player activator, List<Player> allPlayers) {
for (Player player : allPlayers){
int[][] strength = player.getBoard().getStrengthMap();
for(int i = 0; i<strength.length; i++){
for(int j = 0; j<strength[0].length; j++){
if (strength[i][j] == 1) strength[i][j]++;
}
}
... | 4 |
public void run(String[] args) throws FileNotFoundException, IOException {
try {
if (PCSCManager.getCard() != null) {
PCSCManager.disconnect();
} else {
Logger.log("Desconectado com sucesso.");
}
} catch (CardException e) {
}
... | 2 |
public static String capitalize(String s) {
final String c = Strings.toString(s);
return c.length() >= 2 ? c.substring(0, 1).toUpperCase() + c.substring(1) : c.length() >= 1 ? c.toUpperCase() : c;
} | 2 |
@Override
public boolean accept(File dir, String name) {
for(String s : extensions)
{
if((name.toLowerCase().endsWith(s+".xml") || name.toLowerCase().endsWith(s+".bin")) && new File(dir,name).exists())
return true;
}
return false;
} | 4 |
@Override
public int loop() {
if(startscript) {
if(task == null || !task.hasNext()) {
task = container.iterator();
} else {
final Node curr = task.next();
if(curr.activate()) {
curr.execute();
}
}
}
return stop;
} | 4 |
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column){
super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column) ;
//System.out.println("RenduCelluleLocation::getTableCellRendererCompo... | 5 |
private boolean jj_3R_77() {
if (jj_scan_token(VAR)) return true;
if (jj_3R_72()) return true;
if (jj_scan_token(IS)) return true;
return false;
} | 3 |
public int uniquePaths(int m, int n) {
if (m <= 0 || n <= 0) {
return 0;
}
int[][] paths = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (i == 0 || j == 0) {
paths[i][j] = 1;
} else {
paths[i][j] = paths[i - 1][j] + paths[i][j - 1];
}
}
}
... | 6 |
public Stage1WordRtProcessor(File uniFile, File binTrigramFile, Measure sim)
throws IOException, ProcessException {
BinaryFileFastRecordReader fastReader = new BinaryFileFastRecordReader(binTrigramFile);
try {
fastReader = new BinaryFileFastRecordReader(binTrigramFile);
Map... | 8 |
public void insertText(XmlMarshallingContext ctx, String fieldText) {
if (fieldText == null && isLazy()) {
return;
}
if (fieldText == Value.NIL) {
fieldText = null;
}
Document document = ctx.getDocument();
Element element = docume... | 9 |
public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
}
// write tag and type, and reserve space for values count
bv.put12('@', cw.newUTF8(desc)).putShort(0);
return new AnnotationWriter(cw, true, bv, bv, bv.length - 2);
} | 1 |
public void init() {
System.out.println("INIT");
setLayout(new BorderLayout());
String tmp_props=getParameter("properties");
if(tmp_props != null) {
System.out.println("Setting parameters " + tmp_props);
props=tmp_props;
}
try {
chan... | 8 |
static void solveBack(String s, int r, int c) {
if (founded)
return;
if (s.length() == word.length()) {
if (!founded) {
founded = true;
score += score(word.length());
}
} else
for (int[] d : dir)
if (check(r + d[0], c + d[1]) && !u[r + d[0]][c + d[1]]
&& word.charAt(s.length()) == a... | 7 |
@Override
public final void mouseDragged(MouseEvent me)
{
if (slider.inUse)
if (orientation == VERTICAL)
{
slider.y = me.getY() - 12.5f;
if (slider.y < y)
slider.y = y;
else if (slider.y > y + length - 25)
slider.y = y + length - 25;
sendTScrollEvent(new T... | 7 |
public static void load(ConfigurationSection config) {
for (Msg msg : values()) {
// MISC_NO_PERMISSION will become misc-no-permission
String key = msg.name().toLowerCase().replace("_","-");
msg.set(config.getString(key, ""));
}
} | 1 |
@Override
public void actionPerformed(ActionEvent e) {
switch(e.getActionCommand()){
case DRAW_AUTOMATON:
Application.mediator.showAutomatonFrame();
break;
case DRAW_ALGO:
Application.mediator.algPanel.draw... | 3 |
private boolean paikkaSisaltyySyotteeseen() {
if (paikka >= 0 && paikka < syote.length()) {
return true;
}
return false;
} | 2 |
public ArrayList<BESong> searchSongs(String searchWord) throws SQLException {
ArrayList<BESong> result = new ArrayList<BESong>();
Statement stm = DBConnection.getConnection().createStatement();
stm.execute("select * from Song inner join Artist on Artist.ID = Song.ArtistID "
+ "w... | 1 |
private void setSelectedGroup(String value) {
try {
ParameterGroup p = null;
switch (selection) {
case "Elevation" :
selected_group = (ParameterGroup) Parameters.getParameterSet("general").getParameterNode(
"terrain.elevation");
break;
case "Temperature" :
selected_group = (Parameter... | 6 |
public int numTouching(int piece, int column) {
int counter = 0;
int row = findRow( column );
for (int x = -1; x <= 1; x+=2) {
for (int y = -1; y <= 1; y++ ) {
if ( (row + x) < 6 && (row + x) > -1 && (column + y) < 7 && (column + y) > -1) {
if (_board[row+x][column+y] == piece){
counter++;
}
... | 9 |
public ArrayList<Serie> getListeTags() {
return listeSeries;
} | 0 |
default void log(String str){
out.println("I1 logging::"+str);
} | 0 |
public static void checkComponentsFocusable(
final Component _rootComponent) {
if (_rootComponent.isFocusable()) {
System.out.println( "Focusable: \t" +
_rootComponent.getClass().getSimpleName()
+ _rootComponent.getSize()
);
}
if (_rootComponent instanceof JPanel) {
for (Component x :... | 9 |
@Override
public boolean canInsert(int row, int column, int value) {
Cell cell = getSudoku().getCell(row, column);
Integer sumIndex = (Integer) cell.getValue(SumCellProvider.SUM);
if (sumIndex == null) {
// System.out.println("sumIndex == null -> true");
return true;
}
@SuppressWarnings("unchecked")
... | 5 |
public int[] addScore(int score[],boolean p1, boolean p2){
if(p1==true && p2==true){
score[0]+=prize;
score[1]+=prize;
} else if(p1==true && p2==false){
score[0]+=nerd;
score[1]+=temptation;
} else if(p1==false && p2==true){
score[0]+=t... | 6 |
private static void doUpdate() throws Exception
{
/* Remove preferences file (get rid of the provider word) */
(new File("prefs.dat")).delete();
/* Modify Intermarche file (get rid of the provider word) */
String InterName = (new Intermarche()).getName();
LookAheadIS in = null;
OutputStream out = null;
t... | 4 |
public void add() {
Object[] classes;
int index = -1;
System.out.println("Select your new equipment.");
try {
// Retrieve all classes in the package 'equipment.solid'.
classes = PackageHelper.getInstance()
.getClasses("equipment.solid", fa... | 4 |
public void fixStartEnd() {
if (sstart > send) {
int t = send;
send = sstart;
sstart = t;
}
if (qstart > qend) {
int t = qend;
qend = qstart;
qstart = t;
}
} | 2 |
public ClothBodyArmor() {
this.name = Constants.CLOTH_BODY_ARMOR;
this.defenseScore = 10;
this.money = 300;
} | 0 |
public void setEmail(String email) {
this.email = email;
} | 0 |
private void lab(EnvironnementAbs environnement){
int x;
int y;
x = environnement.taille_envi/2;
for(y = environnement.taille_envi/8; y < environment.taille_envi-(environnement.taille_envi/8) + 1; y++){
environment.grille[x][y] = new Mur("Mure", x, y);
environment.grille[y][x] = new Mur("Mure", y, x... | 2 |
public void pointerPressed(int x, int y)
{
clear();
} | 0 |
public boolean tarkistaYhtenaisyys(Palikka palikka) {
ArrayList<int[]> muoto = palikka.getMuoto();
if (muoto.isEmpty()) {
return true;
}
int i = 0;
while (i < muoto.size()) {
int[] piste1 = muoto.get(i);
boolean vieruksia = false;
... | 7 |
private void format() {
StringBuilder sb = new StringBuilder();
sb.append(country != null ? country.name() : "")
.append(":")
.append(organisation != null ? organisation : "")
.append(":")
.append(datasetType != null ? datasetType.name() : "")
.append(":")
.append(serial != n... | 4 |
private static void checkDepth(EvalContext evalContext) {
int depth = evalContext.depth();
if(depth>maxDepth)
maxDepth = depth;
} | 1 |
public boolean checkAccusation(Solution solution){
boolean correct = false;
if(solution.getPerson().equals(answer.getPerson()) && solution.getRoom().equals(answer.getRoom()) && solution.getWeapon().equals(answer.getWeapon())) {
correct = true;
}
return correct;
} | 3 |
public Config(SSGlobals glob) throws FileNotFoundException
{
fCarImages = new Vector<ImageIcon>();
try
{
parseConfig(glob);
setCarImages();
}
catch (ParserConfigurationException e)
{
throw new FileNotFoundException("Die Konfigurationsdatei konnte nicht gefunden werden");
}
catch (IOException e... | 4 |
public int find(int[] A, int sta, int end,int target,boolean flag){
if(sta > end)
return -1;
else{
int mid = (sta + end) / 2 ;
if(A[mid] == target){
if(flag){
//find minIndex
int index = mid-1;
... | 8 |
public MethodIdentifier(ClassIdentifier clazz, MethodInfo info) {
super(info.getName());
this.name = info.getName();
this.type = info.getType();
this.clazz = clazz;
this.info = info;
BytecodeInfo bytecode = info.getBytecode();
if (bytecode != null) {
if ((Main.stripping & Main.STRIP_LVT) != 0)
inf... | 4 |
public Role getConsultationRoleMinimum() {
if (consultationRoleMinimum == null)
if (getCategorieParent() != null)
return getCategorieParent().getConsultationRoleMinimum();
else
return Role.Visiteur;
return consultationRoleMinimum;
} | 2 |
public boolean checkColumn (int col) {
int i = 0, j = 0, count = 0;
/* Uses nested for loops to check the entries in the column */
for (j = 0; j < 10; j++) {
count = 0;
for (i = 0; i < 9; i++) {
if (j == Integer.parseInt(entries[i][col].getText())) {
count++;
}
if (count >= 2) {
... | 4 |
public Object nativeToJava(TransferData transferData){
if (isSupportedType(transferData)) {
byte[] buffer = (byte[])super.nativeToJava(transferData);
if (buffer == null) return null;
MyType[] myData = new MyType[0];
try {
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
DataInputStream ... | 4 |
public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress region )
{
int rowFrom = region.getFirstRow();
int rowTo = region.getLastRow();
int colFrom = region.getFirstColumn();
int colTo = region.getLastColumn();
for (int i = rowFrom; i <= rowTo; i ++)
... | 4 |
public int GetActionTakenCount(ACTION action)
{
if(action == ACTION.UP)
{
return this.numUpTaken;
}
else if(action == ACTION.DOWN)
{
return this.numDownTaken;
}
else if(action == ACTION.LEFT)
{
return this.numLeftTaken;
}
else
{
return this.numRightTaken;
}
} | 3 |
static String toHex8String(int pValue)
{
String s = Integer.toString(pValue, 16);
//force length to be eight characters
if (s.length() == 0) {return "00000000" + s;}
else
if (s.length() == 1) {return "0000000" + s;}
else
if (s.length() == 2) {return "000000" + s;}
else
if (s.lengt... | 8 |
@Override
public int unlink(String path) throws FuseException {
if (fileSystem.isReadOnly())
return Errno.EROFS;
try {
if (DirectoryInfo.class.isInstance(fileSystem.getFileMetaData(path)))
return rmdir(path);
} catch (PathNotFoundException e) {
return Errno.ENOENT;
}
try {
fileSystem.deleteFi... | 5 |
public Pair<List<Sentence>, Double> getBestSentiment (ScoreFunction func, int sentiment, int minLength, int maxLength, int delta, int windowSize) {
double highscore = Double.MIN_VALUE;
List<Sentence> bestSentences = null;
for (Pair<Integer, Integer> boundaries : chooseTwo(sentences.size())) {
int start = bo... | 8 |
@Override
public E poll()
{
E item = queue.poll();
if (blocking && item == null) {
synchronized (lock) {
// Only block if the item is null, else return it.
item = queue.poll();
if (item == null) {
try {
lock.wait(timeout);
} catch (InterruptedException e) { }
item = queue.poll... | 4 |
public List<String> getUserList(String service, String userType) {
List<String> users = new Vector<String>();
BufferedReader br = getFileReader();
String currentLine, user, tmpService;
StringTokenizer strTk;
if(br == null) {
System.err.println("Error opening file");
System.exit(1);
}
try {
... | 6 |
@Override
public Action getActionLocal(Server server, Instruction instruction,Option[] options) {
Context context = null;
try{
context = createContext(server);
}catch(Exception e){
}
if(null == context)
return null;
try{
Deploy deploy = server.findDeploy(instruction);
String bindi... | 3 |
private static void AutoAddConnectionsInOnePage(Robot robot, boolean isZhu) {
if (isZhu) {
int startX = 330;
int startY = 350;
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 1; i++) {
MoveAndLeftClickTwice(robot, startX, startY, 1000);
MoveAndLeftClickTwice(robot, startX + 450, startY, 1000... | 4 |
@Override
public boolean equals(Object obj) {
EntityData other = (EntityData) obj;
if (id == other.id && x == other.x && y == other.y && angle == other.angle && velocity == other.velocity
&& removed == other.removed && Arrays.equals(specificData, other.sp... | 7 |
public JLabel getPlayer1Piece() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer1Piece() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer1Piece() - END");
return m_player1Piece;
} | 4 |
public Point getPointX(int x, int y) {
//0 30 60 90 120
int rangeX = (int) Math.round(side * 1.5);
int roundedPointX = x / rangeX;
// System.out.println(roundedPoint);
int offsetX = x % rangeX;
int realPointX = (offsetX-(rangeX/2)<0)? roundedPointX*rangeX:(roundedPointX*ra... | 4 |
public static Object getValueClass(char ch)
{
switch (ch)
{
case '@':
return PatternOptionBuilder.OBJECT_VALUE;
case ':':
return PatternOptionBuilder.STRING_VALUE;
case '%':
return PatternOptionBuilder.NUMBER_VALUE;
... | 9 |
private void initializeBoard() {
Letterpress.board = new char[5][5];
Random gen;
switch (LGameManager.runState) {
case DEBUG:
gen = new Random(0);
break;
case RUN:
gen = new Random();
break;
case TEST:
gen = new Random();
break;
default:
gen = new Random();
break;
}
for (int r... | 6 |
public static int checkAlignment(JTextPane pane)
{
AttributeSet attributes = pane.getParagraphAttributes();
if (attributes.isDefined(StyleConstants.Alignment))
{
Integer align = (Integer) attributes
.getAttribute(StyleConstants.Alignment);
return align.intValue();
}
if (attributes.isDefined(CSS.... | 4 |
public String getOOXML()
{
StringBuffer ooxml = new StringBuffer();
if( dvRecs.size() > 0 )
{
ooxml.append( "<dataValidations count=\"" + dvRecs.size() + "\"" );
if( !isPromptBoxVisible() )
{
ooxml.append( " disablePrompts=\"1\"" );
}
if( getHorizontalPosition() != 0 )
{
ooxml.append( "... | 5 |
public void step() {
steps++;
Point pacManLoc = board.getPacManLocation();
board.move(pacManLoc.x, pacManLoc.y, pacManDirection);
// ... and now, on to the ghosts. We'll leave the actual AI work to a
// separate method in any class implementing the AI interface, focusing
... | 9 |
public void dataQueHandling() {
Thread messageHandling = new Thread() {
public void run(){
while(true){
Packet packet = dataQue.poll();
if(packet != null) {
if(packet.channel != null){
for(int handlers = 0; handle... | 4 |
@FXML
void initialize() {
ToggleGroup group = new ToggleGroup();
optToday.setToggleGroup(group);
optTomorrow.setToggleGroup(group);
lstDays.setItems(FXCollections.observableArrayList(
arrayBundle.getString("days_array").split(",")));
EventModel eventModel = ... | 8 |
public String status(Integer denomination) {
CashMachineSystem cash = (CashMachineSystem) cashSystem;
switch (denomination) {
case 100:
return "$100 - " + cash.getQuantityOfValue(0);
case 50:
return "$50 - " + cash.getQuantityOfValue(1);
case 20:
return "$20 - " + cash.getQuantityOfValue(2);
case ... | 6 |
public static void updateNonStructuralModuleOptions(Module oldmodule, Module newmodule, String newoptions) {
if (newoptions == null) {
newoptions = newmodule.stringifiedOptions;
}
{ PropertyList self000 = PropertyList.newPropertyList();
self000.thePlist = ((Cons)(Stella.readSExpressionFromStrin... | 6 |
public static void circle(double x, double y, double r) {
if (r < 0) {
throw new IllegalArgumentException("circle radius must be nonnegative");
}
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2 * r);
double hs = factorY(2 * r);
if (... | 3 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || this.getClass() != obj.getClass())
{
return false;
}
Stage other = (Stage) obj;
return new EqualsBuilder()
.append(this.name, other.name)
.append(this.description, other.description)
.is... | 3 |
public static Rule_dirImplements parse(ParserContext context)
{
context.push("dirImplements");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>... | 7 |
private void updateStatus() {
if (game == null) {
rollButton.setEnabled(false);
statusLabel.setText("Sign in");
rollLabel.setText("");
return;
}
rollButton.setEnabled(game.canRoll());
if (game.isGameOver()) {
statusLabel.setText("Game over!");
}
else if (game.canRol... | 9 |
private void checkScrollBar(AdjustmentEvent e)
{
JScrollBar scrollBar = (JScrollBar)e.getSource();
BoundedRangeModel listModel = scrollBar.getModel();
int value = listModel.getValue();
int extent = listModel.getExtent();
int maximum = listModel.getMaximum();
boolean valueChanged = previousValue != value;... | 7 |
public static void ConvertToLibSVM(String directory,
String outputDirectory) throws FileNotFoundException,IOException{
FileReader fr = new FileReader (directory);
BufferedReader br = new BufferedReader(fr);
FileWriter stream = new FileWriter(outputDirectory,false);
BufferedWriter bo = new BufferedWri... | 8 |
public static void makeNextBlackMoves(){
Vector<Move> resultantMoveSeq = new Vector<Move>();
alphaBeta(Game.board, Player.black, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, resultantMoveSeq);
//Apply the move to the game board.
for(Move m:resultantMoveSeq){
Game.board... | 1 |
private static void doCompare() throws MVDToolException
{
try
{
MVD mvd = loadMVD();
if ( version == 0 || with == 0 )
throw new MVDToolException(
"can't compare version="+version+" with version "+with );
Chunk[] chunks = mvd.compare( version, with, uniqueState );
if ( mvd.getEncoding().toUppe... | 5 |
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.