text stringlengths 14 410k | label int32 0 9 |
|---|---|
public User getUser(Integer i) {
User result = new User();
Iterable<Entry> userQuery = this.query("{id:" + i + "}");
if (userQuery.iterator().hasNext()) {
for (Entry user : userQuery) {
result = (User) user;
}
}
return result;
... | 2 |
public void update(Graphics g)
{
Graphics gImg = null;
Dimension dmImg = null;
Dimension dm = getSize();
int wndWidth = dm.width;
int wndHeight = dm.height;
if((dmImg == null) ||
(dmImg.width != wndWidth) ||
(dmImg.height != wndHeight))
{
dmImg = new Dimension(wnd... | 4 |
public void moveCameraToScene(Scene scene, boolean immediately) {
Scene previous = scene.getPrevious();
if (previous != null) {
String s = previous.getDepartInformation();
if (s != null) {
runScriptImmediatelyWithoutThread("set echo bottom center;color echo yellow;echo \"" + s + "\"");
}
else {
... | 8 |
@SuppressWarnings("unchecked")
public int addTag(String filename, String tagType, String tagValue) {
Tag t = new Tag(tagType, tagValue);
Iterator it = GuiView.control.getCurrentUser().getAlbumList().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Album> pairs = (Map.Entry<String, Album>) it.ne... | 5 |
public static void readStandardInput() {
if (readingStandardInput)
return;
try {
in.close();
}
catch (Exception e) {
}
emptyBuffer(); // Added November 2007
in = standardInput;
inputFileName = null;
readingStandardInput = true;
inputErrorCou... | 2 |
public LoginWindow(ClientGUI clientInterface) {
mInterface = clientInterface;
setTitle("Login");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 190, 304);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayo... | 2 |
public boolean batchFinished() throws Exception {
if (getInputFormat() == null)
throw new IllegalStateException("No input instance format defined");
Instances toFilter = getInputFormat();
if (!isFirstBatchDone()) {
// filter out attributes if necessary
Instances toFilterIgnoringAttri... | 8 |
public double getTempRange(String type){
double t=0;
if (type.equals(MASHOUT))
t = MASHOUTTMPF;
else if (type.equals(SPARGE))
t = SPARGETMPF;
if (tempUnits.equals("C"))
t = BrewCalcs.fToC(t);
return t;
} | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof ClassAce))
return false;
ClassAce other = (ClassAce) obj;
if (canonicalTypeName == null) {
if (other.canonicalTypeName != null)
return false;
} else if (!canonical... | 9 |
public List<Character> getCharacterList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Character>(0);
}
List<Character> result = new ArrayList<Character>();
for (Object object : list) {
if (object instanceof Charac... | 7 |
private static StructureComponent getNextComponentVillagePath(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
{
if (par7 > 3 + par0ComponentVillageStartPiece.terrainType)
{
return null;
... | 7 |
@Override
public void printReception() {
if (!readTemplate()) return;
// Заполняем то, что необходимо заменить
fillMappings();
JOptionPane.showMessageDialog(null,
"Заменяем данные ",
"Инфо",
JOptionPane.INFORMATION_MESSAGE);
// Очищаем документ
try {
org.docx4j.model.datasto... | 6 |
@Override
public void run()
{
try
{
while(run)
{
testCase.update();
if(testCase.getAvgFitness() == Double.POSITIVE_INFINITY)
{
correctSolutions++;
totalGenerations += testCase.getGener... | 7 |
public static void disposeFonts() {
// clear fonts
for (Font font : m_fontMap.values()) {
font.dispose();
}
m_fontMap.clear();
// clear bold fonts
for (Font font : m_fontToBoldFontMap.values()) {
font.dispose();
}
m_fontToBoldFontMap.clear();
} | 2 |
public static void main(String[] args) {
int counter = 0;
int start = 22;
long sum = 0L;
while (counter < 11) {
int currentLeft = start;
int currentRight = start;
while (isPrime(currentLeft) && currentLeft > 0) {
currentLeft = leftShift(currentLeft);
}
while (isPrime(currentRight) && curre... | 7 |
public void onTick(Instrument instrument, ITick tick) throws JFException {
// 各通貨ペアのティック情報を受信した際に呼ばれます。
// LOGGER.info("onTick");
} | 0 |
public static int jump(int[] A) {
if (null == A || 0 == A.length) return -1;
int len = A.length;
int[] step = new int[len];
step[len - 1] = 0;
for (int i = len - 2; i >= 0; i--) {
int min = len + 1;
for (int j = i + 1; j <= i + A[i] && j < len; j++) {
if (min > 1 + step[j]) ... | 6 |
public BellmanFordAlgorithm(IWeightedGraph<N, Number> graph, N source) {
for(N node : graph) {
nodes.put(node, new Node<N>(node, Double.MAX_VALUE));
}
nodes.get(source).distance = 0;
List<WeightedEdge<N, Number>> edges = graph.getEdges();
for(int i = 1; i < graph.size(); i++) {
for(WeightedEdge<N, Nu... | 8 |
public String encode(String plain)
{
//int period=key.length();
String plain_u=plain.toUpperCase();
int left=plain_u.length()%(key.length()*2);
int add_x=0;
if(left!=0)
{
add_x=key.length()*2-left;
}
for(int i=0;i<add_x;i++)
{
plain_u+='X';
}
... | 4 |
public static StatusWapper constructWapperStatus(Response res) throws WeiboException {
JSONObject jsonStatus = res.asJSONObject(); //asJSONArray();
JSONArray statuses = null;
try {
if(!jsonStatus.isNull("statuses")){
statuses = jsonStatus.getJSONArray("statuses");
}
if(!jsonStatus.isNull("reposts... | 4 |
private static void loop() {
String menu[] = {"Quitter", "Statistiques", "Personnalisée", "Supérieur", "Prédéfini"};
int choix;
int quit;
Jeu jeu = new Jeu();
quit = -1;
do {
choix = JOptionPane.showOptionDialog(
null, "Quelle action voulez-vous faire?", "Banque",
JOptionPane.YES_NO_OPTIO... | 7 |
public boolean newCompraAction(String id_compras, String costo, String descripcion, String nombre, String cantidad, String fecha) throws SQLException, EmptyFieldException {
boolean res;
conn = ConexionBD.getInstance();
if(id_compras.isEmpty() || costo.isEmpty() |... | 6 |
public int lengthOfLongestSubstring(String s) {
int length = s.length();
int max = 0;
int index = -1;// 为了保证length =1 时正确。
Map<Character,Integer> map = new HashMap<Character,Integer>();
for (int i =0; i < length;i++){
char key = s.charAt(i);
if(map.contain... | 3 |
@Override
public void transform(double[] src, double[] dst) {
// TODO Auto-generated method stub
for (int i = 0; i < 3; i++)
temp2[i] = src[i];
temp2[3] = 1;
for (int i = 0; i < 3; i++) {
dst[i] = 0;
for (int j = 0; j < 4; j++) {
dst[i] += matrix[i][j] * temp2[j];
}
}
for (int i = ... | 8 |
public Organism createOrganism(List<Gene> genes) {
List<Gene> copyGenes = new ArrayList<>();
for (Iterator<Gene> it = genes.iterator(); it.hasNext();) {
copyGenes.add(new Gene(it.next()));
}
Genome newGenome = new Genome(nextEnabeledGenomeID(), copyGenes);
//refresh N... | 1 |
public UserStoreImpl(String userListFilename, String level3ElectorateFilename, String level5ElectorateFilename ){
storeFile = new File(userListFilename);
if (storeFile.exists()){
try{
users = new HashMap<String, User>();
Scanner scanner = new Scanner(storeFile);
while (scanner.hasNextLine()) {
... | 5 |
public void sendChannelMSGExclude(Client excludeme, String message){
if(excludeme != null){
for(Client c: usershere){
if(!(excludeme.equals(c))){
c.sendMessage(message);
}
}
} else {
for(Client c: usershere){
c.sendMessage(message);
}
}
} | 4 |
protected boolean initBehavior()
{
java.lang.Class cl;
if (behavior == null)
return true;
if (!super.initBehavior())
return false;
if (!super.initBehavior())
return false;
if ((cl = getMyBehavior()) == null)
return true;
... | 6 |
@Override
public int doStartTag() throws JspException {
handleEventualEvictCache();
RestletResourceFactory factory = new RestletResourceFactory();
Logger logger = Context.getCurrentLogger();
String fullSearchUri = buildSearchUriToUse();
logger.log(Level.FINEST, "fullSearchUri: " + fullSearchUri);
Lis... | 4 |
public void possibleMoves() {
int[] top = { 0, 0, 0 };
for (Pin p : pins) {
if (!p.isEmpty())
top[p.id] = p.getTopDisc().getSize();
}
System.out.println((top[0] < top[1] ? "[L -> C]" : "[ ]") + " "
+ (top[0] < top[2] ? "[L -> R]" : "[ ]") + " "
+ (top[1] < top[0] ? "[C -> L]" : "[ ... | 8 |
public String getColumnName(int column) {
return COLUMN_NAMES[column];
} | 0 |
@Override
public boolean action() throws JSONException {
if (getResult().getJSONObject("char").getString("viergewinnt").equals(
"4")) {
Output.printTabLn("Vier gewinnt steht auf 4: "
+ getResult().getJSONObject("char").getString("var1"),
Output.INFO);
} else {
Output.printTabLn("Vier gewinnt",... | 1 |
public Population select(Population population){
Config config = Config.getInstance();
if (selectionType == null){
return population;
}
switch(selectionType){
case ROULETTE:
return rouletteWheel(population, config.populationSize);
case SUS:
return stochasticUniversalSampling(population, config.... | 5 |
private int getNumberOfNewLinesTillSelectionIndex(String allLogText, int selectionIndex) {
int numberOfNewlines = 0;
int pos = 0;
while((pos = allLogText.indexOf("\n", pos))!=-1 && pos <= selectionIndex) {
numberOfNewlines++;
pos++;
}
return numberOfNewlines;
} | 2 |
public double observe() {
RandomVariable unif = null;
try {
unif = new ContinuousUniform(0, 1);
} catch (ParameterException e) {
e.printStackTrace();
}
double u = unif.observe();
int observed = 0;
double cumulativeMass = 0;
while (cumulativeMass < u) {
cumulativeMass += mass(observed);
obser... | 2 |
private static TspPopulation[] generate(){
Graph g = new Graph(INDIVIDUAL_SIZE);
TspPopulation[] h = new TspPopulation[GLOBAL_STEPS];
for (int i = 0; i < GLOBAL_STEPS; ++i){
h[i] = new TspPopulation(POPULATION_SIZE, INDIVIDUAL_SIZE, g.getGraph());
}
resultsRandom = ne... | 7 |
public String getName(){ return Name; } | 0 |
public synchronized void setSharedCounter(int sharedCounter) {
this.sharedCounter = sharedCounter;
} | 0 |
public static void loadLevel(final int level, final World world) {
BufferedReader breader = new BufferedReader(new InputStreamReader(Main.class.getResourceAsStream("/level_"
+ level + ".lvl")));
Tile[][] tiles = new Tile[World.TILE_Y][World.TILE_X];
try {
world.setDescription(breader.readLine());
for... | 3 |
public boolean exist(int searchId) {
ListElement current = this.getHead();
while (current != null) {
if (current.getId() == searchId) {
return true;
}
current = current.getNext();
}
return false;
} | 2 |
public Shader (String s) {
shader= ARBShaderObjects.glCreateProgramObjectARB();
if(shader!=0){
vertShader=createShader(loadCode("Shaders/"+s+".vert"), ARBVertexShader.GL_VERTEX_SHADER_ARB);
if (hardDebug) System.out.println("[Shader] Vertex shader code loaded: "+s);
f... | 9 |
void checkFrameValue(final Object value) {
if (value == Opcodes.TOP || value == Opcodes.INTEGER
|| value == Opcodes.FLOAT || value == Opcodes.LONG
|| value == Opcodes.DOUBLE || value == Opcodes.NULL
|| value == Opcodes.UNINITIALIZED_THIS) {
return;
... | 9 |
@Override
public void mouseDragged(MouseEvent e) {
Point pt = e.getPoint();
JComponent parent = (JComponent) e.getComponent();
if (startPt != null
&& Math.sqrt(Math.pow(pt.x - startPt.x, 2)
+ Math.pow(pt.y - startPt.y, 2)) > gestureMotionThreshold) {
startDragging(parent, pt);
startPt = null;
... | 8 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
public void setVision(Coords coords, int size) {
int xLoc = coords.getX();
int yLoc = coords.getY();
int y = 0 - size;
int x = 0;
for (int i = 0; i<=size*2; i++)
{
x = (int)Math.sqrt((size*size) - y*y);
int dist = Math.abs(-x)+ x;
... | 6 |
protected void teeTilaus(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Otetaan sessiosta vastaan sinne tallennettu tilaus-olio.
Tilaus tilaus = (Tilaus) request.getSession().getAttribute("tilaus");
int tilausID = 0;
// Tallennetaan saatu tilaus tietoka... | 2 |
public Comparator getDirectoryComparator() {
return directoryComparator;
} | 0 |
private boolean jj_2_50(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_50(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(49, xla); }
} | 1 |
public void warn(Event event) {
String c = "";
switch(event.getTypeEvent())
{
case WHITE_DETECTED :
c = "White";
case COLOR_DETECTED :
if(event.getName().equals(color) || c.equals(color)) {
if(state == 3) {
state = 4;
}
else ignore();
}
else
ignore();
break;
case GOFORWAR... | 9 |
public T pop(){
if(size == 0)
throw new NoSuchElementException();
T value = arr[--size];
arr[size] = null;
if(size > 0 && size == arr.length / 4)
resize(arr.length / 2);
return value;
} | 3 |
public static ArrayList<Position> findPieces(Board b, int piece) {
ArrayList<Position> pieces = new ArrayList<Position>();
for (int rank = 0; rank < b.board.length; rank++) {
for (int file = 0; file < b.board[rank].length; file++) {
if (b.board[rank][file] == piece) {
pieces.add(new Position(rank, file... | 3 |
public static Object toReflectType(String typeSig, Object value) {
switch (typeSig.charAt(0)) {
case 'Z':
return new Boolean(((Integer) value).intValue() != 0);
case 'B':
return new Byte(((Integer) value).byteValue());
case 'S':
return new Short(((Integer) value).shortValue());
case 'C':
return ne... | 4 |
@Override
public String getFileName() {
return getName()
+ "_x"
+ planeCenterX
+ "_y"
+ planeCenterY
+ "_w"
+ planeWidth
+ "_h"
+ planeHeight
+ "_it"
+ mits
+ (crossHairs ? "_ch" : "")
+ (drawBox ? "_box(" + boxCenterX + "," + boxCenterY + ")("
+ boxWidth + "x" +... | 4 |
public double cdfUpEq(double p, int k, int n) {
if (k < 0) return 1.0;
if (k > n) return 0;
double cdf = cdfUp(p, k, n) + pdf(p, k, n);
cdf = Math.min(1.0, cdf);
return cdf;
} | 2 |
public static int guessLoomDefinitionArity(int arity, Stella_Object definition, Cons constraints) {
if ((arity == -1) &&
(definition != null)) {
arity = Logic.computeLoomDescriptionArity(definition);
}
if (arity == -1) {
{ Stella_Object c = null;
Cons iter000 = constraints;
... | 6 |
public boolean isEmpty() {
boolean retVal = false;
if (backPtr == -1) {
retVal = true;
}
return retVal;
} | 1 |
public static void writeToFile(List<String> lines, File f)
throws IOException {
System.out.println("writeToFile function started.");
String encoding = code(f);
encoding = "UTF-16LE";
FileOutputStream fos = new FileOutputStream(f);
OutputStreamWriter writer = new OutputStreamWriter(fos, encoding);
// Outpu... | 4 |
public void write(final DataOutputStream out) throws IOException {
out.writeShort(modifiers);
out.writeShort(name);
out.writeShort(type);
out.writeShort(attrs.length);
for (int i = 0; i < attrs.length; i++) {
out.writeShort(attrs[i].nameIndex());
out.writeInt(attrs[i].length());
attrs[i].writeData... | 1 |
public final void translate(double x, double y, double z) {
if (DIRS[0] != x || DIRS[1] != y || DIRS[2] != z) {
// Cache it!
DIRS[0] = TRANSLATE.entry[0][3] = x;
DIRS[1] = TRANSLATE.entry[1][3] = y;
DIRS[2] = TRANSLATE.entry[2][3] = z;
}
premultiply(TRANSLATE);
} | 3 |
public synchronized void start() throws Exception {
if (thread != null) {
throw new Exception("ProcessRunner already started.");
}
thread = new Thread(new Runnable() {
@Override
/** run()
*
* The run function of the runnable object within the thread
* Checks to see if any ProcessChildren... | 6 |
public boolean deleteEvidence(Evidence c) {
Element evidenceE;
boolean flag = false;
for (Iterator i = root.elementIterator("evidence"); i.hasNext();) {
evidenceE = (Element)i.next();
if (evidenceE.element("id").getText().equals(c.getId())) {
evidenceE.element("isDelete").setText("true");
// Write t... | 3 |
public EqualDivisionNormalDistributedOrdersGenerator(
int numberOfForerunPeriods, int offSet) {
if (numberOfForerunPeriods < 0 || offSet < 0) throw new IllegalArgumentException();
this.forerun = numberOfForerunPeriods;
this.offSet = offSet;
} | 2 |
public ListModel<ICPBrasilCertificate> getChainListModel() {
DefaultListModel<ICPBrasilCertificate> lmodel = new DefaultListModel<>();
for (ICPBrasilCertificate c : this.getCertificate().getChain()) {
lmodel.addElement(c);
}
return lmodel;
} | 1 |
public String login() {
User fetchUser = userHelper.getUser(username, password);
if (fetchUser != null) {
// success
user = fetchUser;
loggedIn = true;
if (user.getType().equals("admin")) {
admin = true;
librarian = true;
}
if (user.getType().equals("librarian")) librarian = true;
// ... | 6 |
public void setupCommands() {
PluginCommand cs = plugin.getCommand("cs");
CommandExecutor commandExecutor = new CommandExecutor() {
public boolean onCommand( CommandSender sender, Command command, String label, String[] args ) {
if (args.length > 0) {
cs(s... | 2 |
public static String decodeJavaEscape(String encoded){
if(encoded.indexOf('\\') == -1) return encoded;
StringBuffer buf = new StringBuffer();
for(int i = 0; i < encoded.length(); i++){
if(encoded.charAt(i) == '\\'){
char c = encoded.charAt(++i);
switch(c){
case 't':
buf.append('\t... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
if( e.getSource() == boton_alta_empleado ){
Controlador.getInstance().accion(EventoNegocio.GUI_ALTA_EMPLEADO,GUIPrincipal_Empleado.this);
}
else if( e.getSource() == boton_baja_empleado){
... | 5 |
public int setBusy() {
for(int i=0; i<this.docStates_IsBusy.length;i++)
if(!this.docStates_IsBusy[i])
{
this.docStates_IsBusy[i] = true;
return i;
}
return -1;
} | 2 |
public void setName(String name) {
this.name = name;
} | 0 |
public void gameRender(ScreenManager screenmanager, ClientStreamReader reciever) {
sm = screenmanager;
recieveDataHandler = reciever;
init();
while(running){
Graphics2D g = sm.getGraphics();
try{
networkTransmit();
}catch(Exception e){
System.err.println("network transmission");
... | 5 |
public static void main(String ... args) throws AWTException, InterruptedException {
TetrisSensor sensor = new TetrisSensor();
Point p = sensor.getBoardPosition();
Point [][] points = sensor.getGridPointArray(p);
if (p != null) {
int width = 0;
int height = 0;
... | 9 |
public void checkEvent(){
// for(String script : haltables.keySet())
// System.out.println(script+": "+haltables.get(script));
for(String script : scripts.keySet())
if(!triggered(script)){
// System.out.println("CondMet: \""+script+"\"\t"+
// main.evaluator.evaluate(scripts.get(script).getKey())+"\ttrig... | 5 |
public Forest<T> build(Iterable<T> values) {
/*
* 1. split by cardinality
* 2. from low cardinality to high: append nodes
* */
Map<Integer, Map<List<E>, T>> byCardinality = Maps.newTreeMap();
for (T value : values) {
List<E> path = funnel.getPath(value);
... | 9 |
private String showOpenDialog(){
JFileChooser fc = new JFileChooser();
int rc = fc.showDialog(null, "Select Data File");
if (rc == JFileChooser.APPROVE_OPTION){
File file = fc.getSelectedFile();
return file.getAbsolutePath();
}
return null;
} | 1 |
public void decrementLifetime() {
lifetime--;
if(lifetime == 0)
for(PositionChangedObservable o : hoveringElements) {
o.accept(new DeactivatePowerFailureVisitor());
}
} | 2 |
public boolean commandPASS(String nombreUsuario, String passwordUsuario)
{
if (nombreUsuario == null || passwordUsuario == null)
{
out.println("autentication_error");
return false;
} else
{
try
{
// Leer el listado de Usuarios y contrasenas
BufferedReader reader = new BufferedReader(new F... | 8 |
public static String createContact(String name, String email, String publicKey, String memo) {
String contactID = "error";
System.out.println("in createContact");
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("createContact... | 5 |
public JsonArray getArray(int index) {
Object value = get(index);
if (value instanceof JsonArray) {
return (JsonArray) value;
}
return new JsonArray();
} | 1 |
@Override
public boolean isRelevant(GameState inState){
boolean isLiveSeer = (inState.playerTest(this.Player) == 2);
boolean isDeadSeer = (inState.playerTest(this.Player) == -2);
int TimeOfDeath = inState.getTimeOfDeath(this.Player);
if(isLiveSeer){
return true;
} else {
if(isDeadSeer && (this.Round... | 3 |
public int bestPolynomialFit(){
this.methodUsed = 3;
this.sampleErrorFlag = true;
this.titleOne = "Best polynomial fitting: r = c[0] + c[1].a + c[1].a^2 + ... + c[n].a^n; best fit degree (n) = ";
if(!this.setDataOneDone)this.setDataOne();
ArrayList<Object> al = super.bestPolynom... | 4 |
@Override
public ArrayList<String> getTopStreak() {
ArrayList<String> top_Players = new ArrayList<String>();
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = conn.prepareStatement("SELECT player_name FROM `ffa_leaderboards` ORDER BY `killstreak` DESC");
rs = pst.executeQuery();
int count... | 7 |
public void fadeOut() {
stopFadeIn();
if(fadeTime > 0.0f) {
if(fadeOut != null) {
if(!fadeOut.isFading()) {
stopFadeOut();
fadeOut = new GameMusicFade(this, currentGain, getMinGain(), fadeTime, 0.0f);
}
} els... | 4 |
private float[] normalize(byte[] pixels, float[] normComponents,
int normOffset) {
if (normComponents == null) {
normComponents = new float[normOffset + pixels.length];
}
// trivial loop unroll - saves a little time
switch (pixels.length) {
case 4:
... | 5 |
public synchronized void valueChanged(TreeSelectionEvent e) {
if (decompileThread != null)
return;
TreePath path = e.getNewLeadSelectionPath();
if (path == null)
return;
Object node = path.getLastPathComponent();
if (node != null) {
if (hierarchyTree && hierModel.isValidClass(node))
lastClassName... | 7 |
public void run() throws IOException {
//Setup Logging environment
FileHandler file = new FileHandler(config.serverLog);
file.setFormatter(new SimpleFormatter());
LOG.setLevel(Level.INFO);
LOG.addHandler(file);
// create server socket and set timeout to 0
ServerSocket ss = new ServerSocket(config.port,... | 2 |
private Image getImage(AffineTransform transformation)
{
if (cachedImage == null || lastZoom != pModel.getZoom() || lastOffsetX != pModel.getViewOffsetX() || lastOffsetY != pModel.getViewOffsetY()
|| lastCanvasWidth != pModel.getCanvasWidth() || lastCanvasHeight != pModel.getCanvasHeight())
... | 6 |
static boolean isBoardElementEmpty(char boardElement) {
return boardElement != NEXT_LINE_FIELD_CHAR && boardElement == EMPTY_FIELD_CHAR;
} | 1 |
private int goTowardsTargetDirection(){
if (target.getX() == this.getX()){
int yDistance = target.getY() - this.getY();
if (yDistance <= 0){
return Standards.NORTH;
} else {
return Standards.SOUTH;
}
} else if (target.getY() == this.getY()){
int xDistance = target.getX() - this.getX();
if... | 7 |
@Override
public void mouseClicked(MouseEvent event, Rectangle bounds, Row row, Column column) {
Boolean enabled = (Boolean) row.getData(column);
row.setData(column, enabled.booleanValue() ? Boolean.FALSE : Boolean.TRUE);
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BankClient other = (BankClient) obj;
if (accounts == null) {
if (other.accounts != null)
return false;
} else if (!accounts.equals(other... | 9 |
@Override
public double membership(double x) {
if (Double.isNaN(x)) {
return Double.NaN;
}
//from Octave smf.m
double a_b_ave = (bottomLeft + topLeft) / 2.0;
double b_minus_a = topLeft - bottomLeft;
double c_d_ave = (topRight + bottomRight) / 2.0;
... | 7 |
private static boolean isValidPrice(Float price) {
return price != null && price >= PRICE_MIN && price <= PRICE_MAX;
} | 2 |
public Main() throws Exception {
Config.glAvoidTextureCopies = true;
Config.maxPolysVisible = 1000;
Config.glColorDepth = 24;
Config.glFullscreen = false;
Config.farPlane = 4000;
Config.glShadowZBias = 0.8f;
Config.lightMul = 1;
Config.collideOffset ... | 0 |
public MinuetoImage flip(boolean horizontal, boolean vertical) {
if (horizontal == false && vertical == false) {
// Have Nothing To Do But Return Original Image
return (MinuetoImage) this.clone();
}
else {
/* What we want to flip */
int iFlipX = 1, iFlipY = 1;
/* Test our Arguments and Convert to ... | 4 |
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
} | 0 |
public synchronized void status(HTSMsg msg, int clientId){
Subscription s = getSubscription((Long) msg.get("subscriptionId"), clientId);
HTSPServerConnection c = monitor.getServerConnection(s.serverConnectionId);
msg.put("subscriptionId", s.serverSubscriptionId);
try {
c.send(msg);
} catch (IOException e) ... | 2 |
public static String checkForBootstrapperUpdates(boolean verbose, String currentVersion, JSONObject versionsConfig) {
if (Util.versionIsEquivalentOrNewer(currentVersion, versionsConfig.get("latestmupdate").toString())) {
//Jump out if the launcher is up to date
Logg... | 7 |
public static QuenchThirst getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(QuenchThirst.class){
// this is needed if two threads are waiting at the monitor at the
... | 2 |
public static void startupLiterals() {
if (Stella.currentStartupTimePhaseP(0)) {
Stella.ZERO_WRAPPER = IntegerWrapper.newIntegerWrapper(0);
Stella.ONE_WRAPPER = IntegerWrapper.newIntegerWrapper(1);
Stella.FALSE_WRAPPER = BooleanWrapper.newBooleanWrapper(false);
Stella.TRUE_WRAPPER = BooleanW... | 7 |
public Function parse() {
System.out.println(s);
StringTokenizer tokenizer = new StringTokenizer(s);
while (tokenizer.hasMoreTokens()) {
String str = tokenizer.nextToken();
last = operation_stack.peek();
if (str.equals("(")) {
operation_stac... | 8 |
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.