method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d1136f3f-d09c-4940-ac7e-8cf06aa2dc32 | 5 | @Override
public boolean wipeTable(String table) {
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error at Wipe Table: table, " + table + ", does not exist", true);
return false;
}... |
cf391f0a-4c69-42a2-b304-4da5691e9580 | 3 | @Override
public void onPlayerSwitch(ChunkyPlayerSwitchEvent event) {
try {
if (!Permissions.PLAYER_BUILD_ANYWHERE.hasPerm(event.getChunkyPlayer().getPlayer())) return;
} catch (ChunkyPlayerOfflineException e) {
return;
}
if (event.getAccessLevel().equals(Acce... |
edef309e-f8de-43d5-b619-9e5cf3ed0856 | 9 | private void loadParametersFromJackson(JsonParser jp,
CorefColumnDataset dataset) throws JsonParseException, IOException,
DatasetException {
if (jp.nextToken() != JsonToken.START_ARRAY)
throw new DatasetException("Error parsing parameters");
MapEncoding<Feature> explicitEncoding = dataset
.getExplicitF... |
fa547e23-c86e-4568-8050-f37753351f16 | 7 | private String keySegment(){
skipBlank();
// 略过双引号
char quato = source.charAt(position++);
for(; position < source.length(); position++){
char temp = source.charAt(position);
if(temp < 32) continue;
if(temp == '\\' && esacpe && position + 1 < source.length()){
c... |
d58ecaaa-5d1a-439d-bec1-ac26fbf358bb | 0 | public int getSequenceId() {
return this.sequence_Id;
} |
7d194232-b19a-4f6a-a1ce-03f563d0ad51 | 4 | private void readFile(File diffMapperFile) {
try {
BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile));
String[] title = reader.readLine().split("\t");
String line;
while((line = reader.readLine()) != null) {
String[] value = line.split("\t");
for(int i = 0; i < title.le... |
9b0b2a33-206a-4162-bc98-50cbcb8c4deb | 8 | boolean isCompoundDocument(InputStream is) throws Exception {
byte[] abMagic = new byte[8];
is.mark(9);
int countRead = is.read(abMagic, 0, 8);
is.reset();
return (countRead == 8 && abMagic[0] == (byte) 0xD0 && abMagic[1] == (byte) 0xCF && abMagic[2] == (byte) 0x11
&& abMagic[3] == (byte) 0xE0 && abMagic[... |
5ec4fc52-b8b3-46c1-8842-63621229b38f | 2 | public boolean hasNewData() {
return hasNewVertexData || hasNewTextureCoordsData || hasNewColorData;
} |
5e52756a-66df-4630-baf3-ca6a06dc5f00 | 6 | 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... |
c9e64f09-e55b-486c-a861-6a7b81a5caee | 4 | @Override
public void addWord(String word) {
Integer i = sample.get(word);
if (i == null) sample.put(word, 1);
else sample.put(word, 1 + i.intValue() );
if (sample.size() >= Math.ceil(2. / frequency)) {
Iterator<String> it = sample.keySet().iterator();
while (it.hasNext()) {
String str = i... |
f7a750db-ad4f-41d5-844c-a55ba40f99bd | 8 | protected String formatOutput(final String logService, final LogLevel l,
final String msg, final Throwable t)
{
final StringBuffer b = new StringBuffer(150);
final int yr;
final int mth;
final int day;
final int hr;
final int min;
final int sec;
final int ms;
synchronized (c) {
c.setTimeInMillis... |
61840fe5-bbff-4f9f-adff-9bbece63e2fd | 3 | public void update(String key){
synchronized(this.cache){
U fromCache;
SoftReference<U> ref;
if((ref = this.cache.get(key)) == null){
throw new IllegalArgumentException("key is not present");
}
fromCache = ref.get();
if(!(fromCache == null)){
ByteArrayOutputStream... |
b3533da5-fdd0-4e68-b239-7371827599bb | 2 | public void getBusyFlag() {
while (tryGetBusyFlag() == false) {
try {
Thread.sleep(100);
} catch (Exception e) {}
}
} |
bf4bd3e2-eb53-4e1b-9762-4693a673ad02 | 5 | protected boolean isMouseOnSelection(SELECTION selection) {
final float x = Mouse.getX();
final float y = Mouse.getY();
float loc;
float size;
if (selection.equals(SELECTION.YES)) {
loc = 0.55f;
size = 3.0f;
} else if (selection.equals(SELECTION.NO)) {
loc = 0.8f;
size = 2.0f;
} else {
retu... |
2bada34b-c3ab-4983-8cdb-39ad3809912e | 7 | public static void main(String[] args) {
int count = 0;
int dow = 0;
for (int year = 1900; year <= 2000; year++) {
for (int month = 1; month <= 12; month++) {
for (int day = 1; day <= days(month, year); day++) {
dow++;
if (dow ... |
f128bf06-315e-440e-94e1-23f77fe287b1 | 0 | public void setBonus(double b)
{
bonus = b;
} |
fa2486bd-4545-4788-a9fd-f9f91a640d5c | 7 | public void potentialStat(){
int[] noSize = new int[100];
double[] potentialPerSize = new double[100];
double minDensity = 2.0, maxDensity = -1.0;
double density = 0;
Arrays.fill(noSize, 0);
Arrays.fill(potentialPerSize, 0);
for (int id : answers.keySet()) {
... |
ea6dc334-2d1f-47c4-af05-64524b03c1ba | 7 | public boolean carregar() {
StringBuilder builder = new StringBuilder();
// todos os atributos
String[] atributosNome = getNomeDosAtributosDaSubClasse();
Object[] atributosValor = getValorDosAtributosDaSubClasse();
// atributos NAO NULOS
List<String> atributosNome_NotNull = new ArrayList<String>();
List... |
657680ef-6c2b-4113-bef0-e4e0ff7ac97a | 0 | public void setResource(List<String> resource) {
this.resource = resource;
} |
86882887-22c4-462b-bb42-e1799bba75ba | 0 | void loadTemplatesCircles()
{
Templates.addElement(loadTemplate("circle CCW", TemplateData.circlePointsCCW));
Templates.addElement(loadTemplate("circle CW", TemplateData.circlePointsCW));
} |
3c30ea67-58c9-4267-b545-f5c30d078e56 | 6 | private void checkValidHtmlPath() {
File path = new File(Config.getHtmlPath());
File logPath = new File(path.getAbsoluteFile() + DIR_LOG);
File htmlPath = new File(path.getAbsoluteFile() + DIR_HTML);
if ((!path.isDirectory() && !path.mkdirs())
|| (!logPath.isDirectory() && !logPath.mkdirs())
|| (!htmlP... |
5f95b21e-5e50-4bc0-8b67-dd0736a01eff | 9 | public static void clOutputAllUnitsToFile(String sourcefile) {
{ String outputfile = Stella.makeFileName(sourcefile, Stella.KWD_LISP, false);
OutputFileStream outputstream = OutputFileStream.newOutputFileStream(outputfile);
PrintableStringWriter writer = outputstream.nativeStream;
if (((Integer)(... |
73f601be-6d6c-4ac8-87de-fa5f79e4e1b2 | 0 | public String getPrice() {
return price;
} |
79558271-bba8-4fbe-bc22-f9f274fac977 | 2 | private void saveResults(String fname) {
java.util.Vector<TanqRanked> ranked = battleground.getRanking();
File fout = new File(fname);
PrintStream ps = null;
try {
ps = new PrintStream(fout);
for (int i=0; i<ranked.size(); i++)
ps.println(ranked.get(i).toString());
} catch (Throwable t) {
uk.ac.d... |
3de07993-54d6-41a4-be36-0bf57df5ec6e | 5 | private static MassSpecFileFormat detectFormat(String content) {
MassSpecFileFormat format = null;
if (MassSpecFileRegx.PRIDE_XML_PATTERN.matcher(content).find()) {
format = PRIDE;
} else if (MassSpecFileRegx.MZML_PATTERN.matcher(content).find()) {
format = MZML;
... |
52b07664-ad22-45e3-a826-f483052f72fd | 1 | public static void validateOrder(Order order) throws TechnicalException {
if ( ! isSeatsValid(order.getSeats())) {
throw new TechnicalException(SEATS_ERROR_MSG);
}
} |
f5326a8c-d8f0-4e42-88df-9ed68fd799f9 | 0 | public void setArmor(int armor) {this.armor = armor;} |
f9fa8308-a99d-443f-8bc1-13cccc3c48a4 | 1 | public void testGetPeriodConverterRemovedNull() {
try {
ConverterManager.getInstance().removePeriodConverter(NullConverter.INSTANCE);
try {
ConverterManager.getInstance().getPeriodConverter(null);
fail();
} catch (IllegalArgumentException ex) {... |
22fa2219-6132-4d9b-b409-2a9356065a04 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final BankDeposit other = (BankDeposit) obj;
if (!Objects.equals(this.name, other.name)) {
return f... |
d0e1c3fc-3677-4760-a600-af83c61d0cdb | 1 | public void updateTable() {
if(_table != null) {
_table.putNumber("Value", get());
}
} |
d1fdac80-e472-4847-b5c9-a26da220a35b | 1 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
if (e.getDocument() == null) {
setEnabled(false);
} else {
setEnabled(true);
}
} |
e03d5979-e2ab-4396-bf67-7bcd34b3d85a | 0 | protected Location getLocation()
{
return location;
} |
6f626bdd-fe1f-4627-98f3-6cb2acc2e2bb | 7 | public List<Double> getChances(List<List<Point>> sets) {
List<Integer> differences = new ArrayList<>();
List<Double> chances = new ArrayList<>();
double sumOfInverse = 0;
double bigEnoughNumber = 100.0;//in case of fully suitable set
for (int i = 0; i < sets.size(); i++) {
... |
ff66bc1a-ffb9-45eb-a4f9-9ade56732db4 | 8 | private void downloadImage(ImageReference site)
{
String pathSep = System.getProperty("file.separator");
File fileToWrite = new File(directory.toString()+pathSep+site.getFileName());
File rejectedFile = new File(directory.toString()+pathSep+"Rejected"+pathSep+site.getFileName());
... |
447c6e4d-d81b-46f9-ba46-d9b1e25adc24 | 5 | @Override
public void caseAFormallist(AFormallist node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(Formal");
inAFormallist(node);
if(node.getType() != null)
{
node.getType().apply(this);
}
if(node.get... |
e059eb7b-3d98-4d56-8e04-df37b66563a2 | 0 | @Test
public void drawButtonTest() {
view.getDrawButton().getActionListeners()[0].actionPerformed(actionEvent);
assertEquals(propertyName, MainWindowController.DRAW_BUTTON_CLICK);
} |
a29dde79-6418-4dd7-b9ae-c784777aba35 | 7 | */
public void addLabel(final Label label) {
// Add before a dup, but after any other instruction.
if (last != null) {
switch (last.opcodeClass()) {
case opcx_dup:
case opcx_dup2:
case opcx_dup_x1:
case opcx_dup2_x1:
case opcx_dup_x2:
case opcx_dup2_x2:
break;
default:
addInst(last,... |
e62d6650-ab1d-402c-88ef-86b318b057ff | 8 | public static void main(String[] args) {
UI ui = new TextUI();
World theWorld = new AugieDuckWorld();
Player thePlayer = new Player(theWorld.getStartLocation());
ui.display("Welcome to Simple Text Adventure! (Type 'q' to exit.)");
while (true) {
// display room description
Location currentLoc =... |
f6ed3d51-ad3e-48a1-af37-068534b6a6f8 | 1 | protected void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja cancelar?")== 0){
this.dispose();
}
}//GEN-LAST:event_btnCancelarActionPerformed |
37deab2c-9cad-4b6d-a215-79897be36ca9 | 7 | public int checkPuzzleAnswer(int radius, int height, int volumeLow, int volumeHigh) {
if (radius < 1 || radius > 8 || height < 1 || height > 1) {
return -1;
}
int volume = (int) Math.PI * ((int) Math.pow(radius, 2) * height);
if (volume >= volumeLow && volume <= volumeHigh... |
604f3267-64da-4001-90c8-39c095734258 | 9 | public static void floodfill(State state, boolean[][] map, int startX, int startY, boolean token)
{
/* Create stack to store nodes */
Stack<Position> nodes = new Stack<Position>();
/* Declare an positionobject to pop to from stack */
Position currentPosition = new Position(startX, st... |
74662681-6917-4ce4-8d4b-df6796f2d894 | 9 | @EventHandler
public void onCraftItem(PrepareItemCraftEvent event)
{
if (event.getView().getType().name().equals("WORKBENCH")) {
List<HumanEntity> vl = event.getViewers();
Player player = null;
for(Iterator<HumanEntity> iterator = vl.iterator(); iterator.hasNext();)
... |
f4983c85-592f-4752-a100-8148e9b2a561 | 8 | public static void main(String[] args) {
if (!validDirectory(args)) {
System.out.println(args[0]);
System.out
.println("The argument should be a directory of annotated lyric files.");
System.exit(1);
}
RCRhymeDictionary rhymeDict = new RCRhymeDictionary();
RCLyricMap lyricMap = new RCLyricMap();
... |
dd67ca3b-5a4c-4b45-85b1-b74ae2e30edb | 4 | public void ajouterModels(ArrayList<String> tab) {
for (PanneauModel p : models) {
jp.remove(p);
}
models.clear();
File file;
for (String lien : tab) {
file = new File(Parametre.workspace + "/" + lien);
if (file.isFile()) {
models.add(new PanneauModel("model/" + file.getName(), e));
}
}
fo... |
de4c4d58-38d4-41b5-a526-6654ccda1f6e | 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;
}
... |
541bf89a-5788-4f73-9396-83f65e372ecc | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
837a3bc2-3851-452d-982d-a45d047a9ff4 | 8 | @Override
void move()
{
this.Position.add(this.Velocity);
this.Velocity.mult(0.975f);
if((this.Velocity.X() < 0.1f && this.Velocity.X() > 0f) || (this.Velocity.X() > -0.1f && this.Velocity.X() < 0f))
this.Velocity.X(0f);
if((this.Velocity.Y() < 0.1f && this.Velocity.Y... |
654a16d2-bbf1-48c0-a4ae-4a5a79bd777a | 1 | public void reduce(Text key, Iterable<Text> values,
Context context) throws IOException, InterruptedException {
String value = "";
for (Text val : values) {
value = value + " " + val.toString();
}
result.set(value);
context.write(key, result);
} |
f87da8bc-6a52-4f2a-b942-e534d4aa0a12 | 7 | private void readSeqLineP(PushbackReader in, int s, int pos, int maxPos) throws IOException {
if (pos == 0) {
seqIDs.set(s,readLabel(in, 10));
}
if (s == 0) {
String thisLine = readLine(in, false);
if (thisLine.length() > maxPos ... |
9b73e400-dc91-4096-a53e-1cd554f8858d | 4 | public Command getCommand()
{
String inputLine; // will hold the full input line
String word1 = null;
String word2 = null;
System.out.print("> "); // print prompt
inputLine = reader.nextLine();
// Find up to two words on the line.
Scanner tokenizer =... |
b5e9767a-aff8-47c1-bea9-6f7f80cf9094 | 8 | public static Stella_Object lookupObjectFromSpecification(Stella_Object specification) {
{ Stella_Object renamed_Object = null;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(specification);
if (Surrogate.subtypeOfSurrogateP(testValue000)) {
{ Surrogate specification000 = ((Surro... |
6190e2ab-4d3f-41a8-9d4b-a7f69c034428 | 9 | public void check() {
super.check();
checkHasKeys( new String[] { STATUS_KEY, } );
String status = getStatus();
if ( OK_STATUS.equals( status ) || WARNING_STATUS.equals( status ) ) {
if ( ! containsKey( RESULT_KEY ) ) {
throw new DataException( STATUS_KEY + "=... |
bf2a9d12-1a13-42d7-9621-3cd9fabf689f | 9 | private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0, 0L);
return 4;
}
switch(curChar)
{
ca... |
bcbb2857-2928-462d-95a9-0648ea59e767 | 2 | public void remove(Element element) {
elements.remove(element);
fireElementRemoved(element);
if (element instanceof Obstacle) {
obstacles.remove(element);
fireObstacleRemoved((Obstacle) element);
}
if (element instanceof AccessPoint) {
aps.remo... |
617986eb-cc0c-4941-b943-87195677108f | 7 | private static void test9() throws FileNotFoundException {
//Test losing by exiting the cell and being spotted
String input = "new\n" + "pick up key\n" + "wait\n"
+ "unlock door with key\n" + "wait\n" + "go through cell door\n" + "quit\n" + "y\n";
HashMap<Integer, String> output = new HashMap<Integer, String... |
4d07b54a-8c8c-4f69-9756-7ba88b054b1c | 1 | private static void encodeRLE(RunLengthEncoding rle, ObjectOutputStream os)
throws IOException {
os.writeInt(rle.getWidth());
os.writeInt(rle.getHeight());
ArrayList<int[]> runs = rleToList(rle);
os.writeInt(runs.size());
for (int[] run : runs)
os.writeObject(run);
} |
c318e350-bdeb-48f5-893a-cde5b726f7d4 | 6 | *
*/
public Set<String> process(int phase){
//TODO:Use reflection on name
String name="";
switch(phase){
case 1:
name="historical";
System.out.println("Processing Hisorical data");
data.put("roomsandcourses", associateFieldAndRooms(getSpreadsheet(name),1));
((Map<String,ArrayList<String>>)data.g... |
0de6ce83-2b89-4e9d-b661-a8c739ec14c4 | 2 | public EmpresaBean loadId(EmpresaBean oEmpresa) throws NumberFormatException {
try {
if (request.getParameter("id") != null) {
oEmpresa.setId(Integer.parseInt(request.getParameter("id")));
} else {
oEmpresa.setId(0);
}
} catch (NumberFo... |
84f0a1da-39bb-4eaf-a645-63a12197993f | 8 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == UP_KEY)
up = true;
else if (e.getKeyCode() == DOWN_KEY)
down = true;
else if (e.getKeyCode() == LEFT_KEY)
left = true;
else if (e.getKeyCode() == RIGHT_KEY)
right = true;
else if (e.getKeyCode() == CHANGE_PLAYER_KEY) {
room.... |
4239bcd1-410e-4f9e-8ef3-23a713c5ed67 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
861b6a86-7da3-4d06-bfd2-439c3cb9b309 | 2 | public StructuredBlock getNextBlock(StructuredBlock subBlock) {
for (int i = 0; i < caseBlocks.length - 1; i++) {
if (subBlock == caseBlocks[i]) {
return caseBlocks[i + 1];
}
}
return getNextBlock();
} |
37fda005-23f4-410b-90e1-74c0d91c1af7 | 8 | public static void main(String[] args) throws Throwable {
hash = new HashMap<String, Integer>();
hash.put("B", 1);
hash.put("F", 1);
hash.put("P", 1);
hash.put("V", 1);
hash.put("C", 2);
hash.put("G", 2);
hash.put("J", 2);
hash.put("K", 2);
hash.put("Q", 2);
hash.put("S", 2);
hash.put("X", 2);
... |
89f21325-fbd3-40d4-9e36-45a20526a6f7 | 7 | private boolean isTagChar(int ch)
{
return (ch >= 'a' && ch <= 'z' ||
ch >= 'A' && ch <= 'Z' ||
ch >= '0' && ch <= '9' ||
ch == ':' || ch == '-');
} |
c1a390a1-fcb5-490f-9eb1-d586a81b113c | 4 | @Override
public BinaryNodePS<T> addRightChild(Node<T> parent, T info) {
if (!(parent instanceof BinaryNodePS)) {
throw new DifferentNodeTypesException();
} else if (isSafe() && !contains(parent)) {
throw new NodeNotFoundException();
}
BinaryNodePS<T> bn = (BinaryNodePS<T>) parent;
if (bn.getRight() !=... |
3446a5be-1e32-401e-9b6e-0d8cfd7d203d | 8 | private boolean deleteNativeLibrary() {
if (file == null) {
return true;
}
if (file.delete()) {
return true;
}
// Reach into the bowels of ClassLoader to force the native
// library to unload
try {
... |
3a5b72fc-227f-47bf-84d9-2570496d4ea8 | 1 | public static void main(String[] args) {
System.out.println("Введіть n --> ");
Scanner in = new Scanner (System.in);
int n = in.nextInt();
double pi = 0;
double m = 0;
for (int i=0; i<n; i++){
pi = pi + Math.pow(-1,i) * (1/(1+m));
m += 2;
}
pi = pi * 4;
System.out.println(pi);
} |
d1adde0d-2659-4b9e-8d60-c95e0d7e6423 | 7 | public void setOptions(String[] options) throws Exception {
m_bGenerateNet = Utils.getFlag('B', options);
String sNrOfNodes = Utils.getOption('N', options);
if (sNrOfNodes.length() != 0) {
setNrOfNodes(Integer.parseInt(sNrOfNodes));
} else {
setNrOfNodes(10);
}
String sNrOfArcs = Utils.getOption('... |
37d72302-3783-4c72-971c-4a232845a185 | 0 | @Override
public void componentResized(ComponentEvent e) {
Outliner.jsp.getHorizontalScrollBar().revalidate();
Outliner.jsp.getVerticalScrollBar().revalidate();
} |
dd061819-5caa-431a-bbde-a9304d0ea8ad | 8 | private void loadTemplateFile() throws CompilationExecutionException {
String text;
BufferedReader rd=null;
FileReader fr=null;
String lf=System.getProperty("line.separator");
String templateName;
if (doGetCrossCompilingDirectory().endsWith(File.sep... |
bb889ded-12d7-4d33-bf4a-8ea1694e9ff6 | 4 | public static void UpperFunction(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement st... |
4eef8b64-891c-4d21-bb61-ed0d900cca3d | 3 | public static Position startPosition() {
int x;
int y;
System.out.println("finding start");
boolean start = false;
do {
x = (int) (Math.random() * size);
y = (int) (Math.random() * size);
if ((MapArray[y][x].getType() == 'G')
&& (MapArray[y][x].getVisibility() == false)) {
start = true;
... |
7a6effc8-4cc8-4bfe-b7b2-98b899cf3f9d | 7 | public static char valueToBase64(byte value)
{
if (0 <= value && value < 26)
return (char) ('a'+value);
if (26 <= value && value < 52)
return (char) ('A'+value-26);
if (52 <= value && value < 62)
return (char) ('0'+value-52);
if (value == 62)
return '?';
return '!';
} |
4c6f975a-3bca-4ce1-bc25-484a70ecde72 | 3 | public void saveInventories()
{
if (player.isOnline())
{
Bukkit.getPlayer(player.getName()).saveData();
}
CompoundTag tag = load();
if (tag != null)
{
exportInventory(tag);
exportEnderchest(tag);
save(tag);
}
if (player.isOnline())
{
Bukkit.getPlayer(player.getName()).load... |
0b87b3b9-3d58-4032-9195-da14c791810e | 6 | public ByteOrderMark getBOM() throws IOException {
if (firstBytes == null) {
fbLength = 0;
// BOMs are sorted from longest to shortest
final int maxBomSize = boms.get(0).length();
firstBytes = new int[maxBomSize];
// Read first maxBomSize bytes
... |
da9ea267-cadb-4e32-b520-8ba74aef03ae | 7 | @Override
public void run() {
while(!this.stopped) {
if(this.lastBeat < this.now() - 15000d / (double)this.bpm) {
this.lastBeat = this.now();
this.pos = (this.pos + 1) % this.width;
if(this.gridPanel != null)
gr... |
ec1b61ef-9dd1-4381-a6d0-9b2db9085e91 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
9b2eadbc-a7cd-4f55-ad2f-a6dbd9669ab5 | 5 | @Override
public void run() {
if (TroveUtils.getTroveInstallLocation() == null) {
TroveModLoader.getTroveModLoaderGUI().disableButtons(false);
}
boolean isTroveRunning = TroveUtils.isProcessRunning("Trove.exe");
TroveModLoader.getTroveModLoaderGUI... |
2a7b89d9-1a75-45d1-868a-3c7a9b86bf8f | 7 | public boolean moveWest(int w)
{
boolean moved = false;
if(isFighting==false && isConcious() && getEnergy()>0)
{
if(w==3 || w==4)
{
setX(getX()-1);
moved = true;
}
else if(w>=10)
{
updateLoc... |
1588afbf-27bd-4992-aaad-2e4e7cea6f05 | 1 | private boolean jj_2_24(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_24(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(23, xla); }
} |
62724b9c-d9a5-467c-94b0-fd778667113d | 3 | public void retrieve() {
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
if (this.id == null) {
this.userBE = this.example;
} else {
this.userBE = userSerivce.findUser(id);
if (userBE == null) {
userBE = new UserBE();
example = new UserBE();
}
}
} |
e9dbad74-f0d3-4b00-a1d7-dddf8aaa6c6b | 0 | @Override
public int getColumnCount() {
return 5;
} |
01ee1fb8-6f9c-4cb7-bf20-ffa4d811cb0b | 7 | @SuppressWarnings("ResultOfMethodCallIgnored")
public static File unArchiveTarGZFile(final File archiveFile, File outputDir) throws IOException {
InputStream inputStream = null;
OutputStream fileOutputStream;
TarInputStream tarInputStream = null;
outputDir=SystemUtil.createASubDirFr... |
25dd8fba-6022-477f-9e51-b23250749572 | 7 | public double getNDCG(ResultList trueResultList, Result predictResult) {
Result trueResult = new Result();
for (String query : trueResultList.resultMap.keySet()) {
if (predictResult.query.equals(query)) {
trueResult = trueResultList.resultMap.get(query);
break;
}
}
double dcg = 0;
int index =... |
63532a75-a6b8-4705-bde5-4294f5a39f23 | 3 | private double testArrayDequeEnqueue(int inserts) {
System.out.println("Testing arrayDeque with " + inserts + " pushes");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
deque = new ArrayDeque();
startTime = Syst... |
fa4708c0-b73f-4e46-a1fe-ed616cc430b2 | 3 | @Override
public AbstractFile getFile(String path) throws IOException {
path = path.replace(File.separator, "/");
if (url.endsWith("/")) {
if (path.startsWith("/")) {
return new HttpRemoteFile(url + path.substring(1));
} else {
return new HttpR... |
8dac3e70-b0b3-4d40-8518-ed09cb1685c8 | 9 | final public ASTRecipient Recipient() throws ParseException {
/*@bgen(jjtree) Recipient */
ASTRecipient jjtn000 = new ASTRecipient(JJTRECIPIENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
PluginExp();
jjtree.closeNodeScope(jjtn000, true);
j... |
bf61b397-c146-4965-8138-18a62863b255 | 4 | @Override
public String getAsString(FacesContext contexto, UIComponent componente, Object valor) {
if (valor != null && ! "".equals(valor)) {
Secao entidade = (Secao) valor;
if (entidade.getId() != null) {
this.addAttribute(componente, entidade);
i... |
59c532b3-544f-4d75-8745-f50615b64e51 | 5 | private boolean isIncluded(String _host){
int i=0;
String hosts=this.host;
int hostslen=hosts.length();
int hostlen=_host.length();
int j;
while(i<hostslen){
j=hosts.indexOf(',', i);
if(j==-1){
if(hostlen!=hostslen-i) return false;
return hosts.regionMatches(true, i, _... |
6c4fa8c1-4e9d-451e-a2c7-c475f870260c | 5 | public boolean CheckBlock(SpoutBlock block) {
if (block.isEmpty() | block.isLiquid() | block.getType() == Material.AIR) {
return false;
}
if (block.getCustomBlock() == Transmitter_Block_on
| block.getCustomBlock() == Transmitter_Block_off
| block.getCustomBlock() == Reciever_Block_on
| block.ge... |
a02d0987-51fe-43f8-a4a7-bad9b9abdd2c | 7 | public static BaseMsg getMsgFromDoc(Document doc) throws Exception {
String toUserName = getTagValue("ToUserName", doc);
String fromUserName = getTagValue("FromUserName", doc);
String rawCreateTime = getTagValue("CreateTime", doc);
long createTime = Long.parseLong(rawCreateTime);
String msgType = getTagValu... |
1b37426c-2fc1-451c-857d-9839445f3079 | 8 | @Override
public void paintComponent( Graphics gg ) {
if( labelTable != null && labelHeight == -1 ) {
//FIXME: labelTable only works for vertical sliders ATM
labelHeight = 0;
for( Integer i : labelTable.keySet() ) {
JComponent c = labelTable.get(i);
int x = getPos( i.intValue() ... |
3ef759fd-7cc5-4415-82bf-f9e41661f36b | 1 | public static void printClock(String string, int l) {
if (check(l)) {
toTerminal(getTime() + " " + string, l);
}
} |
f87a6838-ece4-4f9a-bd73-0d799f70a167 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DSAKeyValue")
public JAXBElement<DSAKeyValueType> createDSAKeyValue(DSAKeyValueType value) {
return new JAXBElement<DSAKeyValueType>(_DSAKeyValue_QNAME, DSAKeyValueType.class, null, value);
} |
2598baa1-56ec-4e73-ab9f-402efc467a02 | 8 | public Vector4D getDimensions() {
double x1,y1,z1,x2,y2,z2,x,y,z;
x1 = 0;
y1 = 0;
z1 = 0;
x2 = 0;
y2 = 0;
z2 = 0;
ModelSubset[] subs = getSubsets();
for (int i = 0; i < subs.length; i++) {
Vertex[] vexs = subs[i].getVertices();
for (int j = 0; j < vexs.length; j ++) {
x = vexs[j].getX();
... |
e4a77392-be77-481c-823d-a40bce97b82a | 6 | @SuppressWarnings("deprecation")
private static void signalError(final LinkedList<java.lang.Thread> threads) {
java.lang.Thread currentThread = java.lang.Thread.currentThread();
for (java.lang.Thread t : threads)
if (t != currentThread && t.isAlive()) {
t.interrupt();
try {
java.lang.Thread.sleep(1... |
1100e2a7-d9f6-4e0f-a44a-015b33e9e53c | 1 | public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray) o : null;
} |
a976681e-e1f3-42be-bb08-40ec843afa84 | 2 | public boolean goToURL(String url) {
boolean returnValue = false;
try {
driver.get(url);//TODO use wait object
driver.manage().timeouts().implicitlyWait(7, TimeUnit.SECONDS);
if (getCurrentURL().contains(url)) {// confirm url
returnValue = true;
}
} catch (Exception e) {
// take screen shot ... |
5702f3f3-6069-4fa7-b26a-c90d32c28274 | 4 | char[][] create_matrix(String plain)
{
int row=plain.length()/key.length;
if(plain.length()%key.length!=0)
{
row+=1;
}
char[][] matrix=new char[row][key.length];
int cur_row=0;
int cur_col=0;
for(int i=0;i<row*key.length;i++)
{
if(i>=plain.length())
{
matrix[c... |
eac89701-bf7c-4c9e-9583-04043b9a0f73 | 0 | public void StopRunning()
{
System.out.println("Stop Run !");
ctl = false;
} |
187e2431-0056-4b96-b978-6a7b61982d2e | 4 | void parse_frame() throws BitstreamException
{
// Convert Bytes read to int
int b=0;
byte[] byteread = frame_bytes;
int bytesize = framesize;
// Check ID3v1 TAG (True only if last frame).
//for (int t=0;t<(byteread.length)-2;t++)
//{
// if ((byteread[t]=='T') && (byteread[t+1]=='A') && (byteread[t+2]=='G'))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.