text stringlengths 14 410k | label int32 0 9 |
|---|---|
static void draw_sprites(osd_bitmap bitmap) {
/* sprite information is scattered through memory */
/* and uses a portion of the text layer memory (outside the visible area) */
UBytePtr spriteram_area1 = new UBytePtr(spriteram, 0x28);
UBytePtr spriteram_area2 = new UBytePtr(spriteram_2, 0... | 8 |
private void saveMoveHistory(boolean won){
//Disregard games that didn't have any moves
if (moves_in_round == 0)
return;
//Score how well the AI did this round
//double fac = scoreMetric() - initialScore;
//double rate = LEARN_RATE * fac;
double rate = 0.01;
if (rate > .0001){
//System.out.pri... | 4 |
public static void main(String[] args) throws IOException {
// write your code here
int menu;
do {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("1 - Create Author(s)\n2 - Create Publisher(s)\n3 - Quit");
try {
... | 5 |
public static JEditTextArea getTextArea(EventObject evt)
{
if(evt != null)
{
Object o = evt.getSource();
if(o instanceof Component)
{
// find the parent text area
Component c = (Component)o;
for(;;)
{
if(c instanceof JEditTextArea)
return (JEditTextArea)c;
else if(c == null... | 6 |
static boolean isThereAFour(Hand hand) {
for (int z =0; z < hand.size();z++)
{int count = 0;
for(int y=0;y < hand.size();y++)
{
if (hand.get(z).getValue() == hand.get(y).getValue())
count++;
if (count == 4)
return true; // ... | 4 |
public int read() throws IOException {
if (closed) {
return 0;
} else {
return inputStream.read();
}
} | 1 |
void parseTargetStatistics(Element el) {
this.targetStatistics = new ArrayList<Statistic>();
NodeList paramList = el.getElementsByTagName("targetStatistic");
// for each parameter
for (int j = 0; j < paramList.getLength(); j++) {
Node node = paramList.item(j);
String name = ((Element)node).getAtt... | 9 |
public void fire(){
Bullet bullet = new Bullet(this) ;
if( this.direction == Tank.direction_up){
bullet.setLocation_x(this.location_x + this.width/2 - bullet.getWidth()/2 - 1);
bullet.setLocation_y(this.location_y);
}else if(this.direction == Tank.direction_down){
bullet.setLocation_x(this.location_x ... | 6 |
private void prepareSpawn(){
if (time % spawnRate == 0){
if (maxSpawnCount > spawnCount){
spawn(mobsToSpawn);
spawnCount++;
wp.setLeft (maxSpawnCount - spawnCount);
}
}
if (level % 10 == 0){
s.stopAmbient();
... | 7 |
public void drawRaster(int[] p, int w, int h, int x, int y) {
// Finds the bounds (in world space) of the pixels that are visible and are on the tile map
final int startX = (x < 0) ? 0 : x;
final int endX = (x + w > imageWidth) ? imageWidth : w + x;
final int startY = (y < 0) ? 0 : y;
final int endY = (y + h... | 6 |
private void loadPerson() {
// TODO Auto-generated method stub
Pendinng = Satisfied.getInstanceSatisfied().getPendingCompanyApplication();
fila = new Object[5];
for (int i = 0, j=1; i <Satisfied.getInstanceSatisfied().getPendingCompanyApplication().getCompanyApplications().size(); i++,j++)
{
fila[0] = i+1;
fila[1] = Sa... | 1 |
@Override
public String action() {
StringBuilder builder = new StringBuilder();
builder.append(ZapporRestUtils.SEARCH_ACTION);
builder.append("?term=");
if (term != null) {
builder.append(term);
}
builder.append("&filters=");
StringBuilder value = new StringBuilder();
value.append("{\"price\":");
... | 3 |
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name, boolean caseSensitive)
{
String string = name.getName();
Map<String, V> results = Maps.newHashMap();
for (IKey c : map.keySet())
{
String n = c.getName();
boolean match = (caseSensitive && n.startsWith(string)) || ((!caseSen... | 8 |
@Override
public synchronized void execute(final Runnable command) {
tasks.offer(new Runnable() {
public void run() {
try {
command.run();
} finally {
scheduleNext();
}
}
});//insert one t... | 1 |
public boolean endTurn(Integer activePlayerId) {
// Cooldowns
for (Attack a : this.getAttacks()) {
if (a.getCooldownRemaining() < 0) {
a.setCooldownRemaining(0);
} else if (a.getCooldownRemaining() > 0) {
a.setCooldownRemaining(a.getCooldownRemaining() - 1);
}
}
// TODO: Regen
// Update Mo... | 9 |
SimulatedIVPump2(Spawner spawn, InitialJFrame app)
{
super("Gamma Infusion Pump");
title = new JLabel(" Gamma Infusion Pump");
title.setFont(new Font("Arial", Font.PLAIN, 32));
title.setForeground(Color.WHITE);
title.setBackground(Color.BLACK);
setSize(defaultWidth, defaultHeight);
getContentPane().set... | 4 |
public static void exportReestr(List <Reception> receptions) {
List<ReestrColumn> reestrColumns = ReestrColumns.getInstance().getActiveColumns();
// List<Reception> receptions = ReceptionsModel.getInstance().getFilteredReceptions();
SXSSFWorkbook wb = new SXSSFWorkbook(100);
Sheet sh = wb.createSheet();
... | 7 |
@Override
public Matrix<Double> value(final Matrix<Double> firstInput,
final Matrix<Double> secondInput) {
if (firstInput.getFirstColumn() != secondInput.getFirstRow())
throw new ArithmeticException("The matrices are not " +
"conforming in dimensions: First colum... | 5 |
public void setDstType(String type) {
if ("string".equalsIgnoreCase(type)){
this.dstType = DstColumnType.STRING;
} else if ("integer".equalsIgnoreCase(type)){
this.dstType = DstColumnType.INTEGER;
} else if ("blob".equalsIgnoreCase(type)){
this.dstType = DstColumnType.BLOB;
} else if ("list".equalsIgno... | 7 |
public SteganoDialog(Controller controller) {
super();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
bundle = Application.getResourceBundle();
setTitle("Steganography");
// Closing the window is equal to pressing the Abort-Button
WindowListener windowListener = (new WindowAdapte... | 8 |
private static boolean getPersonGender() {
Scanner keyboard2 = new Scanner(System.in);
String gender;
do {
System.out.print("Gender?:");
gender = keyboard2.nextLine().toLowerCase();
if (!(gender.matches("f(emale)?") || gender.matches("m(ale)?"))) {
System.out.println("The gender must be F,Female,M or... | 4 |
public static void main(String[] args) {
StockStrategy stockStrategy=new StockStrategy();
int[] arr={6,1,3,2,4,7};
System.out.println(stockStrategy.maxProfit(arr));
} | 0 |
public void bytesRead(int bytes, int clientId)
{
if (this.clientId == clientId)
{
for (Iterator i = observers.iterator(); i.hasNext();)
{
ObservableStreamListener listener = (ObservableStreamListener) i
.next();
listener.bytesRead(bytes, clientId);
}
}
} | 2 |
private void load() {
assets = new AssetManager();
assets.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
assets.setLoader(Script.class, new ScriptLoader(new InternalFileHandleResolver()));
assets.setLoader(EntityList.class, new EntityLoader(new InternalFileHandleResolver()));
a... | 6 |
public byte[] handle(ConnectionDetails connectionDetails,
byte[] buffer, int bytesRead)
throws java.io.IOException
{
final StringBuffer stringBuffer = new StringBuffer();
boolean inHex = false;
for(int i=0; i<bytesRead; i++) {
final int value = (buffer[i] & 0xFF);
// If it's ASCII, print i... | 8 |
private void setPrev(Vector<vslIndexView<D>> prevVec)
throws vslInputException
{
if (record instanceof vslIndexUpdateRecord) {
vslIndexUpdateRecord update = (vslIndexUpdateRecord) record;
if (update.prev == null) {
Vector<vslRecKey> prevKeys = new Vector<vslRecKey>();
for (vslIndexView<D> prev: prev... | 8 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
private Format getFileFormat(File file) {
BufferedReader br;
String line;
String [] parts;
Scanner scanner = new Scanner("");
try {
br = new BufferedReader(new FileReader(file));
// Skip the lines that don't contain data (comments and such)
while((line = br.readLine()) != null) {
scanner =... | 6 |
@Override
public void componentHidden(ComponentEvent e) {
} | 0 |
public static synchronized Response connect(Request request) throws IOException{
Response response = null;
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try {
socket = new Socket("localhost", 4444);
oos = new ObjectOutputStream(new BufferedOutputS... | 7 |
public static int howMuchDigits(int number) {
int count = 1;
while (number / 10 != 0) {
count++;
number /= 10;
}
return count;
} | 1 |
private static int parseChanges(int index, List<Word> wordList,
List<Change> changes, String comma) throws SQLCompilerException {
while (index < wordList.size()) {
ParseExpressionResult result = ExpressionParser.parse(index,
wordList);
if (result.getIndex() <= index) {
break;
} else {
Express... | 9 |
public MessagePost (String username, String message){
super(username);
this.message = message;
} | 0 |
public void connect() throws JSchException{
try{
Session _session=getSession();
if(!_session.isConnected()){
throw new JSchException("session is down");
}
if(io.in!=null){
thread=new Thread(this);
thread.setName("DirectTCPIP thread "+_session.getHost());
if(_... | 5 |
private void removed (DeviceImpl dev)
{
if (MacOSX.trace)
System.err.println ("notify bus->removed(dev): " + dev.getPath());
// call synch'd on devices
try {
dev.close ();
} catch (IOException e) {
// normally ignore
if (MacOSX.debug)
... | 6 |
public static BufferedImage cellImage(PixelType type){
if(type == PixelType.NOFILL){
return getImage(101, false);
}else if(type == PixelType.FILL){
return getImage(102, false);
}else if(type == PixelType.CROSS){
return getImage(103, false);
}else if(type == PixelType.GUESS_NOFILL... | 7 |
private static Structure parseHeader(CallParser parser) {
ParseError.validate(parser.size() > 2, parser.firstCall().lineN, "Malformed callable header");
ParseError.validate(parser.get(0).qualifiesAsKeyword(), parser.firstCall().lineN, "Malformed callable header");
ParseError.validate(parser.get(1).qualifiesAsKeyw... | 7 |
void run() {
try {
// 1. creating a server socket
providerSocket = new ServerSocket(2004, 10);
// 2. Wait for connection
System.out.println("Waiting for connection");
connection = providerSocket.accept();
System.out.println("Connection received from "
+ connection.getInetAddress().getHostNa... | 5 |
public EU2Country getOwner() {
int id = getId();
String sid = go.getString("id");
if (!scenario.provCanHaveOwner(id))
return null;
for (GenericObject c : scenario.countries)
if (c.getChild("ownedprovinces").contains(sid))
return s... | 3 |
protected int computeState(int neighbors[]){
int numberOfLiveNeighbors = 0;
for(int i = 1; i < neighbors.length; i++){
if(neighbors[i] != CellularAutomatonConstants.NO_VALUE){
if(neighbors[i] == GameOfLifeAutomaton.CELL_LIVE){
numberOfLiveNeighbors++;
}
}
}
if(neighbors[0] == GameOfLifeAutom... | 8 |
final public List<Literal> literals() throws ParseException {
List<Literal> literals=new ArrayList<Literal>();
String literalFunction=null;
Literal literal=null;
if (jj_2_48(7)) {
literalFunction = literalFunction();
} else if (jj_2_49(7)) {
literal = literal();
} else {
jj_consume_tok... | 9 |
public void removeNeighbour(Agent a) {
neighbours.remove(a);
} | 0 |
public TrackingAndRecognitionMenu() {
super("Tracking & Recognition");
setEnabled(true);
JMenuItem imageTracking = new JMenuItem("Image");
imageTracking.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
... | 5 |
public Keygen(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "autofocus":
autofocus = Autofocus.parse(this, v);
break;
case "challenge":
challenge = Challenge.pa... | 7 |
public boolean followUrl(final Url url) {
if (visitedUrls.get(url) != null) {
return false;
}
visitedUrls.put(url, "");
return visitor.followUrl(url);
} | 1 |
public Weapon(int x, int y, String name) {
this.x = x << 4;
this.y = y << 4;
type = Type.WEAPON;
ammotype = Ammotype.BULLET;
if (name == "Pistol") {
up = new AnimatedSprite(SpriteSheet.player_pistol_up, 32, 32, 3, 10);
down = new AnimatedSprite(SpriteSheet.player_pistol_down, 32, 32, 3, 10);
left = ... | 4 |
public static void update(){
if (draw != null) {
draw.repaint();
}
} | 1 |
public int getWallObjectUid(int z, int x, int y) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile == null || groundTile.wallObject == null) {
return 0;
} else {
return groundTile.wallObject.uid;
}
} | 2 |
public static ArrayList<Productos> sqlSelectAtributos(Productos pro){
ArrayList<Productos> prod = new ArrayList();
String sql = "SELECT de.nombre, at.atributo " +
"FROM atributos at " +
"INNER JOIN cat_subcat_tit_attr_descr pr ON at.idatributos = pr.atribu... | 2 |
public Class<?> getTargetType() {
return this.targetType;
} | 1 |
public boolean isContained(char axis) {
switch (axis) {
case 'x':
if (getMinX() < -0.5f * model.getLength() || getMaxX() > 0.5f * model.getLength())
return false;
break;
case 'y':
if (getMinY() < -0.5f * model.getWidth() || getMaxY() > 0.5f * model.getWidth())
return false;
break;
case 'z':
... | 9 |
public static void leptet( int[][] tabla )
{
b = 1; jatekos = 0;
while( !Ellenor.jatekVege(tabla) )
{
AktualisRajzol.rajzol(tabla);
jatekos = Jatek.melyJatekosKovetkezik(b, jatekos, 1);
sor = sc.nextLine();
String splitSor[] = sor.split(" ");
if( splitSor.length != 2 )
{
System.out.... | 7 |
private String readFile(File file) {
StringBuilder stringBuffer = new StringBuilder();
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new FileReader(file));
String text;
while ((text = bufferedReader.readLine()) != null) {
... | 4 |
public synchronized List<Long> getWaysIds(int pos) {
if (nodes.size()>pos)
return ways.get(pos);
else
return new ArrayList<Long>();
} | 1 |
public static void putLongNullable(ByteBuffer out, Long x)
{
if (x == null)
{
out.put( NULL );
}
else
{
long value = (x < 0 ? -x : x);
int sign = (x < 0 ? BYTE_SIGN_NEG : BYTE_SIGN_POS);
long a = (value & 0x1F);
int... | 6 |
@Override
public void controlObject(GObject target, Context context) {
if (tick > duration) {
// We've been reused. Get out.
return;
}
// Is this our first run?
if (tick == 0) {
// We may have other tweens that should be run at the same time.
for (TweenController tween : with) {
// Add the con... | 5 |
public Object clone() {
return new LRParseTable(this);
} | 0 |
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CovingtonConfig that = (CovingtonConfig)obj;
if (input.size() != that.getInput().size())
return false;
if (dependencyGraph.nEdges() != that.getDepen... | 7 |
public static List<String> getChildren(URL url) {
List<String> result = new ArrayList<String>();
if ("file".equals(url.getProtocol())) {
File file = new File(url.getPath());
if (!file.isDirectory()) {
file = file.getParentFile();
}
addFiles(file, result, file);
} else if ("jar".equals(url.getProto... | 5 |
private PlayerPawn findPlayerPawnById(int id){
for (int i = 0; i < playerPawns.size(); i++) {
if (playerPawns.get(i).getId() == id) {
return playerPawns.get(i);
}
}
return null;
} | 2 |
@Override
public void delBehavior(Behavior to)
{
if(behaviors==null)
return;
if(behaviors.remove(to))
{
if(behaviors.isEmpty())
behaviors=new SVector<Behavior>(1);
if(((behaviors==null)||(behaviors.isEmpty()))&&((scripts==null)||(scripts.isEmpty())))
CMLib.threads().deleteTick(this,Tickable.TIC... | 7 |
@Test(dataProvider="createTimer")
public void testSchedulingTasksThenCancellingEverySecondTask(TimeScheduler timer) {
final int NUM=20;
Future<?>[] futures=new Future<?>[NUM];
try {
for(int i=0; i < NUM; i++) {
futures[i]=timer.schedule(new MyRunnable(i), 1000, ... | 9 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MappingProduct other = (MappingProduct) obj;
if (!Objects.equals(this.pcodeScylla, other.pcodeScylla)) {
... | 3 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
try {
if(args.length < 1) {
throw new IllegalArgumentException("must be more than one");
}
PluginCommand pluginCmd = Bukkit.getServer().getPluginCommand(cmdLabel + " " + args[0]);
if(!pluginCmd.te... | 4 |
public int getValueAsInt() throws IllegalArgumentException {
if (!isOptionAsInt(code)) {
throw new IllegalArgumentException("DHCP option type (" + this.code + ") is not int");
}
if (this.value == null) {
throw new IllegalStateException("value is null");
}
if (th... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int x = 0; x < n; x++) {
String[] in = br.readLine().split(" ");
int row = Integer.parseInt(in[0]);
int col = Integer.parseIn... | 8 |
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
EmployeeManager mgr = new EmployeeManager();
boolean success = false;
//COLLECT ALL THE VARIOUS PARAMETERS
String firstName = req.getParameter("firstName");
String lastName = req.getParameter("... | 5 |
private void loopCycle() {
// Logic
processHits();
while(Keyboard.next()) {
// Only listen to events where the key was pressed (down event)
if (!Keyboard.getEventKeyState()) continue;
// Switch textures depending on the key released
switch (Keyboard.getEventKey()) {
case Keyboard.KEY_1:
tex... | 4 |
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if(skipTests || mavenTestSkip) {
getLog().info("Skipping all Octave tests, because 'skipTests' is set to true.");
} else {
getLog().info("running Octave tests @" + url);
try {
... | 9 |
public static void main(String[] args)
{
new Cli();
} | 0 |
public static String readLog(String name) {
String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "DarkIRC";
if (!(new File(tmpDir)).exists()) {
(new File(tmpDir)).mkdirs();
}
String text = "";
try... | 3 |
public void setSourceItem( DefaultBox<?> sourceItem ) {
if( this.sourceItem != null ) {
this.sourceItem.removeDependent( this );
}
this.sourceItem = sourceItem;
if( this.sourceItem != null ) {
this.sourceItem.addDependent( this );
}
} | 3 |
@Override
public boolean equals(Object o) {
if (!(o instanceof User)) return false;
User user = (User) o;
return this.login == user.login &&
this.password == user.password &&
this.firstName == user.firstName &&
this.lastName == user.lastName &&
this.birthDate == u... | 6 |
private void analyzeForLinking(ResultSet rs, String cmd) throws SQLException {
if (rs == null) {
return;
}
Statement stmt = rs.getStatement();
if (stmt == null) {
return;
}
Connection conn = stmt.getConnection();
if (conn == null) {
... | 8 |
private String display() {
String displayString = "";
if (this.address == -1) {
return displayString; //If address line holds -1, signifies transfer from memory to MBR (no address).
}
displayString += this.address;
return displayString;
} | 1 |
public static boolean isZero(int x, int y, int[][] sea)
{
return (isTile(x, y, sea) && sea[x][y] == 0);
} | 1 |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
/*
* ゲームモードを変更する
*
* @gm [0,1,2]
* 0 = Survival
* 1 = Cr... | 8 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String questionType = request.getParameter("newQuestionType");
if(questionType.equals("")){
RequestDispatcher dispatch = request.getRequestDispatcher("createQuiz/chooseQuestionType.jsp");
... | 8 |
public int setErrorHandler (PdbErrorHandler anErrorHandler) {
// we don't accept null handlers
if (anErrorHandler == null) {
return NULL_OBJECT_REFERENCE ;
} // end if
// set it, return in triumph
ourErrorHandler = anErrorHandler ;
return SUCCESS ;
} // end method setErrorHandler | 1 |
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... | 7 |
public boolean getAcceptByFinalState(){
return turingAcceptByFinalState;
} | 0 |
public void addOnlyInstrumentReg(String arg) {
String patternString = arg.substring(ONLY_INSTRUMENT_REG_PREFIX.length());
if (patternString.startsWith("/"))
patternString = patternString.substring(1);
defaultSkip = true;
try {
patternMatchers.add(PatternMatcherReg... | 2 |
private void bla()
throws Exception
{
if(0==0)
throw new Exception("bla");
} | 1 |
public void printJobRequiresAttention(PrintJobEvent pje) {
System.out.println("Job requires attention");
PrinterStateReasons psr = pje.getPrintJob().getPrintService().getAttribute(PrinterStateReasons.class);
if (psr != null) {
Set<PrinterStateReason> errors = psr.printerStateReasonSe... | 2 |
private static String getFileContents(String filename)
throws IOException, FileNotFoundException
{
File file = new File(filename);
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = ... | 1 |
@Override
public boolean keyup(KeyEvent ev) {
if (ev.getKeyCode() == KeyEvent.VK_UP)
APXUtils.wPressed = false;
if (ev.getKeyCode() == KeyEvent.VK_LEFT)
APXUtils.aPressed = false;
if (ev.getKeyCode() == KeyEvent.VK_DOWN)
APXUtils.sPressed = false;
if (ev.getKeyCode() == KeyEvent.VK_RIGHT)
APXUtils.... | 8 |
public Location getAdjacentLocation(int direction)
{
// reduce mod 360 and round to closest multiple of 45
int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE;
if (adjustedDirection < 0)
adjustedDirection += FULL_CIRCLE;
adjustedDirection = (adjustedDirect... | 9 |
private void returnBook(String bookTitle) {
for (Book currBook : list) {
if (currBook.getTitle().equals(bookTitle)) {
if (currBook.isBorrowed()) {
currBook.returned();
System.out.println("You successfully returned "
+ currBook.getTitle());
return;
}
}
}
System.out.println("This... | 3 |
public void actionPerformed(ActionEvent e) {
Object obj;
if ((obj = e.getSource()) == bFile) {
JFileChooser filechooser = new JFileChooser(new File("./"));
int selected = filechooser.showOpenDialog(this);
if (selected == JFileChooser.APPROVE_OPTION) {
... | 8 |
private String IaddINode(String resource_id, String inode_id)
{
String node_id = null;
String resource_node_id = null;
OrientGraph graph = null;
try
{
node_id = getINodeId(resource_id,inode_id);
if(node_id != null)
{
//Syst... | 7 |
@Override
public void update(Observable arg0, Object arg1) {
if (presenter.getState().isInAnyPlayingState()) {
getPointsView().setPoints(presenter.getClientModel().getServerModel().getPlayers().get(presenter.getPlayerInfo().getIndex()).getVictoryPoints());
if (presenter.getClientModel().getServerModel().getWin... | 3 |
public static void main(String[] args) throws Exception {
if(args.length < 2) {
System.out.println("Usage: java JGrep (file or directory) regex");
System.exit(0);
}
Pattern p = Pattern.compile(args[1]);
if(!(findDir(args[0], p) || findFile(args[0], p))) {
... | 7 |
public int calculateTotal() {
total = 0;
for (int i = 0; i < hand.size(); i++) {
total += hand.get(i).getValue();
}
return total;
} | 1 |
@Override
public void mousePressed(MouseEvent evt) {
int x = evt.getX();
int y = evt.getY();
if ((evt.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) {
if (pd == PD.RightMouseB) {
Dimension d = getSize();
jumpX = x;
jumpY = y;
// Draw distribution only insi... | 8 |
public void build() {
for (int i = 1; i <= graph.V(); i++) {
KK<Integer> next = new KK<>(graph);
next.add(i);
clusters.add(next);
}
List<WeightedGraph.Edge> edges = graph.edges();
Collections.sort(edges);
int k = clusters.size();
int i = 0;
while (k != K) {
System.err.println("------------ "... | 7 |
private void initValues() {
try {
enableFrameSkip.setSelected(Settings.get(Settings.AUTO_FRAME_SKIP).equals("true")?true:false);
} catch (NullPointerException e) {
enableFrameSkip.setSelected(false);
}
try {
limitGameSpeed.setSelected(Settings.get(Settings.CPU_LIMIT_SPEED).equals("true")?tr... | 5 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Een dispatcher verkrijgen van de request en er een JSP mee associeren
RequestDispatcher dispatcher = request.getRequestDispatcher(VIEW);
// Een simpele dynamische boodschap genereren
... | 4 |
private void downdatePosition() {
if (direction == 1) {
pos_y++;
}
if (direction == 2) {
pos_x++;
}
if (direction == 3) {
pos_y--;
}
if (direction == 4) {
pos_x--;
}
System.out.println(name + ": new position (down) " + pos_x + " "
+ pos_y);
} | 4 |
private Entry<K,V> successor(Entry<K,V> t) {
if (t == null)
return null;
else if (t.right != null) {
Entry<K,V> p = t.right;
while (p.left != null)
p = p.left;
return p;
} else {
Entry<K,V> p = t.parent;
Entr... | 5 |
@Override
public void actionPerformed(ActionEvent e) {
// File Menu
if (e.getActionCommand().equals(OK)) {
main_ok();
} else if (e.getActionCommand().equals(APPLY)) {
main_apply();
} else if (e.getActionCommand().equals(CANCEL)) {
main_cancel();
}
} | 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.