text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static HashMap<String, String> getMeta(Class<?> cl) {
HashMap<String, String> ret = new HashMap<String, String>();
FileSystemResource resource = new FileSystemResource(META_FILE_NAME);
File text = resource.getFile();
try{
BufferedReader br = new BufferedReader(new Inpu... | 5 |
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
//TODO: Get sprites
Image[] mUP = {new Image("res/Zornespritefs.png"), new Image("res/Zornespritefs.png")};
Image[] mDown = {new Image("res/Zornespritefs.png"), new Image("res/Zornespritefs.png")};
Image[] mLeft = {new Im... | 5 |
public String getAddTransPhysical(MemPartition b, int logicalAddr, List<MemPartition> memory) {
// logicalAddr belongs to process logical space
ProcessComplete p = b.getAllocated().getParent();
// Segment ?
int startsegment = 0;
ProcessComponent programSegment = null;
boolean found = false;
int i = 0;
... | 9 |
public String getCommandTypeName(int commandType)
{
Integer commandTypeKey = getCommandTypeKey(commandType);
if (null == commandTypeKey)
{
return "UNKNOWN COMMAND TYPE 0x" + Integer.toHexString(commandType);
}
switch(commandTypeKey.intValue())
{
... | 9 |
private void create(Shell parent, int inSym) {
result = -1;
FormLayout layout = new FormLayout();
layout.marginTop = 5;
layout.marginBottom = 5;
layout.marginLeft = 5;
layout.marginRight = 5;
layout.spacing = 5;
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setText("Sym L... | 8 |
public void update_MessageTrace(String msg){
if(reorder_msg==0 || reorder_msg==1){
synchronized(test_network.MessageTrace){
String whoamI="";
if(test_index<test_network.numProposers())
whoamI="Proposer - "+test_index;
if(test_index>=test_network.numProposers() && test_index<... | 7 |
public static boolean banPlayer(String[] args, CommandSender s) {
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you beli... | 6 |
public boolean ExistsInVector(Vector<Move> moves){
for (int i = 0; i<moves.size(); i++){
if (this.Equals(moves.elementAt(i))){
return true;
}
}
return false;
} | 2 |
@Override
public void run() {
do {
try {
getNextChar();
if (isEndOfStream())
closeRemainingStreams();
else if (isSeperatorMet())
checkSeparator();
else if (shouldCheck)
ch... | 5 |
public static boolean checkInputs(String startingAmount, String goalAmount, DateTime beginDate, DateTime endDate )
{
boolean valid = true;
if(!GeneralUtill.stringToBigDecimalCheck(startingAmount)){
GuiUtill.showError("Incorrect input", "please put in the correct in put in your starting amount");
valid = f... | 4 |
public static void main(String[] args) throws Exception {
String env = null;
if (args != null && args.length > 0) {
env = args[0];
}
if (! "dev".equals(env))
if (! "prod".equals(env)) {
System.out.println("Usage: $0 (dev|prod)\n");
... | 8 |
public static void main(String[] args)throws Exception {
DerbyHelper db = new DerbyHelper("Library", 1527,"app","app");
// List<String> cmd = Files.readAllLines(Paths.get("DataBook.txt"), StandardCharsets.UTF_8);
// for(String s : cmd){
// List<String> params = Arrays.asList(s.split(",... | 7 |
private Expression rest( List<Expression> args, String caller ) {
if ( args.size() != 1 ) {
System.err.println("rest/tail expected exactly one argument and got " + args.size() );
return new Void();
}
Expression expr = args.get(0).eval(defSubst, caller);
if ... | 3 |
public File getConfigFile() {
return this.config_file;
} | 0 |
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.T... | 6 |
private void checkType(String key, Class<? extends Object> clazz) throws NoConfigException, DataWrongTypeException {
List<String> keys = this.config(clazz);
if (!keys.contains(key)) {
throw new DataWrongTypeException(String.format("%s got the wrong type[%s].", key, clazz.getName()));
}
} | 2 |
public final void setEnd() {
panel.setBackground(Color.BLACK);
String text;
if (correct > incorrect || correct == incorrect) {
text = "<h1>YOU WIN!</h1>";
} else {
text = "<h1>YOU LOSE!</h1>";
}
text += "<h2>You answered " + (int) (correct) + " of ... | 2 |
@Override
public String toString() {
String board = "===\n";
for (int i = 7; i >= 0; i--) {
board += " ";
for (int j = 0; j < 8; j++) {
board += " " + _contents[i][j].textName();
}
board += "\n";
}
String t = turn().toSt... | 3 |
int getCountCorrect()
{
int count = 0;
for(int i=0;i<sudokuSize;i++) {
for(int j=0;j<sudokuSize;j++) {
if(cells[i][j].valueState == intializedByServer || cells[i][j].valueState == acceptedByAgent || cells[i][j].valueState == acceptedByUser)
count++;
}
}
return count;
} | 5 |
public int showPlayerSelect() {
JPanel panel = new JPanel();
JLabel chooseText = new JLabel();
panel.add(chooseText);
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
ButtonGroup buttongroup = new ButtonGroup();
JRadioButton[] buttons = new JRadioButton[6];
// makes radio button for eac... | 7 |
private int percolateDown(int hole, E value){
while(hole*4 + 1 <= index){
// compare the four children of the given hole find out the one with smallest value
// for the index i, its parent index is (i-1)/4, its children are 4i+1,..,4i+4
int target = hole*4 + 1; // first child
int second = hole*4 + 2; // s... | 8 |
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed
String searchString = txtFieldSearch.getText();
ArrayList<Staff> foundStaff = new ArrayList<Staff>();
if (searchString.isEmpty()) {
foundStaff = Controller.Instance().g... | 5 |
public void waitForConnect()
{
// fire off an action even to tell the GUI to display the waiting for
// client dialogue
// Start up a ServerSocket on port PORTNUM.
try {
serverSocket = new ServerSocket(PORTNUM);
} catch (IOException e) {
// Should be an action... | 6 |
private static void restartMIFU(){
try {
@SuppressWarnings("unused")
Process proc = Runtime.getRuntime().exec("java -jar "+CONSTS.UDIR+"/MIFU.jar");
} catch (IOException e) {
e.printStackTrace();
}
System.exit(0);
} | 1 |
public NationOptions(Specification specification, Advantages advantages) {
this.specification = specification;
setNationalAdvantages(advantages);
if (specification != null) {
int counter = 0;
Map<Nation, NationState> defaultNations = new HashMap<Nation, NationState>();
... | 6 |
* @Post: The appropriate rook is moved to the point that the king jumped over
* @Return:
*/
private void moveCastlingRook(Point p) {
if(chosenPiece.getX()-p.x>0)//left castle, move rook two right
{
Piece theRookToMove = getPiece(new Point(0,chosenPiece.getY()));
if(! (theRookToMove instanceof Rook))
... | 3 |
public void loadMapData(boolean enableBWTA) {
String mapName = new String(getMapName());
map = new Map(getMapWidth(), getMapHeight(), mapName, getMapFileName(), getMapHash(),
getHeightData(), getBuildableData(), getWalkableData());
if (!enableBWTA) {
return;
}
// get region and choke point data
File... | 7 |
public void rechPeriodique(String livre) {
Integer issn = this.getIdentifiant(livre);
Periodique per = this.getPeriodique(issn);
if (this.getVueConsulterPeriodique() != null) {
per.addObserver(getVueConsulterPeriodique());
getVueConsulterPeriodique().setPeriodique(per);
per.notifierObservateurs();
... | 8 |
public static void main(String[] args) {
if (args.length == 2) {
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
double c = Math.sqrt(a * a + b * b);
System.out.println(c);
}
} | 1 |
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_N){
reset();
}
if(e.getKeyCode() == KeyEvent.VK_D && cardStack.size() > 0){
dealNewRow();
}
repaint();
} | 3 |
public void addCommand(Command _command) {
if(!this.hasCommand(_command)) {
this.commands.add(_command);
}
} | 1 |
public PlanBooster(JSONObject object, Object boost) throws FatalError {
super("Booster");
if (boost != null && boost instanceof Integer) {
booster = (Integer) boost;
} else {
throw new ConfigError("Booster");
}
switch (this.booster) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
bre... | 8 |
public void setSector(String sector) {
Sector = sector;
} | 0 |
private Instances assignClassValue(Instances dataSet) {
if (dataSet.classIndex() < 0) {
if (m_logger != null) {
m_logger.
logMessage("[ClassValuePicker] "
+ statusMessagePrefix()
+ " No class attribute defined in data set.");
m_logger.statusMessage(statusMessagePrefix()
+ "WARNING: N... | 7 |
public String join(String separator) throws JSONException {
int len = this.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayL... | 2 |
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) {
if (!(sender instanceof Player)) {
Language.IN_GAME_ONLY.bad(sender);
return;
}
if (args.length == 0) {
Language.CMD_CHUNKY_PLAYER_SET_MODE_HELP.bad(sender);
... | 6 |
protected double getBreedingProbability()
{
return BREEDING_PROBABILITY;
} | 0 |
public synchronized HashMap<String, GameObjectInformation> updateGameObjects(int userID, Integer[] actions, HashMap<String, GameObjectInformation> clientPlayerObjects, int gameID) throws UnknownHostException, IOException, SocketTimeoutException, ClassNotFoundException {
if(actions == null){
actions = new Integer[0... | 1 |
public void addUnits(int x, int y, char ch) {
if (units.isEmpty()) {
left = right = x;
top = bottom = y;
} else {
if (x < left)
left = x;
else if (x > right)
right = x;
if (y < top)
top = y;
else if (y > bottom)
bottom = y;
}
units.add(new Unit(x, y, ch));
} | 5 |
public List<Team> simulateGroupStage(int nWinners, boolean verbose, int nTimeSteps) {
if(teams.size() < 2) return null;
//Get all 2 element combinations of all teams in group,
//simulate match.
for(int i = 0; i < teams.size()-1; i++)
for(int j = i+1; j < teams.size(); j++) {
Team A = teams.get... | 7 |
public void loadBanPhraseList() {
banPhraseLists = new HashMap<Integer, List<Pattern>>();
File f = new File("bannedphrases.cfg");
if (!f.exists())
try {
f.createNewFile();
} catch (IOException e1) {
// TODO Auto-generated catch block
... | 9 |
private void setWeight(double m) {
this.weight = m;
} | 0 |
@Override
public boolean checkActivated(String user) throws SQLException,
ClassNotFoundException {
sqlClass();
sqlCon();
if (!customField.isEmpty()) {
query = "SELECT user_id FROM " + tablePref
+ "profile_fields_data WHERE pf_" + customField + "='"
+ user + "'";
ResultSet rs = SELECT(query);
... | 4 |
public boolean updateOrderStatus(String orderNumber, String status) {
try {
Connection conn = UtilDAO.getConn();
if (!status.equals("OK") && !status.equals("NOK") && !status.equals("undefined")) {
return false;
}
int numeroPedido = Integer.parseIn... | 4 |
private void whoisonline(ServerClient activeclient) throws IOException
{
ArrayList<String> clientsOnline = new ArrayList<String>();
for (ServerClient sc : connectedClients)
{
if (sc != activeclient) // dont ask active client for its name he knows that already ^^
{
clientsOnline.add(sc.getNickname());
... | 3 |
@Override
public State run(final String program, final State s) {
Map<String, Integer> methodMap = Utils.getMethods(program);
ClassWriter cw = new ClassWriter(0);
FieldVisitor fv;
MethodVisitor mv;
cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, CLASS_NAME, null, "java/lang/Object", ... | 7 |
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve... | 9 |
public int trap(int[] height) {
if(height==null||height.length<=2)
return 0;
int len = height.length-1;
int sum = 0;
int start = 0;
if(height[1]>height[0])
start = findNextHighPoint(height,0);
// if(isLog)
// System.out.println("start "+start);
for(int i=start;i<len-1;i++){
int left = i;
int... | 5 |
public static int BSLargerThanSearch_solution2(int[] array, int key, boolean print) {
if(key<array[0]) {
if(print) System.out.println("Result is " + array[0]);
return 0;
}
if(key>array[array.length-1]) {
if(print) System.out.println("No Result");
return -1;
}
int start = 0;
int end = array.le... | 8 |
private ArrayList<Integer> getUpdSeedSet(DatasetPattern pattern){
ArrayList<Integer> updSeedIndex = new ArrayList<Integer>();
for (int i = 0; i < this.dataset.size(); i++) {
DatasetPattern p = this.dataset.get(i);
if(pattern.getID() == p.getID()) continue;
if(!p.isVisited()) break;
double distance = Euc... | 6 |
public Double getDeterminant() {
double positivo = 0.0;
if (rows == 2 && cols == 2) {
return values[0][0] * values[1][1] - values[1][0] * values[0][1];
}
for (int i = 0; i < rows; i++) {
double mult = 1.0;
for (int j = 0; j < cols; j++) {
... | 8 |
public static String createDeploymentDiagram(SoftwareSystem system, String id, String name, boolean withRespectToEP) {
String deploymentDiagram = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
deploymentDiagram += "<uml:Model xmi:version=\"" + Utils.getVersionFromDate() + "\" xmlns:xmi=\"http://www.omg.org/spec/XM... | 2 |
public static long insert(User newUser) throws SQLException {
PreparedStatement s = null;
long rowCount = 0;
try {
// Connect to database and try to insert newUser into the database
try { Class.forName("org.postgresql.Driver");} catch (ClassNotFoundException e) {}
currentCon = DriverManager.getConnection... | 7 |
public static Vector localSearch(Vector v) {
// Incrementally optimize this vector
v = v.clone(); // don't modify the original
double bestLength = Double.MAX_VALUE;
Vector bestVector = v.clone();
int[] increments = new int[] { -4, 1, 1, 1, 1, 1, 1, 1, 1, -4 };
boolean improved = t... | 7 |
@Override
public void setSoTimeout(int timeout) {
try {
mySocket.setSoTimeout(timeout);
} catch (SocketException e) {
e.printStackTrace();
}
} | 1 |
public static void cloneFileFromJar(String jarPath, String fileToMove, String pathTo) throws IOException {
notNull(jarPath, "String jarPath");
notNull(fileToMove, "String fileToMove");
notNull(pathTo, "String pathTo");
notEmpty(jarPath, "String jarPath");
notEmpty(fileToMove, "St... | 5 |
static Handler remove(Handler h, Label start, Label end) {
if (h == null) {
return null;
} else {
h.next = remove(h.next, start, end);
}
int hstart = h.start.position;
int hend = h.end.position;
int s = start.position;
int e = end == null ?... | 7 |
public Integer evaluate(ArrayList<String> needle, ArrayList<String> haystack) {
if (needle == null) {
return Integer.valueOf(-1);
}
if (haystack == null) {
return null;
}
for (int ii = 0; ii < haystack.size() - needle.size() + 1; ++ii) {
boolean found = true;
for (int jj = 0;... | 8 |
void setTile(int x, int y, Tile tile)
{
// Extract the position within the chunk
x = x % Chunk.width;
y = y % Chunk.height;
// Make sure the tile is within bounds
if( x >= Chunk.width || y >= Chunk.height || x < 0 || y < 0)
{
return;
}
contents[x][y] = tile;
} | 4 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
num = new HashMap<Integer, Integer>();
StringTokenizer st = new StringTokenizer(in.readLine());
boolean valid = true;
int cont = 0;
fo... | 7 |
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
if (par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 < 30000000)
{
if (par3 >= 0)
{
if (par3 < 256)
{
if (th... | 8 |
protected void updateAmount(int newAmount) {
final int oldAmount = this.amount ;
if (oldAmount == newAmount) return ;
clearAllAttachments() ;
//
// First, determine how many crates and packets of the good should be
// shown-
int numPacks = (int) Math.ceil(newAmount * 1f / ITEM_UNIT), numCr... | 5 |
public int readCompass()
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "readCompass");
return -1;
}
try
{
this.attemptTryAgain = true;
... | 8 |
public static Object getUIDefaultOfClass(Class clazz, String property) {
Object retVal = null;
UIDefaults defaults = getUIDefaultsOfClass(clazz);
List<Object> listKeys = Collections.list(defaults.keys());
for (Object key : listKeys) {
if (key.equals(property)) {
return defau... | 3 |
public void paint(Graphics g){
// if(!set) return;
Graphics2D g2 = (Graphics2D)g;
for(int i = 0; i < map.length; i++){
for(int j = 0; j < map[0].length; j++){
float x = map[i][j];
if(x > 1) x = 1;
else if (x < 0) x = 0;
g2.setColor(new Color(x,x,x));
g2.fillRect(i*scale,j*scale,scale,sc... | 4 |
public String getConteudoCarta(int i, int j)
throws PosicaoDeCartaInvalidaException {
if (i > 3 || i < 0 || j > 3 || j < 0)
throw new PosicaoDeCartaInvalidaException(
"Posição de carta fora dos limites do tabuleiro!");
return tabuleiro[i][j].getHistoria();
} | 4 |
public void makeNonVoid() {
if (type != Type.tVoid)
throw new alterrs.jode.AssertError("already non void");
type = subExpressions[0].getType();
} | 1 |
public boolean checkFinalState(PhysicsEvent event)
{
boolean filter = true;
int pc = event.countByCharge(+1);
int pm = event.countByCharge(-1);
int pn = event.countByCharge( 0);
if(pc<this.getMinimumByCharge(+1)||pc>this.getMaximumByCharge(+1))
r... | 8 |
public void disconnect(int frameNo) {
switch (frameNo) {
case 1:
jCheckBox1.setSelected(false);
bpmValue1.setText("Not connected");
minValue1.setText("");
maxValue1.setText("");
lastUpdateValue1.setText("... | 4 |
protected CycList unescape(CycList cycList) {
CycList unescapedCycList = new CycList();
final int cycList_size = cycList.getProperListSize();
for (int i = 0; i < cycList_size; i++) {
Object obj = cycList.get(i);
if (obj instanceof CycList)
unescapedCycList.add(unescape((CycList) obj));
... | 6 |
public void update(){
totalTime++;
if(totalTime > 200 && !(component.getScreen() instanceof MainMenu)) setScreen(new MainMenu(component, this, input));
boolean switchScreen = false;
if(logoTransparancy < 1.0f){
logoTransparancy += (float) RTSComponent.MS_PER_TICK / 2000;
}else{
logoTransparancy = ... | 5 |
private int hash(String input) {
int output = 0;
for(int i = 0; i < input.length(); i++) {
output += (int)input.charAt(i);
}
output %= this.size;
return output;
} | 1 |
public static void gameOn() {
int numOfPlayers = Integer.parseInt(JOptionPane.showInputDialog("Number of players?")),
playerTurn = 0;
Player currentPlayer;
Deck selectedCard;
ArrayList<Deck> currentPlayerCards;
String resultMessage = "", catMessage = "";
createPlayers(numOfPlayers);
scarec... | 7 |
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == 'a' || e.getKeyChar() == 'A') {
theMap.getCharacter().setDirection(-1);
} else if (e.getKeyChar() == 'd' || e.getKeyChar() == 'D') {
theMap.getCharacter().setDirection(1);
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
} els... | 6 |
public double GetItemShopValue(int ItemID, int Type, int fromSlot) {
double ShopValue = 1;
double Overstock = 0;
double TotPrice = 0;
for (int i = 0; i < server.itemHandler.MaxListedItems; i++) {
if (server.itemHandler.ItemList[i] != null) {
if (server.itemHandler.ItemList[i].itemId == ItemID) {
Sho... | 6 |
protected void tickEntities()
{
for(int i = 0;i<entities.size();i++)
{
Entity e = entities.get(i);
if(e != null)
{
if(e.world != this)
{
entities.remove(e);
}
else
... | 6 |
private static int dividers(int n){ // assumes n >= 1
int count=1; // 1 is always a divider
int i=0;
for (i=2;i<=Math.sqrt(n);i++){
if (n%i == 0){
if (i == Math.sqrt(n))
count+=1;
else
count+=2;
}
}
return count;
} | 3 |
private void getAlarmList() {
try {
List<Alarm> alarms;
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
dos.writeBytes(ServerFrame.getAlarmListCmd + "\n");
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
alarms = (List<Alarm>) ois.readObject();
... | 3 |
public static int getRecommendedExpansionDeployment(BotState state) {
int out = 0;
String gameState = GameStateCalculator.calculateGameState(state);
if (gameState.equals("open")) {
out = getRecommendedExpansionDeploymentGameOpen(state);
} else if (gameState.equals("stalemate")) {
out = getRecommendedExpan... | 8 |
@Override
public List<Product> getAll() throws SQLException {
List<Product>products = null;
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
products = session.createCriteria(Product.class).list();
session.getTransaction().commit();
... | 3 |
private java.util.ArrayList<Element> getAttributes(Node attributeGroup){
java.util.ArrayList<Element> elements = new java.util.ArrayList<Element>();
String name = DOM.getAttributeValue(attributeGroup, "name");
String ref = DOM.getAttributeValue(attributeGroup, "ref");
if (name.length()>0... | 9 |
public void addPlayer(String name , PlayerData player) {
if( player == null ) {
player = new PlayerData(this) ;
}
// Register the MBean
ObjectName oName ;
try {
oName = new ObjectName("org.dkhenry.minejmx:type=PlayerData,name="+name);
if( mbs.isRegistered(oName) ) {
mbs.unregisterMBean(oName) ;
... | 8 |
public boolean checkInput()
{
for (JTextField i : components)
if((i.getText() == null) || (i.getText().equals(""))) return false;
return true;
} | 3 |
protected boolean fillOutCopyCodes(final Modifiable E, List<String> ignoreStats, String defPrefix, XMLTag piece, Map<String,Object> defined) throws CMException
{
final String copyStatID = findOptionalStringNow(E,ignoreStats,defPrefix,"COPYOF",piece,defined, false);
if(copyStatID!=null)
{
final List<String> V=... | 8 |
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when)
{
Paint p = new Paint();
Point point_to_draw = new Point();
//Projection projection = mapView.getProjection();
//p.setColor(Color.BLUE);
p.setARGB(255, 0, 0, 0);
if(isVisible())
if(shadow==false)
{
... | 9 |
private void parseDirectory(WZDirectoryEntry dir) {
int entries = WZTool.readValue(lea);
for (int i = 0; i < entries; i++) {
byte marker = lea.readByte();
String name = null;
@SuppressWarnings("unused")
int dummyInt;
int size, checksum;
switch (marker) {
case 0x02:
name = WZTool.readDec... | 6 |
public void reduce(IntWritable docId, Iterable<Text> termFrequencies,
Context context)
throws IOException {
/* Dont collect to reduce rather write straight-away to $OUTPUT_FOLDER/Index/TermIndex/ */
int[] finalTermFrq = new int[2];
boolean mtTypeIncdence = false;
Configuration conf = context.getConfi... | 9 |
public boolean containsMappings() {
if (this.mapping != null) {
return true;
}
for (int i = 0; i < propertyCount(); i++) {
if (getProperty(i).getMapping() != null) {
return true;
}
}
for (int i = 0; i < sectionCount(); i++) {
if (getSection(i... | 5 |
@Override
public void unInvoke()
{
if(canBeUninvoked())
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((found!=null)&&(!aborted)&&(mob.location()!=null))
{
final CMMsg msg=CMClass.getMsg(mob,found,this,getCompletedActivityMessageType(),null);
msg.setValue(CMLib.dice().... | 9 |
public GraphicsConnection(Socket clientSocket, GraphicsContainer containerArg){
messages = new ConcurrentLinkedQueue<JSONObject>();
container = containerArg;
socket = clientSocket;
try {
inputReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (IOException e){
Debug.erro... | 1 |
public static void main(String args[]) {
//prompt
System.out.println("Convert your weight on earth to:");
//output list
for (Destination d : Destination.values()) {
System.out.print(d.getChoice() + ". " + d.name() + "\n");
}
//prompt for user input
System.out.print("Select a destination by number: ");
... | 5 |
public void setId(long Id) {
this.Id = Id;
} | 0 |
double[][] graySmooth(BufferedImage image) {
double[][] graySmoothed = new double[image.getWidth()][image.getHeight()];
for(int x = 0; x < graySmoothed.length; ++x) {
for(int y = 0; y < graySmoothed[x].length; ++y) {
if(x < 1 || x >= graySmoothed.length - 1 || y < 1 || y >= graySmoothed[x].length - 1) {
... | 6 |
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int num1, num2, num3, num4, num5, menor, mayor;
System.out.print("Escriba el primer entero: ");
num1 = entrada.nextInt();
menor = num1;
mayor = num1;
System.out.print("Escriba el segundo entero: ");
num2 = entrada.next... | 8 |
protected UVW computeUVW() {
Vector3 w = subtract(eye, look).normalize();
Vector3 up = rotate(this.up, w, roll);
// take care of the singularity by hardwiring in specific camera orientations
if (eye.getX() == look.getX() && eye.getZ() == look.getZ() && eye.getY() > look.getY()) { // cam... | 6 |
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... | 9 |
@Test
public void convertGameStateToStringTest2() {
City_Graph city_graph2 = new City_Graph();
city_graph2.loadMap("res/test2.mp");
assertEquals(city_graph2.convertGameStateToString(),"CRNNNNRNNC");
} | 0 |
private int countNeighbours(Point p) {
int count = 0;
for(int dx = -1; dx <= 1; dx++)
for(int dy = -1; dy <= 1; dy++) {
Point neighbour = new Point(p.x + dx, p.y + dy);
if ((dx != 0 || dy != 0) && neighbour.x >= 0 && neighbour.x < size.height
&& neighbour.y >= 0 && neighbour.y < size.w... | 9 |
public static Menu getInstance() {
if (uniqueInstance == null) {
synchronized (Orders.class) {
if (uniqueInstance == null) {
uniqueInstance = new Menu(Storage.getInstance());
}
}
}
return uniqueInstance;
} | 2 |
public static void setDynEffects(Modifiable M, HTTPRequest httpReq)
{
final QuadVector<String,String,String,String> theclasses=new QuadVector<String,String,String,String>();
boolean supportsRoles=CMParms.contains(M.getStatCodes(), "GETREFFROLE");
if(httpReq.isUrlParameter("REFFS1"))
{
int num=1;
String b... | 9 |
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.