text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public String log(Iterable<LogItem> items) throws Exception
{
for (BarItem item : this.items.values())
item.price = item.quantity = 0;
for (LogItem item : items)
{
BarItem currentItem = this.items.get(item.barID);
if (currentItem == null)
throw new Exception("Item not found (ID=" + item.b... | 6 |
public void save() {
try {
this.yml.save(configFile);
} catch (Exception e) {
System.out.println("[BurningCS] Could not save config file!");
e.printStackTrace();
}
} | 1 |
protected boolean out_grouping_b(char [] s, int min, int max)
{
if (cursor <= limit_backward) return false;
char ch = current.charAt(cursor - 1);
if (ch > max || ch < min) {
cursor--;
return true;
}
ch -= min;
if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) {
cursor--;
return true;
}
return... | 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 JSONObject addCategoryAction(String UserID, String action, String ImageId, String TargetId, String targetValue)
{
try {
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,USER,PASS);
stmt=conn.createStatement();
json=new JSONObject();
String SQL="inse... | 5 |
public void loadTeleporters() {
YamlConfiguration config = YamlConfiguration.loadConfiguration(teleportersFile);
for (String teleporterName : config.getKeys(false)) {
ConfigurationSection teleporterSection = config.getConfigurationSection(teleporterName);
Teleporter teleporter = this.createTeleporter(teleport... | 4 |
public void setTotalPoints(int total){
totalPoints.setText(Integer.toString(total));
} | 0 |
public List<String> getValues() {
System.out.println("count cells in row: " + cells.size());
List<String> values = new ArrayList<String>();
for (TableCell cell : cells) {
String text = cell.getText();
values.add(text);
System.out.println(text);
}
return values;
} | 1 |
public static boolean escribir(Map<String,Producto> array){
try{
BufferedWriter escribe=Files.newBufferedWriter(path,
java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.TRUNCATE_EXISTING);
Iterator it=array.entrySet().iterator();
while(it.hasNext()){
Map.Entry... | 3 |
public CharacterIcons(String getCharacter)
{
if (getCharacter.equals("White"))
setImage(new GreenfootImage("CharacterIcons//FuShu.png"));
else if (getCharacter.equals("Bond"))
setImage(new GreenfootImage("CharacterIcons//JamesBond.png"));
else if (getCharacter.equals("Ninja")... | 5 |
public static void insertSubnet(Subnet sub, SubnetData d){
SubnetData data;
if (sub!=null) //call from the Rest Interface
data = sub.getSubnet();
else //call from createMultiple
data=d;
//Recover the subnet object (from the Rest Interface) attributes
String name = data.getName();
String n = ... | 3 |
public void visitInnerClass(final String aname, final String outerName,
final String innerName, final int attr_access) {
if ((name != null) && name.equals(aname)) {
this.access = attr_access;
}
super.visitInnerClass(aname, outerName, innerName, attr_access);
} | 2 |
public User convertTxtFileToUserObjSixMonthData(String basePath, String directoryName, String fileName, String extension) throws FileNotFoundException, IOException {
String userPostAsString = readTxtFileAsString(basePath, directoryName, fileName, extension);
String temp[];
User user = new User()... | 6 |
public byte evaluate() {
if(!type.hasLiteral()) {
return type.getCode();
} else {
assert(data.checkResolved());
if(hasNextWord()) {
return type.getCode();
} else {
assert(type == ValueType.LITERAL);
return (b... | 2 |
protected PathTraceMaterial nodeIsHomogeneous( SolidNode sn ) throws DereferenceException {
if( sn.getType() == SolidNode.Type.HOMOGENEOUS ) return sn.getHomogeneousMaterial();
if( sn.getType() == SolidNode.Type.DENSITY_FUNCTION_SUBDIVIDED ) return null; // lets ignore this possibility for now
Object o = no... | 5 |
private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... | 8 |
public int observe(int bytes)
{
if (observer != null && bytes != -1)
{
totalBytes += bytes;
observer.bytesRead(totalBytes, clientId);
}
log.debug("Total Bytes Read = [" + totalBytes + "]");
return bytes;
} | 2 |
public String toString(){
return "LU: " + ul.toString() + ", " + width + " x " + height;
} | 0 |
@Override
public void fuse(Property property) throws PropertyException
{
if(property != null) {
if(property.getClass().equals(getClass())) {
MinMaxProperty prop = (MinMaxProperty) property;
int newMin;
if(min != UNDEFINED) {
if(prop.getMin() != UNDEFINED) {
newMin = Math.max(min, prop.getM... | 7 |
public void addVersions( BitSet bs )
{
this.versions.or( bs );
for ( int i=0;i<cells.size();i++ )
{
FragList fl = cells.get(i);
for ( int j=0;j<fl.fragments.size();j++ )
{
Atom a = fl.fragments.get(j);
if ( a instanceof Frag... | 4 |
@Override
public void run() {
BufferedReader in = null;
PrintWriter out = null;
try {
in = new BufferedReader(new InputStreamReader(
this.socket.getInputStream()));
out = new PrintWriter(this.socket.getOutputStream(), true);
String currentTime = null;
String body = null;
while (true) {
bo... | 9 |
public int getMaxSum() {
maxSum = Integer.MIN_VALUE;
for (int rowStart = 0; rowStart < width; rowStart++) {
for (int colStart = 0; colStart < width; colStart++) {
for (int rowEnd = 0; rowEnd < width; rowEnd++) {
for (int colEnd = 0; colEnd < width; colEnd++) {
int sum = 0;
for (int row = r... | 7 |
public boolean isMoveable(String str)
{
for (Artifacts a : artList)
{
if(a.name.toUpperCase().equals(str)){
if (a.movability == 1)
{
return true;
}
return false;
}
}
for (Keys ... | 9 |
@Override
public boolean equals(Object obj) {
if (!obj.getClass().equals(Genotype.class))
return false;
Genotype other = (Genotype) obj;
if (this.generation != other.generation)
return false;
if (this.hiddenLayersCount != other.hiddenLayersCount)
return false;
// if (this.genes.equals(other.genes)) ... | 6 |
private void RegisterPlayer(Player player) {
if (_currentPhase.equals(Phase.Registration)) {
if (_registeredPlayers.contains(player)) {
player.sendMessage("You have already registered for the games.");
} else if (_registeredPlayers.size() < _maxRegistrations) {
_registeredPlayers.add(player);
player... | 3 |
public boolean MovingBoxIntoBox(int x, int y){
if(map[y][x] != box){
return false;
}
//move box south
if(y_loc+1 == y){
if(map[y+1][x] == box)System.out.println("box in the way"); return true;
}
//move box north
if(y_loc-1 == y){
if(map[y-1][x] == box)System.out.println("box in the way"); r... | 9 |
public static List<Mixer> getCompatibleMixers(Class<? extends Line> pLineClass) {
Line.Info lineInfo = new Line.Info( pLineClass );
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
List<Mixer> ret = new ArrayList<>();
for ( Mixer.Info info : mixerInfo ) {
Mixer current = AudioSystem.getMixer( info );
... | 3 |
public void drawShakingText(String text, int x, int y, int colour,
int elapsed, int tick) {
if (text == null)
return;
/*
* Calculate the current amplitude of the
* shake based on how long the text has been
* shaking for.
*/
double amplitude = 7D - elapsed / 8D;
if (amplitude < 0.0D)
ampl... | 4 |
public void destroyBody(Body body) {
assert (m_bodyCount > 0);
assert (isLocked() == false);
if (isLocked()) {
return;
}
// Delete the attached joints.
JointEdge je = body.m_jointList;
while (je != null) {
JointEdge je0 = je;
je = je.next;
if (m_destructionListener != null) {
m_destruct... | 9 |
DccManager(PircBot bot) {
_bot = bot;
} | 0 |
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if (l1 == null) {
return l2;
}
if (l2 == null) {
return l1;
}
ListNode resultListNode = new ListNode(0);
ListNode temp = new ListNode(0);
resultListNode = temp;
while (l1 != ... | 9 |
private boolean resquestIsLegal(String challenge, String validate, String seccode) {
if (objIsEmpty(challenge)) {
return false;
}
if (objIsEmpty(validate)) {
return false;
}
if (objIsEmpty(seccode)) {
return false;
}
return true;
} | 3 |
public float getH() {
return h;
} | 0 |
private void setUpgrade(Upgrade upgrade, BodyPart bodyPart){
bodyPart.addUpgrade(upgrade);
upgrade.setUsed(true);
} | 0 |
public static ArrayList<Tile> getTileNeighbors(Tile t, Tile[][] tiles, int size){
ArrayList<Tile> neighbors = new ArrayList<>();
int xStartIndex = t.getX() - 1 < 0 ? 0 : -1;
int xEndIndex = t.getX() + 1 >= size ? 0 : 1;
int yStartIndex = t.getY() - 1 < 0 ? 0 : -1;
int yEndIndex = t.getY() + 1 >= size? 0 : 1;... | 8 |
private static int rank_iterative(int[] N, int key) {
int lo = 0;
int hi = N.length - 1;
while (lo <= hi) {
int mid = findMidpoint(hi, lo); // find the midpoint
if (key < N[mid]) { // the key is in the lower half so lower the upper bound
hi = --mid;
} else if (key > N[mid]) { // the key is in t... | 3 |
boolean deleteDirectory(File dir) {
if (dir.exists()) {
if (dir.isDirectory()) {
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
deleteDirectory(file);
}
else {
file.delete();
}
}
}
return dir.delete();
}
else
return false;
} | 4 |
static public Date toDate(String date, String time) {
Date retVal = new Date();
if (date != null) {
Date d = parseDate(date);
Integer s = null;
if (time != null)
s = secPastMid(time);
if (s == null || s < 0)
s = secPastMid(... | 9 |
public IRouteResult route(GenericNode from, GenericNode to) {
// ways est une file qui contiendra tous les chemins possibles tandis que way est une pile qui contiendra un de ces mêmes chemins
PriorityQueue ways = new PriorityQueue();
Stack way = new Stack();
// On y met le premier maillon
way.push(new Element(... | 4 |
private void mergeFiles() throws FileNotFoundException {
try (OutputStream outStream = new FileOutputStream(
"monthlyDataFile.txt");
SequenceInputStream inputStream = new SequenceInputStream(
fileStreams.elements());) {
byte[] buffer = new byte[4096];
int numberRead = 0;
while ((numberRead = in... | 2 |
public InetAddress discoverHost (int udpPort, int timeoutMillis) {
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket();
try {
socket.receive(packet)... | 6 |
public void writeCBytesA(int len, byte buf[], int off) { // method441
for (int i = (len + off) - 1; i >= len; i--) {
payload[offset++] = (byte) (buf[i] + 128);
}
} | 1 |
private static void showTrainingOptionsAndTrain( ) throws NumberFormatException, IOException {
Restaurant restaurant = player.getRestaurant();
System.out.println("\tTrain worker:");
Chef chef = restaurant.getChef();
System.out.println("\t" + "1. Chef: " + chef.getName() + " " + chef.getSurname() + "\t\tEx... | 9 |
public boolean showConfirmationDialog()
{
String name = answerSideManager.getAnswersName();
if (name != null && !name.equals(""))
messageLabel.setText(name + ", правильно?");
else
messageLabel.setText("Правильно?");
showDialog();
return isCorrect;
... | 2 |
private void trimText() {
if(textLimit > 0 && text.length() > textLimit) {
text = text.substring(0, textLimit);
resize();
}
} | 2 |
public static void main(String[] args) throws IOException {
InputStream in = System.in;
OutputStream out = System.out;
ConChMode mode = ConChMode.UNSET;
byte[] source = ConCh.Sigma94;
byte[] codeabet = ConCh.C94;
for (int index = 0; inde... | 9 |
AudioFormat createAudioFormat(int channels, long sampleRate) {
switch(format) {
case SoundFileType.FORMAT_PCM_S8:
case SoundFileType.FORMAT_PCM_U8:
return AudioFormats.pcm().channels(channels).rate(sampleRate).bitDepth(8);
case SoundFileType.FORMAT_PCM_16:
return AudioFormats.pcm().channels(channels).rate... | 9 |
public boolean attachPrevious(Linkable paramLinkable)
{
boolean b=false;
if ((paramLinkable instanceof InstructionList))
{
InstructionList localInstructionList = (InstructionList)paramLinkable;
if (localInstructionList.getNextInstruction() == null)
{
localInstructionList.setNext... | 3 |
@Override
public void onToggle(Key key, boolean pressed) {
InputHandler input = InputHandler.getInstance();
if (pressed) {
if (key == input.up)
selectionUp();
if (key == input.down)
selectionDown();
if (key == input.enter)
... | 4 |
@Override
public final String toString(String f) {
StringBuilder buffer = new StringBuilder();
if (field == null || !field.equals(f)) {
buffer.append(field);
buffer.append(":");
}
buffer.append("\"");
int lastPos = -1;
for (int i = 0 ; i < termArrays.length ; ++i) {
Term[] ... | 9 |
public void addCommand(Command command){
List<Command> previousCommands = new ArrayList<Command>();
if(command.isSameCommand()){
commands.get(commands.size()-1).copyCommand(command);
}
for(Command com: commands){
if(command.compareCommandTo(com)==1){
previousCommands.add(com);
}
}
commands.remo... | 3 |
@Override
public void setTmp(String value) {
this.tmp = convertToHashMap(value);
} | 0 |
private void updateCustomComponent()
{
resetFields();
actionListPanel.removeAll();
actionListPanel.add(actionComponents.get(rtsItem + actionListKeyword).get(0), BorderLayout.NORTH);
actionListPanel.revalidate();
actionListPanel.repaint();
customPanel.removeAl... | 3 |
public static void main (String[] args) throws IOException {
int customPort = 0;
int customWorkersNum = 0;
try {
if (args.length != 0) {
customPort = Integer.parseInt(args[0]);
customWorkersNum = Integer.parseInt(args[1]);
}
}
... | 8 |
private boolean jj_3R_49()
{
if (jj_scan_token(LEFTB)) return true;
if (jj_3R_9()) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(RIGHTB)) return true;
return false;
} | 4 |
private void createRoutes(boolean heuristic)
{
fromNode.setDistTo(0);
if (heuristic)
{
fromNode.setHeuristic(Math.sqrt(Math.pow((toNode.getxCoord() - fromNode.getxCoord()), 2) + Math.pow(toNode.getyCoord() - fromNode.getyCoord(), 2)) / 1000);
} else
{
fromNode.setHeuristic(Math.sqrt(Math.pow((toNode.ge... | 6 |
@Override
public void calcMove(int delta) {
double currentTime = System.currentTimeMillis();
this.delta = delta;
if (currentMove == MoveDir.MOVE_NULL) {
if (currentTime - lastMoveChange >= waitTime) {
lastMoveChange = currentTime;
randomMove();
}
} else {
edgeCheck();
if (currentTime - last... | 3 |
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 String executeDijkstra (String nodo) {
StringBuilder buffer = new StringBuilder();
final String origen = nodo;
int posicion = 0;
int costeTotal = 0;
// Se obtiene la posición donde se encuentra el nodo origen
for (int i=0; i<... | 5 |
private int buildZone(int x, int maxLength)
{
int t = random.nextInt(totalOdds);
int type = 0;
for (int i = 0; i < odds.length; i++)
{
if (odds[i] <= t)
{
type = i;
}
}
switch (type)
{
case ODDS_... | 7 |
@Override
public void unInvoke()
{
if(pathOut!=null)
{
if(currRoom==null)
currRoom=CMLib.map().getRandomRoom();
if(theGroup!=null)
for(int g=0;g<theGroup.size();g++)
{
final MOB M=theGroup.elementAt(g);
M.tell(L("You are told that it's safe and released."));
currRoom.bringMobHere(M,fal... | 8 |
public Builder name(String receivedName) {
if (receivedName == null || receivedName.equals("")) {
log.warn("Wrong Name. receivedName ={}", name);
throw new IllegalArgumentException("Name must be not null. Received value =" + receivedName);
}
this.name ... | 2 |
public static void main(String[] args)
{
ObjectFoo foo1 = new ObjectFoo();
ObjectFoo foo2 = new ObjectFoo();
foo1.setFoo(new Boolean(false));
Boolean b = (Boolean)foo1.getFoo();
foo2.setFoo(new Integer(10));
Integer i = (Integer)foo2.getFoo();
ObjectFoo foo3 = new ObjectFoo();
foo3.setFoo(n... | 0 |
private boolean jj_3_67() {
if (jj_scan_token(GREATER)) return true;
return false;
} | 1 |
private void ordenar(){
int m = 0;
int j = 0;
for(int i = 0; i < individuos; ++i){
m = i;
for(j = i+1; j < individuos; ++j){
if(aptitud[j] < aptitud[m]){
m = j;
}
}
int tempAptitud = aptitud[i];
Cromos... | 3 |
public boolean deleteFile(String sPath) {
flag = false;
File file = new File(sPath);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
flag = true;
}
return flag;
} | 2 |
@Override
public boolean move(Player player, int[] position)
{
// Check if player is the currentPlayer
if (player != currentPlayer)
{
if (currentPlayer == null)
{
player.message("Game Over!");
}
else
{
... | 5 |
private void testr(String userTyped) {
errLvl = 0f;
if (userTyped.equals("Ping")) outputField.setText("Pong");
else errLvl = errLvl + 1f;
if (userTyped.equals("ping")) outputField.setText("Pong");
else errLvl = errLvl + 1f;
if (userTyped.equals("Pong")) outputField.setText("Ping");
else errLvl = err... | 5 |
public int generateDurability(int blockY) {
int durability = baseDurability_;
if (variance_ > 0) {
// variance_ is a max +- adjustment range to add to the durability
durability += Citadel.getRandom().nextInt() % (variance_ * 2 + 1);
durability -= variance_;
}
... | 5 |
private Integer negaScout(Board board, Color current, Integer depth, Integer alpha, Integer beta) {
if ( depth > 0 ) {
Integer best = beta;
for ( Move m : board.getPossibleMoves(current) ) {
board.apply(m);
Integer score = - negaScout(board, current.other(), depth - 1, -... | 6 |
public String execute() {
StringBuilder sb = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
if ("json".equalsIgnoreCase(type)) {
/*
[{
statusCode: 200,
method: 'GET',
url: 'http://foo.c... | 8 |
@Override
public AttributeValue getExampleAttributeValue(Example e) {
int playerToken = e.getResult().currentTurn;
int height = e.getBoard().height; // 6
int width = e.getBoard().width; // 7
int numTokensCountingFor = 3; // checking for 3 in a row
int countOfTokensEncounteredVertically = 0; // counter
/... | 8 |
public int[][] up(int grid[][]) {
score = 0;
for (int xIndex = 0; xIndex < 4; xIndex++) {
for (int yIndex = 3; yIndex > 0; yIndex--) {
if (grid[yIndex - 1][xIndex] == 0) {
for (int a = yIndex - 1; a < 3; a++) {
grid[a][xIndex] = gri... | 9 |
private void incrementTime()
{
second++;
if (second > 59)
{
second = 0;
minute++;
if (minute > 59)
{
minute = 0;
hour++;
if ((minute != 0 || second != 0) && hour > 23)
{
... | 7 |
@Override
public void onPluginMessageReceived( String channel, Player player, byte[] message ) {
DataInputStream in = new DataInputStream( new ByteArrayInputStream( message ) );
String task = null;
try {
task = in.readUTF();
} catch ( IOException e ) {
e.pri... | 4 |
protected Texture load(String ref) throws IOException {
if(ref.endsWith(".tga")) {
return TextureLoader.getTexture("TGA",
ResourceLoader.getResourceAsStream(System.getProperty("resources") + "/sprites/" + ref + ".tga"));
}
return TextureLoader.getTexture("PNG",
ResourceLoader.getResourceAsStream(Syste... | 1 |
@Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} | 1 |
public void run(TriplesInputStream stream) throws IOException {
while (true) {
Triple next = stream.nextTriple();
if (next == null) {
if (currentSubject != null) {
handleSubject(currentSubject, currentProps, currentLinks);
}
return;
}
String s = next.getSubject();
// Try to url-decod... | 8 |
public String getNombre() {
return nombre;
} | 0 |
public void enqueue(TypeValue val, int prio) {
QueueElement current = head;
while (current.getNext() != null && current.getNext().getPrio() < prio) {
current = current.getNext();
}
QueueElement tmp = new QueueElement(val, prio);
tmp.setNext(current.getNext());
... | 2 |
public void accept(final MethodVisitor mv) {
AbstractInsnNode insn = first;
while (insn != null) {
insn.accept(mv);
insn = insn.next;
}
} | 1 |
public int offset(int i) {
switch (npcs[i].npcType) {
case 50:
return 2;
case 2881:
case 2882:
return 1;
case 2745:
case 2743:
return 1;
case 8133:
return 3;
}
return 0;
} | 6 |
private void decoderChar(char c1,char c2,char[][] c) {
int t11;
int t12;
int t21;
int t22;
this.chercheTab(c, c1);
t11=this.i1;
t12=this.i2;
this.chercheTab(c, c2);
t21=this.i1;
t22=this.i2;
if(t11==t21) {
if(t12==0) {
this.t1=c[t11][4];
}
else{
this.t1=c[t11][(t12-1)%5];
}
... | 6 |
private void replyFile(String path) throws Exception
{
path = path.replace('/', File.separatorChar);
File file = new File(path);
if (!file.exists()) {
System.err.println("File \"" + path + "\" not found");
return;
}
System.err.println("File \"" + path + "\" found and sent");
// FileInputStream... | 1 |
public void checkProduction(Production production) {
if (!ProductionChecker.isRightLinear(production))
throw new IllegalArgumentException(
"The production is not right linear.");
} | 1 |
public FlowGraph(final MethodEditor method) {
this.method = method;
subroutines = new HashMap();
catchBlocks = new ArrayList(method.tryCatches().size());
handlers = new HashMap(method.tryCatches().size() * 2 + 1);
trace = new LinkedList();
srcBlock = newBlock();
iniBlock = newBlock();
snkBlock = newBl... | 3 |
public File getFile() {
JFileChooser fc = new JFileChooser();
int result = fc.showOpenDialog(new JFrame());
File sendfile;
if (result == JFileChooser.APPROVE_OPTION) {
sendfile = fc.getSelectedFile();
filename = sendfile.getAbsolutePath();
filesize = (int)sendfile.length();
jLabel1.setText("傳送檔案" + ... | 1 |
private int[] getArrayForHuffman() {
String resultDecompression = huffman.getResultDecompress();
char array[] = resultDecompression.toCharArray();
arrayForHuffman = new int[array.length];
int i = 0;
int temp = 0;
for (char symbol : array) {
temp = (int)symbol ... | 1 |
public double standardizedPersonRange(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.vari... | 4 |
public void compare() {
// could not find the new generated pdf document
if(pdfInfoHolder.getDifferent() == DifferenceType.MISSINGDOCUMENT)
{
missingDocument(pdfInfoHolder.getPDF1());
return;
}
PDFFile pdf1 = pdfInfoHolder.getPDF1();
PDFFile pdf2 = pdfInfoHold... | 3 |
@SuppressWarnings("unused")
public boolean outputToFile(String strDirectory, int[] objSave, String strFileName, String[] strStatistics) throws Exception {
try {
File fObjSave = new File(strDirectory);
String strSaved = "";
if(strStatistics != null) {
strSaved = "Statistics:\r\n";
strSaved += (strSta... | 4 |
public String readSQL() throws FileNotFoundException{
String resultSql = "";
System.out.println("[INFO]Begin to get SQL from ["+this.sqlFileName+"]");
FileReader fr;
try {
String sql = "";
fr = new FileReader(new File(sqlFolderPath+sqlFileName));
BufferedReader br = new BufferedReader(fr);
while((sq... | 5 |
public static double absVolumeError(double[] obs, double[] sim) {
sameArrayLen(obs, sim);
double volError = 0;
for (int i = 0; i < sim.length; i++) {
volError += sim[i] - obs[i];
}
return Math.abs(volError);
} | 1 |
private double average_efficient(String measure) {
int type = get_type(measure);
if (type == RATE_BASED) {
if (trans_time < 0.0) {
trans_time = 0.0;
}
if (end_time < 0.0) {
// Method called at run time
return ((double)((Long)data.get(measure)).longValue())/(Sim_system.s... | 6 |
private int[] alphaBetaPrunning(int depth, Board b, int alpha, int beta,String player, int bestRow, int bestCol, int score) {
if(cutoff(b, depth)) {
//need to get score and row and column of move
score = evaluate(b);
return new int[] {score, bestRow, bestCol };
}
//children = all valid moves ... | 8 |
static long function(long i, long j){
if(mem[(int)i][(int)j]>0)return mem[(int)i][(int)j];
if(i==n&&j==1)return an1;
if(i<j){
long max = 0;
for (long k = i; k < j; k++)
max = Math.max(max, function(i, k) + function(k+1, j));
return mem[(int)i][(int)j] = max;
}
else{
long num = 0, num1 = 0;
... | 9 |
public String getCiudad() {
return ciudad;
} | 0 |
public void InsertaFinal(int ElemInser)
{
if ( VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
NodosProcesos Aux = PrimerNodo;
while (Aux.siguiente != PrimerNodo)
Aux = Aux.siguiente;
NodosProcesos Nuevo=new NodosProces... | 2 |
public int checkExam(Exam originalExam, Exam answeredExam) {
assert (originalExam.getId().equals(answeredExam.getId()));
int correctAnswers = 0;
if (answeredExam.getQuestions() == null || answeredExam.getQuestions().isEmpty()) {
return correctAnswers;
}
Map<String,... | 5 |
@Test
public void runTestRegisterGlobal2() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_RegisterGlobal2.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size());
} | 0 |
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.