text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void sendMessage(String msg)
{
try {
writer.write(msg+"\n");
writer.flush();
} catch (IOException e) {
System.out.println("Message send failed");
e.printStackTrace();
}
} | 1 |
public static boolean getBooleanValue(String attr) {
return Boolean.parseBoolean(prop.getProperty(attr));
} | 0 |
public Deck() {
// Create an unshuffled deck of cards.
deck = new Card[52];
int cardCt = 0; // How many cards have been created so far.
for ( int nSuit = 0; nSuit <= 3; nSuit++ ) {
for ( int nValue = 1; nValue <= 13; nValue++ ) {
deck[cardCt] = new Card(nValue,nSui... | 2 |
private Class<?> eliminateEnumSubclass(Class<?> cls) {
Class<?> sup = cls.getSuperclass();
if (sup != null && sup.getSuperclass() == Enum.class) {
return sup;
}
return cls;
} | 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 feel.
* For details see http://down... | 6 |
@Override
public void run() {
try {
this.mapper = new Mapper("mapper.yaml");
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
}
JarLoader.load("minecraft_server.jar");
this.playerList = new ReflxPlayerList(this);
t... | 7 |
private Object[] scanBlockScalarBreaks(int indent) {
// See the specification for details.
StringBuilder chunks = new StringBuilder();
Mark endMark = reader.getMark();
int ff = 0;
int col = this.reader.getColumn();
while (col < indent && reader.peek(ff) == ' ') {
... | 7 |
final void method2380(AbstractToolkit var_ha, int i, boolean bool,
Class318_Sub1 class318_sub1, int i_0_, byte i_1_,
int i_2_) {
do {
try {
anInt9970++;
if (i_1_ > -106)
method2402(-5, (byte) 56);
if (!(class318_sub1 instanceof Class318_Sub1_Sub1_Sub2))
break;
Class318_Sub1_Sub1_Sub2... | 8 |
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
AffineTransform DEFAULT = g2.getTransform();
if(first!=null && !mazzo.isEmpty())
first.drawCartaBack(g2);
if(!carteSpostate.isEmpty()){
... | 5 |
public boolean verify(JComponent input) {
boolean allow = true;
if (input instanceof JFormattedTextField) {
JFormattedTextField textField = (JFormattedTextField)input;
AbstractFormatter formatter = textField.getFormatter();
if (formatter != null) {
Str... | 5 |
private void handleOptions(int keyCode) {
switch (keyCode) {
case DeviceSpecification.LSK:
case DeviceSpecification.CLEAR:
if (applicationState.lastState() == ApplicationState.MAIN_MENU) {
applicationState.setState(ApplicationState.... | 7 |
public RegularEnvironment(RegularExpression expression) {
super(expression);
expression.addExpressionListener(new Listener());
} | 0 |
protected void brew(int[] buf) {
assert buf.length % 2 == 1;
int i, v0, v1, sum, n;
i = 1;
while (i < buf.length) {
n = CUPS;
v0 = buf[i];
v1 = buf[i + 1];
sum = 0;
while (n-- > 0) {
sum += SUGAR;
... | 2 |
public static boolean check(int row, int col) {
for (int prev = 1; prev < col; prev++)
if (board[prev] == row // Verify row
|| (Math.abs(board[prev] - row) == Math.abs(prev - col))) // Verify
// diagonals
return false;
return true;
} | 3 |
static List<String> cortarPalabras (String texto, int cantidadDeLetras){
List<String> lstFinal= new ArrayList<String>();
StringBuilder builder= new StringBuilder();
if(texto.split(" ").length > 0){
String[] arrayAux = texto.split(" ");
List<String> lstPalabras= Arrays.as... | 9 |
public double resolveCollisionY(AABB other, double moveAmtY) {
double newAmtY = moveAmtY;
if (moveAmtY == 0.0) {
return moveAmtY;
}
if (moveAmtY > 0) {
// Our max == their min
newAmtY = other.getMinY() - maxY;
} else {
// Our min == their max
newAmtY = other.getMaxY() - minY;
}
if (Math.ab... | 3 |
@Override
public void run(int iterations) {
// Do iterations
for (int i = 0; i < iterations; i++) {
// Find the best 5 paths of the generated paths
LimitedPriorityQueue lpq = new LimitedPriorityQueue(queueLimit,
new Double(1));
// shortestPathLength.
ArrayList<int[][]> chromosomes = getChromosom... | 9 |
public static List<Laureate> filterByBirthYear(List<Laureate> inputList, List<String> ListOfTerms) {
List<Laureate> outputList = new ArrayList<Laureate>();
// parse input, keep what matchs the terms.
for (Laureate Awinner : inputList) {
if (ListOfTerms.contains(Awinner.getBirth())) ... | 2 |
private void initializeBuffer()
{
if (this.BufferGraphics != null) {
this.BufferGraphics.dispose();
}
if (this.BufferImage != null)
this.BufferImage.flush();
Object localObject;
if (this.ImageContainerParent == null)
{
localObject = this;
}
else
{
ImageConta... | 7 |
public SplashWindow(Frame f, String imgName) {
super(f);
this.imgName = imgName;
tk = Toolkit.getDefaultToolkit();
splashImage = loadSplashImage();
showSplashScreen();
//f.addWindowListener(new WindowListener());
} | 0 |
private void submit_modify_buttonActionPerformed(ActionEvent evt,
String courseIDToModify) {
Instructor instructor_taken;
String instField = instruct_combo.getSelectedItem().toString();
instField = instField.substring(instField.indexOf("-") + 2);
int instID = Integer.parseInt(instField);
instructor_taken =... | 4 |
private void actionGetpiece (String key, String demande, OutputStream out) throws IOException {
// Passer directement le string
String[] tab = demande.split(" ");
Object o = _hash.get(key);
if (o != null){
Fichier f = (Fichier)o;
if (_estMisAssertion)
System.out.println("On me demande des pièce de mon... | 7 |
@Override
public void perform(CommandSender sender, String[] args) {
List<String> GymTypes = instance.getConfig().getStringList("GymTypes");
if (args.length == 2)
{
if (args[0].equalsIgnoreCase("List"))
{
for (String i : GymTypes)
{
if (args[1].equalsIgnoreCase(i))
{
Integer coun... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SpacePort spacePort = (SpacePort) o;
if (averageStartsCount != spacePort.averageStartsCount) return false;
if (name != null ? !name.equals(spaceP... | 6 |
public static List fromCollection(Collection c) {
if ((c != null) && (c instanceof List)) {
return (List)c;
}
if ((c == null) || (c.size() == 0)) {
return new ArrayList();
}
List list = new ArrayList(c.size());
Iterator itr = c.iterator();
while (itr.hasNext()) {
list.add(itr.next());
}
... | 5 |
public static void main(String args[]) {
Scanner inFile = null;
try {
// Create a scanner to read the file, file name is parameter
inFile = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/numsort.dat"));
} catch (FileNotFoundException e) {
System.out.println("File not found!");
// St... | 6 |
private final void method511(int i) {
anInt1003++;
for (Class348_Sub23 class348_sub23
= (Class348_Sub23) aClass356_1011.method3484(0);
class348_sub23 != null;
class348_sub23
= (Class348_Sub23) aClass356_1011.method3482(i + 2)) {
if (class348_sub23 != aClass348_Sub23_Sub2_1001) {
while (((Clas... | 8 |
protected void setSize(int size) {
if (size < 0) {
size = 9;
} else if (size % 9 != 0) {
size += 9 - (size % 9);
}
this.size = size;
} | 2 |
@EventHandler
public void onUpdate(UpdateEvent e)
{
if (e.getUpdateType() == UpdateType.SECOND)
{
boolean isInHill = false;
while (!isInHill)
{
if (enterQueue.size() > 0)
{
if (!arena.getCuboid().contains(enterQueue.peek().getLocation()))
{
Chat.sendMessage(enterQueue.remove(), Me... | 5 |
public ListNode mergeKLists(ListNode[] lists) {
if (lists == null || lists.length == 0) {
return null;
}
Stack<ListNode> s1 = new Stack<ListNode>();
Stack<ListNode> s2 = new Stack<ListNode>();
for (int i = 0; i < lists.length; i++) {
s1.push(lists[i]);
... | 7 |
public int ScoreHand(Card[] Hand){
int Score=0;
int Aces =0;
System.out.println("---------------");
System.out.println(Hand[0].Value);
System.out.println(Hand[1].Value);
System.out.println(Hand[2].Value);
System.out.println(Hand[3].Value);
System.out.println("================");
for(int x=0;x<Hand.len... | 9 |
public FordFulkersonAlgorithm(IWeightedGraph<N, Number> originalGraph, N source, N sink) {
WeightedGraph<N, Number> graph = new WeightedGraph<N, Number>(true);
List<WeightedEdge<N, Number>> edges = originalGraph.getEdges();
for(WeightedEdge<N, Number> edge : edges) {
graph.addNode(edge.from);
graph.ad... | 7 |
private final void closeElement() throws IOException {
if (openElement) {
w.write(">\n");
}
openElement = false;
} | 1 |
@NonNull
public void parseJSONtoMap (URL u, String name, HashMap<String, String> h, boolean testEntries, String location) {
try {
String json = IOUtils.toString(u);
JsonElement element = new JsonParser().parse(json);
int i = 10;
if (element.isJsonObject()) {
... | 7 |
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuilder sb = new StringBuilder();
for (; ; ) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = sb.length() -... | 6 |
@Override
public boolean run() {
verbose = true;
// Load reactome data
Reactome reactome = new Reactome();
reactome.setVerbose(verbose);
reactome.load(reactomeDir, geneIdsFile);
// Load GTEX data
if (verbose) Timer.showStdErr("Loading GTEx data");
Gtex gtex = new Gtex();
gtex.setVerbose(verbose);
... | 2 |
@SuppressWarnings("rawtypes")
/**
* Retrieve class names implementing the given interface existing somewhere in the basePackage
*/
public static List<String> getClassNamesImplementingInterface(Class interf, String basePackage) {
List<String> classNames = new ArrayList<String>();
try {
Class[] result = get... | 6 |
public byte[] decrypt(byte[] textEncrypted, String key){
byte[] decrypted = null;
try{
//keygenerator.init(bits); // 192 and bits bits may not be available
byte[] keyPadded = new byte[bits / 8];
for(int i = 0; i < bits / 8 && i < key.length(); i++){
keyPadded[i] = (byte)key.charAt(i);
}
/*... | 7 |
private void initialize(boolean check) {
setLayout(new GridLayout(7, 1));
numberOfFilesLabel = new JLabel("Number of Files \t:\t ");
lineOfCodeLabel = new JLabel("Lines of Code \t:\t ");
commentsLabel = new JLabel("Commented Lines \t:\t ");
blankLinesLabel = new JLabel("Blank Lines \t:\t ");
totalLinesLabel... | 1 |
public void MostraPesquisa(List<Usuario> usuario) {
while (tmUsuario.getRowCount() > 0) {
tmUsuario.removeRow(0);
}
if (!usuario.isEmpty()) {
String[] linha = new String[]{null, null};
for (int i = 0; i < usuario.size(); i++) {
tmUsuario.addRow... | 3 |
public int canCompleteCircuit1(int[] gas, int[] cost) {
for(int i =0;i< gas.length;i++){
if(gas[i] >= cost[i]){
if(canFinish(gas,cost,i))
return i;
}
}
return -1;
} | 3 |
private static List<String> splitIntoIndividualLocants(String locantString) {
List<String> individualLocants = new ArrayList<String>();
char[] charArray = locantString.toCharArray();
boolean inBracket =false;
int indiceOfLastMatch =0;
for (int i = 0; i < charArray.length; i++) {
char c = charArray[i];
i... | 9 |
private void calcProduction() {
Arrays.fill(productionHolder, 0);
for (Pattern pattern : plan.getPatterns()) {
for (int i = 0; i < problem.size(); i++) {
productionHolder[i] += pattern.getProduction(i);
}
}
cachedUnderproductionAmount = 0;
... | 6 |
@Test
public void pisteSetXJaSetYToimivat() {
p.setX(10);
assertTrue("Väärä siirretyn pisteen x", p.getX() == 10);
p.setY(10);
assertTrue("Väärä siirretyn pisteen y", p.getY() == 10);
p.setXY(new Piste(20, 50));
assertTrue("Väärä siirretyn pisteen x", p.getX() == 20);... | 0 |
public ConvertRegularGrammarToFSA(GrammarEnvironment environment) {
super("Convert Right-Linear Grammar to FA", null);
this.environment = environment;
} | 0 |
public boolean saveData(String data,String dataFile) {
boolean test = false;
if (test || m_test) {
System.out.println("Saver :: saveData() BEGIN");
}
try {
setFile(dataFile);
PrintWriter out = new PrintWriter(this.getFile());
//try... | 5 |
public void move(int Xa, int Ya) {
if (Xa != 0 && Ya != 0) {
move(Xa, 0);
move(0, Ya);
numSteps--;
return;
}
numSteps++;
if (!hasCollided(Xa, Ya)) {
if (Ya < 0) {
movingDir = 0;
}
if (Ya > 0) {
movingDir = 1;
}
if (Xa < 0) {
movingDir = 2;
}
if (Xa > 0) {
movingD... | 7 |
public void validate(Object obj, Errors errors) {
PriceIncrease pi = (PriceIncrease) obj;
if (pi == null) {
errors.rejectValue("percentage", "error.not-specified", null, "Value required.");
}
else {
logger.info("Validating with " + pi + ": " + pi.getPercentage());... | 3 |
public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys ... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
return (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) ||
(par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) ||
(par5 == 3 && par1World.isBlockSo... | 9 |
private static Node<Integer> add_TailOnesDigitData_Internal(Node<Integer> num1, Node<Integer> num2, IntWrapper carry) {
if (num1 == null && num2 == null) {
return null;
}
Node<Integer> prevRes = null;
if (num1 == null) {
prevRes = add_TailOnesDigitData_Internal(nu... | 6 |
public List<PhpposLogEntrada> getPosLogEntradasFromFecha(Date desde,
Date hasta){
DetachedCriteria criteria = DetachedCriteria.forClass(PhpposLogEntrada.class);
criteria.add(Restrictions.between("fechaCreacion", desde, hasta));
return ge... | 0 |
@Override
public void onCombatTick(int x, int y, Game game) {
SinglePlayerGame spg = (SinglePlayerGame) game;
List<Entity> neighbors = spg
.getSquareNeighbors(x, y, 1);
for (Entity entity : neighbors) {
if (entity.id == human.id) {
MortalEntity mor... | 6 |
public void loadWord() {
WordLoader w1 = getWordLoader();
try {
String wordString = w1.getWord();
word = new HMWord(wordString);
} catch (Exception e) {
e.printStackTrace();
}
} | 1 |
private void loadAllClientReps(){//COMPLETE
try {
ResultSet dbAllClientReps = null;
Statement statement;
statement = connection.createStatement();
dbAllClientReps = statement.executeQuery( "SELECT ClientRep.clientRepID, ClientRep.organisationID, ClientRep.... | 6 |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(sender instanceof Player)
{
Player player = (Player) sender;
if(plugin.confirm.containsKey(player))
{
String group = plugin.confirm.get(player);
@SuppressWarnings("unchecked")
... | 5 |
public float getRecall(String[] manualSummaries, String[] generatedSummaries){
String manualSummary,generatedSummary;
int matchCount=0;
int manualSummaryCount=0;
String[] manualOneGram = null,generatedOneGram = null;
if(manualSummaries==null || generatedSummaries==null || manualSummaries.length!=generatedSumm... | 7 |
public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
if (!exp1.getType(st).equals("int")
&& !exp1.getType(st).equals("decimal"))
Main.error("type error in mult!");
if (!exp2.getType(st).equals("int")
&& !exp2.getType(st).equals("de... | 4 |
private static int alphaBeta(Configuration conf, int alpha, int beta,byte depth,byte max){
if ((conf.whoWin() != 0) || (depth >= max)){
return evaluation(conf);
}
else{
int meilleur = Integer.MIN_VALUE;
for (Configuration fconf : listeFils(conf)) {
int suiv=-alphaBeta(fconf, -beta, -alpha, (byte) (de... | 6 |
public void setPWfieldBorderthickness(int[] border) {
if ((border == null) || (border.length != 4)) {
this.pwfield_Borderthickness = UIBorderthicknessInits.PWFIELD.getBorderthickness();
} else {
this.pwfield_Borderthickness = border;
}
somethingChanged();
} | 2 |
private void showLoans()
{
List<Book> books = library.getLoanedBooks();
List<Cd> CDs = library.getLoanedCds();
List<Magazine> magazines = library.getLoanedMagazines();
boolean done = false;
do {
printHeader("Books");
int index = 1;
printBo... | 7 |
@Test
public void runTestButton4() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_Button4.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size());
} | 0 |
public static void main(String[] args) {
if(args.length >= 1 && args[0].equals("debug")){
debug = true;
}
client1 = new Client();
try {
//client1.buildGUI();
gui = new GUI(client1);
config = new Config();
String tmp = config.getWindowTitle();
if (!tmp.equals("")) {
client1.windowTitle = tm... | 4 |
public PlayerUpdate getUpdate(){
PlayerUpdate x = new PlayerUpdate();
if(sprite.equals(up)){
x.spriteDirection = "up";
}
else if(sprite.equals(left)){
x.spriteDirection = "left";
} else if(sprite.equals(right)){
x.spriteDirection = "ri... | 3 |
void render(){
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
int k = j*4+i;
U.batch.draw(icons[j][i],U.h+U.SPRITESIZE, U.h-(k)*U.SPRITESIZE-U.SPRITESIZE*3/4,U.SPRITESIZE/2,U.SPRITESIZE/2);
if(k%4 != 3){
if(statsArray[k] < minima[k]){
U.font.setColor(1, 0, 0, 1);
U.batch.draw(... | 5 |
public String[] nextStrings(int n) throws IOException {
String[] res = new String[n];
for (int i = 0; i < n; ++i) {
res[i] = next();
}
return res;
} | 1 |
private static int serLane(int[] width, int i, int j) {
int currentMin = MAX_N;
for (; i <= j; i++) {
if (width[i] < currentMin) {
currentMin = width[i];
}
}
return currentMin;
} | 2 |
@Override
public void setEmail(String email) {
super.setEmail(email);
} | 0 |
@Override
public void destroy() {
tree = null;
oldValue = null;
newValue = null;
} | 0 |
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
JComboBox combo = (JComboBox) e.getSource();
int index = combo.getSelectedIndex();
System.out.println("./files/img/" + images[index]);
display.setIcon(new ImageIcon("./files/img/" + images[index]));
}
} | 1 |
public boolean insideBase(Player player) {
for (Region region : HyperPVP.getMap().getRegions(RegionType.TEAM)) {
if (region.hasLocation(player.getLocation())) {
return true;
}
}
return false;
} | 2 |
public final GalaxyXSemanticParser.modifier_return modifier() throws RecognitionException {
GalaxyXSemanticParser.modifier_return retval = new GalaxyXSemanticParser.modifier_return();
retval.start = input.LT(1);
int modifier_StartIndex = input.index();
CommonTree root_0 = null;
... | 9 |
private void switchToSpeedHost() throws FatalError {
if (Config.getSpeedHost() != null) {
try {
String page = Utils.getString("speed/index");
int pos = page.indexOf("speedlink");
if (pos < 0) throw new NotFound();
page = page.substring(pos);
pos = page.indexOf("\"");
if (pos < 0) ... | 5 |
private void initActions() {
for (int i = 0; i < tools.length; ++i) {
final Tool tool = tools[i];
String group = tool.group;
if (group.equals("tool")) {
tool.action = new Runnable() {
public void run() {
setPaintTool(tool.id);
}
};
} else if (group.equals("fill")) {
tool.action... | 9 |
public boolean _setSpeedX(int speedX)
{
if(speedX > -1)
{
this.speedX = speedX;
return true;
}
else
{
return false;
}
} | 1 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message1 = (Message) o;
if (date != null ? !date.equals(message1.date) : message1.date != null) return false;
if (message != null ? !me... | 9 |
@Override
public boolean apply(final SliceIntArray input, final SliceIntArray output)
{
if ((!SliceIntArray.isValid(input)) || (!SliceIntArray.isValid(output)))
return false;
final int nbThreads = this.delegates.length;
ArrayList<Callable<Boolean>> filterTasks = new ArrayList<Cal... | 8 |
private static void dumpDynamicNpcs(RT6CacheSystem system) {
NpcDefinitionLoader loader = system.npcLoader;
ScriptLoader scriptLoader = system.scriptLoader;
PrintWriter writer = null;
try {
writer = new PrintWriter(new File("dynamic_npcs.java"));
} catch (FileNotFoundException e) {
e.printStackTrace();
... | 9 |
private List<Move> possibleMoves() {
final boolean mustAttack = state.mustAttack();
final List<Move> result = new ArrayList<>();
if (!mustAttack) {
result.add(Move.PASS);
}
for (byte from = 0; from < Move.N_BOARD_LOCATIONS; from++) {
if (state.getOwner(fr... | 8 |
private boolean processDot_r(int x, int y, int owner, boolean mask[][]) {
if(isOnBorder(x, y)) {
return false;
}
if(map[x][y].owner == owner && map[x][y].status) {
return true;
}
if(mask[x][y]) {
return true;
}
... | 8 |
public void drawBarChart(
Object[] data,
int ageInterval) {
setPaint(Color.DARK_GRAY);
RoundingMode roundingMode = getRoundingMode();
BigDecimal cellWidth = getCellWidth();
int originCol = getOriginCol();
TreeMap<Long, BigDecimal> femaleAgeInYearsPopulatio... | 6 |
public static void main(String args[]) throws Exception {
for (int i = 0; i < 10; i++) {
System.out.println(GUID.generate());
}
}//main | 1 |
@Override
public String getMixedString(UnicodeSet localeAlphabet, int length) {
if(length == 0) {
return "";
}
if(length <= 0) {
throw new IllegalArgumentException("Length must be greater than 0.");
}
ArrayList<int[]> alphabets = this.getCharacterSetList();
alphabets.add(getCharArray(localeAlph... | 5 |
private static void refreshAndSave(AbstractProject template, ImplementationBuildWrapper implementationBuildWrapper, XmlFile implementationXmlFile, String oldDescription, boolean oldDisabled, Map<TriggerDescriptor, Trigger> oldTriggers) throws IOException {
TopLevelItem item = (TopLevelItem) Items.load(Jenkins.getInst... | 7 |
public void fillHuffTable(Node root)
{
if(root == null) return;
else
{
if( root.character != - 1)
{
//System.out.print(root.frequency + "-[" + (char)root.character + "] ");
Code newCode = new Code(code);
huffTable[root.character] = newCode;
//System.out.println(newCode.toString());
}
... | 5 |
public void addCommands(Object o) {
try {
interpreter.set("current_interpreter", interpreter);
evaluations = "import graphtea.graph.graph.*;" + evaluations;
evaluations = "import graphtea.ui.lang.*;" + evaluations;
} catch (EvalError evalError) {
evalError... | 8 |
private void decreaseKeyUnchecked(Entry entry, double priority) {
/* First, change the node's priority. */
entry.mPriority = priority;
/* If the node no longer has a higher priority than its parent, cut it.
* Note that this also means that if we try to run a delete operation
*... | 3 |
public static void writeImage(BufferedImage image, String fileName) throws IOException
{
if (fileName == null) return;
int offset = fileName.lastIndexOf( "." );
if (offset == -1)
{
String message = "file suffix was not specified";
throw new IOException( message );
}
String type = fileName.substrin... | 3 |
public static double[] scale( double fac, double[] vector )
{
int n = vector.length;
double[] res = new double[n];
for ( int i = 0; i < n; ++i )
res[i] = fac * vector[i];
return(res);
} | 1 |
public ListNode rotateRight(ListNode head, int n) {
if (head == null)
return null;
int size = 1;
ListNode tail = head;
while (tail.next != null) {
tail = tail.next;
size++;
}
n = n % size;
if (n == 0)
return head;
... | 4 |
public static int search(int[] A, int target){
if(A.length == 0){
return -1;
}
int l = 0;
int r = A.length-1;
while(l<=r){
int mid = (l+r)/2;
if(A[mid] == target){
return mid;
}
//the A[l..mid] is sorted,... | 9 |
public void setPrevCell(ProcessedCell c){
prevCell = c;
if(c != null && c.getNextCell() != this){
c.setNextCell(this);
}
} | 2 |
public void UserAvgStarDist() {
int totalUserCnt = 0;
Map<Double, Integer> UserAvgStarMap = new TreeMap<Double, Integer>();
for (User user:userMap.values()) {
//System.out.println("hello");
double score = roundScore(user.average_stars);
totalUserCnt += 1;
if (!UserAvgStarMap.containsKey(score)) {
... | 4 |
public boolean isSpeelveldKlaar(){ //kijkt of het speelveld klaar is om in te spelen
if( obstructie == null
|| schutterAPositie == null
|| schutterAZone == null
|| schutterBPositie == null
|| schutterBZone == null
|| wind == null
... | 8 |
public void pulse() {
if (cnt == 100/MAIN_TIMER_TICK_RATE) {
cnt = 0;
if (enlarging) {
tmp++;
enlarge();
} else {
tmp--;
shrink();
}
correctSize();
if (tmp == 0) {
... | 4 |
private static void writeIntoFile(String fileName) throws IOException {
BufferedWriter bw = null;
try {
File f = new File(fileName);
bw = new BufferedWriter(new FileWriter(f));
for(String s : GenerateForSpim.getCommandMap().get(GenerateForSpim.DEFAULT_METHOD)) {
bw.write(s);
bw.newLine();
}
... | 5 |
@Override
public void move(Excel start, Excel finish) {
if (start.getX() == begin.getX() && start.getY() == begin.getY())
{
begin = finish;
setColoredExes();
}
if (start.getX() == end.getX() && start.getY() == end.getY())
{
end = finish;
setColoredExes();
}
} | 4 |
public int getDiameter()
{
switch(getPlacementRank())
{
case DEFINITIVE:
return DEFINITIVE_SIZE;
case EXPECTANT:
return EXPECTANT_SIZE;
case LATENT:
return LATENT_SIZE;
case UNDEFINED:
... | 4 |
public static List<Tile> familarTile(IClientContext ctx) {
final Tile location = ctx.players.local().tile();
List<Tile> tiles = new ArrayList<Tile>();
LogicailArea area = new LogicailArea(location.derive(-7, -7), location.derive(5, 5));
boolean edgeville = false;
if (LocationAttribute.EDGEVILLE.isInLargeAre... | 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.